Short path queries in planar graphs in constant time
Łukasz Kowalik, Maciej Kurowski · 2003
We present a new algorithm for answering short path queries in planar graphs. For any fixed constant k and a given unweighted planar graph G=(V,E) one can build in O(|V|) time a data structure, which allows to check in O(1) time whether two given vertices are distant by at most k in G and if so a shortest path between them is returned. This significantly improves the previous result of D. Eppstein [5] where after a linear preprocessing the queries are answered in O(log |V|) time. Our approach can be applied to compute the girth of a planar graph and a corresponding shortest cycle in O(|V|) time provided that the constant bound on the girth is known.Our results can be easily generalized to other wide classes of graphs~--~for instance we can take graphs embeddable in a surface of bounded genus or graphs of bounded tree-width.