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