1. A method of determining a distance between two vertices, comprising: receiving as input, at a computing device, a graph comprising a plurality of vertices; generating a plurality of labels for each vertex of the graph wherein for each vertex, each label comprises both a set of vertices referred to as hubs and the distances between the hubs in the label and the vertex; performing hierarchical hub labeling on the labels, wherein performing hierarchical hub labeling comprises: determining an order of the vertices of the graph; and determining an index based on the order; and storing data corresponding to the vertices and labels as preprocessed graph data in storage associated with the computing device.