SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 148 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 149 of file subgraph.h.

149  {
150  PGraph NewGraphPt = PGraph::TObj::New();
151  typename PGraph::TObj& NewGraph = *NewGraphPt;
152  NewGraph.Reserve(NIdV.Len(), -1);
153  for (int n = 0; n < NIdV.Len(); n++) {
154  if (Graph->IsNode(NIdV[n])) {
155  NewGraph.AddNode(Graph->GetNI(NIdV[n])); }
156  }
157  for (typename PGraph::TObj::TEdgeI EI = Graph->BegEI(); EI < Graph->EndEI(); EI++) {
158  if (NewGraph.IsNode(EI.GetSrcNId()) && NewGraph.IsNode(EI.GetDstNId())) {
159  NewGraph.AddEdge(EI); }
160  }
161  NewGraph.Defrag();
162  return NewGraphPt;
163  }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547

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