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
            Asked
            
        
        
            Active
            
        
            Viewed 5,500 times
        
    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 Answers
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
 
- 
                    
 - 
                    @phooji: A lot of the results haven't changed, most likely; I know Nauty is still used, at least, though I've heard of it from the full graph isomorphism problem. The algorithm I mention from my edit is from 1982. – Jeremiah Willcock Mar 11 '11 at 23:47
 - 
                    
 - 
                    
 - 
                    
 
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