algorithm to check whether a given graph is subgraph of another graph [closed]

狂风中的少年 提交于 2020-01-02 13:34:32

问题


i assume that we have 2 labeled graphs G and T and the algorithm determine if G a subgraph of T and the corresponding vertices in the main graphT and the subgraph G should have same label


回答1:


That problem is called "subgraph isomorphism" and it is NP-complete (and so likely to be hard). Do you need a general solution for this, or just for a particular graph G? The second case is much easier. There is some general information about algorithms here. There is a version of one of the algorithms (actually, for a more general problem) in the Boost Graph Library (see documentation here).




回答2:


A general answer for a general question: the problem you want to solve is known as 'subgraph isomorphism.' Have a look here for further references: http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem .



来源:https://stackoverflow.com/questions/5279562/algorithm-to-check-whether-a-given-graph-is-subgraph-of-another-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!