#include <subgraph.h>
|
static PGraph | Do (const PGraph &Graph, const TIntV &NIdV) |
|
template<class PGraph, bool IsMultiGraph>
struct TSnap::TSnapDetail::TGetSubGraph< PGraph, IsMultiGraph >
Definition at line 155 of file subgraph.h.
template<class PGraph, bool IsMultiGraph>
Definition at line 156 of file subgraph.h.
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])); }
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); }
TSizeTy Len() const
Returns the number of elements in the vector.
The documentation for this struct was generated from the following file: