| 
    SNAP Library 2.0, Developer Reference
    2013-05-13 16:33:57
    
   SNAP, a general purpose, high performance system for analysis and manipulation of large networks 
   | 
  
  
  
 
#include <subgraph.h>
Static Public Member Functions | |
| static PGraph | Do (const PGraph &Graph, const TIntV &NIdV) | 
Definition at line 142 of file subgraph.h.
| static PGraph TSnap::TSnapDetail::TGetSubGraph< PGraph, IsMultiGraph >::Do | ( | const PGraph & | Graph, | 
| const TIntV & | NIdV | ||
| ) |  [inline, static] | 
        
Definition at line 143 of file subgraph.h.
References TVec< TVal, TSizeTy >::Len().
                                                           {
    PGraph NewGraphPt = PGraph::TObj::New();
    typename PGraph::TObj& NewGraph = *NewGraphPt;
    NewGraph.Reserve(NIdV.Len(), -1);
    for (int n = 0; n < NIdV.Len(); n++) {
      if (Graph->IsNode(NIdV[n])) {
        NewGraph.AddNode(Graph->GetNI(NIdV[n])); }
    }
    for (typename PGraph::TObj::TEdgeI EI = Graph->BegEI(); EI < Graph->EndEI(); EI++) {
      if (NewGraph.IsNode(EI.GetSrcNId()) && NewGraph.IsNode(EI.GetDstNId())) {
        NewGraph.AddEdge(EI); }
    }
    NewGraph.Defrag();
    return NewGraphPt;
  }
