Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 944
fayza Avatar asked Nov 15 '25 20:11

fayza


2 Answers

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).

like image 143
Jeremiah Willcock Avatar answered Nov 18 '25 19:11

Jeremiah Willcock


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 .

like image 31
phooji Avatar answered Nov 18 '25 21:11

phooji



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!