SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TSnap::TSnapDetail::TGetSubGraph< PGraph, IsMultiGraph > Struct Template Reference

#include <subgraph.h>

Static Public Member Functions

static PGraph Do (const PGraph &Graph, const TIntV &NIdV)
 

Detailed Description

template<class PGraph, bool IsMultiGraph>
struct TSnap::TSnapDetail::TGetSubGraph< PGraph, IsMultiGraph >

Definition at line 180 of file subgraph.h.

Member Function Documentation

template<class PGraph, bool IsMultiGraph>
static PGraph TSnap::TSnapDetail::TGetSubGraph< PGraph, IsMultiGraph >::Do ( const PGraph &  Graph,
const TIntV NIdV 
)
inlinestatic

Definition at line 181 of file subgraph.h.

181  {
182  PGraph NewGraphPt = PGraph::TObj::New();
183  typename PGraph::TObj& NewGraph = *NewGraphPt;
184  NewGraph.Reserve(NIdV.Len(), -1);
185  for (int n = 0; n < NIdV.Len(); n++) {
186  if (Graph->IsNode(NIdV[n])) {
187  NewGraph.AddNode(Graph->GetNI(NIdV[n])); }
188  }
189  for (typename PGraph::TObj::TEdgeI EI = Graph->BegEI(); EI < Graph->EndEI(); EI++) {
190  if (NewGraph.IsNode(EI.GetSrcNId()) && NewGraph.IsNode(EI.GetDstNId())) {
191  NewGraph.AddEdge(EI); }
192  }
193  NewGraph.Defrag();
194  return NewGraphPt;
195  }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575

The documentation for this struct was generated from the following file: