|
SNAP Library 2.1, User Reference
2013-09-25 10:47:25
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.
{
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;
}