2

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

miku
  • 181,842
  • 47
  • 306
  • 310
fayza
  • 31
  • 1
  • 2
  • Just a note on the side, the [Subgraph isomorphism problem](http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem) is NP-complete. – miku Mar 11 '11 at 23:42

2 Answers2

2

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

Jeremiah Willcock
  • 30,161
  • 7
  • 76
  • 78
1

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 .

phooji
  • 10,086
  • 2
  • 38
  • 45