SNAP Library 4.1, Developer Reference  2018-07-26 16:30:42
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 155 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 156 of file subgraph.h.

References TVec< TVal, TSizeTy >::Len().

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

Here is the call graph for this function:


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