#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 180 of file subgraph.h.
template<class PGraph, bool IsMultiGraph>
Definition at line 181 of file subgraph.h.
References TVec< TVal, TSizeTy >::Len().
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])); }
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); }
TSizeTy Len() const
Returns the number of elements in the vector.
The documentation for this struct was generated from the following file: