The purpose of this report is to explain how the textbook breadth-first search algorithm (BFS) can be modified in order to also create a compact representation of all shortest paths connecting a single source node to all the nodes reachable from it. From this representation, all these paths can also be efficiently enumerated. We then apply this algorithm to solve a similar problem in edge labelled graphs, where paths also have an additional restriction that their edge labels form a word belonging to a regular language. Namely, we solve the problem of evaluating regular path queries (RPQs) under the all-shortest paths semantics.
翻译:本报告旨在阐释如何修改教科书中的广度优先搜索算法(BFS),以构建连接单源节点与所有可达节点的全部最短路径的紧凑表示形式。通过该表示,所有此类路径均可被高效枚举。随后,我们将该算法应用于边标签图中存在的类似问题——在此类图中,路径还受到额外约束:其边标签序列必须构成属于正则语言的词。具体而言,我们解决了在全最短路径语义下评估正则路径查询(RPQ)的问题。