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
graphmp.h
Go to the documentation of this file.
1 #ifdef GCC_ATOMIC
2 //#//////////////////////////////////////////////
4 class TNGraphMP;
5 
7 
8 //#//////////////////////////////////////////////
10 
24 class TNGraphMP {
25 public:
26  typedef TNGraphMP TNet;
28 public:
29  class TNode {
30  private:
33  public:
34  TNode() : Id(-1), InNIdV(), OutNIdV() { }
35  TNode(const int& NId) : Id(NId), InNIdV(), OutNIdV() { }
36  TNode(const TNode& Node) : Id(Node.Id), InNIdV(Node.InNIdV), OutNIdV(Node.OutNIdV) { }
37  TNode(TSIn& SIn) : Id(SIn), InNIdV(SIn), OutNIdV(SIn) { }
38  void Save(TSOut& SOut) const { Id.Save(SOut); InNIdV.Save(SOut); OutNIdV.Save(SOut); }
39  int GetId() const { return Id; }
40  int GetDeg() const { return GetInDeg() + GetOutDeg(); }
41  int GetInDeg() const { return InNIdV.Len(); }
42  int GetOutDeg() const { return OutNIdV.Len(); }
43  int GetInNId(const int& NodeN) const { return InNIdV[NodeN]; }
44  int GetOutNId(const int& NodeN) const { return OutNIdV[NodeN]; }
45  int GetNbrNId(const int& NodeN) const { return NodeN<GetOutDeg()?GetOutNId(NodeN):GetInNId(NodeN-GetOutDeg()); }
46  bool IsInNId(const int& NId) const { return InNIdV.SearchBin(NId) != -1; }
47  bool IsOutNId(const int& NId) const { return OutNIdV.SearchBin(NId) != -1; }
48  bool IsNbrNId(const int& NId) const { return IsOutNId(NId) || IsInNId(NId); }
49  void PackOutNIdV() { OutNIdV.Pack(); }
50  void PackNIdV() { InNIdV.Pack(); }
51  void SortNIdV() { InNIdV.Sort(); OutNIdV.Sort();}
52  friend class TNGraphMP;
53  };
55  class TNodeI {
56  private:
59  public:
60  TNodeI() : NodeHI() { }
61  TNodeI(const THashIter& NodeHIter) : NodeHI(NodeHIter) { }
62  TNodeI(const TNodeI& NodeI) : NodeHI(NodeI.NodeHI) { }
63  TNodeI& operator = (const TNodeI& NodeI) { NodeHI = NodeI.NodeHI; return *this; }
65  TNodeI& operator++ (int) { NodeHI++; return *this; }
66  bool operator < (const TNodeI& NodeI) const { return NodeHI < NodeI.NodeHI; }
67  bool operator == (const TNodeI& NodeI) const { return NodeHI == NodeI.NodeHI; }
69  int GetId() const { return NodeHI.GetDat().GetId(); }
71  int GetDeg() const { return NodeHI.GetDat().GetDeg(); }
73  int GetInDeg() const { return NodeHI.GetDat().GetInDeg(); }
75  int GetOutDeg() const { return NodeHI.GetDat().GetOutDeg(); }
77  void SortNIdV() { NodeHI.GetDat().SortNIdV(); }
79 
81  int GetInNId(const int& NodeN) const { return NodeHI.GetDat().GetInNId(NodeN); }
83 
85  int GetOutNId(const int& NodeN) const { return NodeHI.GetDat().GetOutNId(NodeN); }
87 
89  int GetNbrNId(const int& NodeN) const { return NodeHI.GetDat().GetNbrNId(NodeN); }
91  bool IsInNId(const int& NId) const { return NodeHI.GetDat().IsInNId(NId); }
93  bool IsOutNId(const int& NId) const { return NodeHI.GetDat().IsOutNId(NId); }
95  bool IsNbrNId(const int& NId) const { return IsOutNId(NId) || IsInNId(NId); }
96  friend class TNGraphMP;
97  };
99  class TEdgeI {
100  private:
102  int CurEdge;
103  public:
104  TEdgeI() : CurNode(), EndNode(), CurEdge(0) { }
105  TEdgeI(const TNodeI& NodeI, const TNodeI& EndNodeI, const int& EdgeN=0) : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
106  TEdgeI(const TEdgeI& EdgeI) : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
107  TEdgeI& operator = (const TEdgeI& EdgeI) { if (this!=&EdgeI) { CurNode=EdgeI.CurNode; EndNode=EdgeI.EndNode; CurEdge=EdgeI.CurEdge; } return *this; }
110  while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } return *this; }
111  bool operator < (const TEdgeI& EdgeI) const { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
112  bool operator == (const TEdgeI& EdgeI) const { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
114  int GetId() const { return -1; }
116  int GetSrcNId() const { return CurNode.GetId(); }
118  int GetDstNId() const { return CurNode.GetOutNId(CurEdge); }
119  friend class TNGraphMP;
120  };
121 private:
125 private:
126  TNode& GetNode(const int& NId) { return NodeH.GetDat(NId); }
127  const TNode& GetNode(const int& NId) const { return NodeH.GetDat(NId); }
128 public:
129  TNGraphMP() : CRef(), MxNId(0), NodeH() { }
131  explicit TNGraphMP(const int& Nodes, const int& Edges) : MxNId(0) { Reserve(Nodes, Edges); }
132  TNGraphMP(const TNGraphMP& Graph) : MxNId(Graph.MxNId), NodeH(Graph.NodeH) { }
134  TNGraphMP(TSIn& SIn) : MxNId(SIn), NodeH(SIn) { }
136  void Save(TSOut& SOut) const { MxNId.Save(SOut); NodeH.Save(SOut); }
138  static PNGraphMP New() { return new TNGraphMP(); }
140 
142  static PNGraphMP New(const int& Nodes, const int& Edges) { return new TNGraphMP(Nodes, Edges); }
144  static PNGraphMP Load(TSIn& SIn) { return PNGraphMP(new TNGraphMP(SIn)); }
146  bool HasFlag(const TGraphFlag& Flag) const;
147  TNGraphMP& operator = (const TNGraphMP& Graph) {
148  if (this!=&Graph) { MxNId=Graph.MxNId; NodeH=Graph.NodeH; } return *this; }
149 
151  int GetNodes() const { return NodeH.Len(); }
153  void SetNodes(const int& Length) { NodeH.SetLen(Length); }
155 
159  int AddNode(int NId = -1);
161  int AddNodeUnchecked(int NId = -1);
163  int AddNode(const TNodeI& NodeId) { return AddNode(NodeId.GetId()); }
165 
174  int AddNode(const int& NId, const TIntV& InNIdV, const TIntV& OutNIdV);
176 
184  int AddNode(const int& NId, const TVecPool<TInt>& Pool, const int& SrcVId, const int& DstVId);
186 
188  void DelNode(const int& NId);
190  void DelNode(const TNode& NodeI) { DelNode(NodeI.GetId()); }
192  bool IsNode(const int& NId) const { return NodeH.IsKey(NId); }
194  TNodeI BegNI() const { return TNodeI(NodeH.BegI()); }
196  TNodeI EndNI() const { return TNodeI(NodeH.EndI()); }
198  TNodeI GetNI(const int& NId) const { return TNodeI(NodeH.GetI(NId)); }
199  // GetNodeC() has been commented out. It was a quick shortcut, do not use.
200  //const TNode& GetNodeC(const int& NId) const { return NodeH.GetDat(NId); }
202  int GetMxNId() const { return MxNId; }
203  int Reserved() const {return NodeH.GetReservedKeyIds();}
204 
206  int GetEdges() const;
208 
214  int AddEdge(const int& SrcNId, const int& DstNId);
216  int AddEdgeUnchecked(const int& SrcNId, const int& DstNId);
218  int AddEdge(const TEdgeI& EdgeI) { return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId()); }
219  int AddOutEdge1(int& SrcIdx, const int& SrcNId, const int& DstNId);
220  int AddInEdge1(int& DstIdx, const int& SrcNId, const int& DstNId);
221  void AddOutEdge2(const int& SrcNId, const int& DstNId);
222  void AddInEdge2(const int& SrcNId, const int& DstNId);
223 
225  void AddNodeWithEdges(const TInt& NId, TIntV& InNIdV, TIntV& OutNIdV);
226 
228 
232  void DelEdge(const int& SrcNId, const int& DstNId, const bool& IsDir = true);
234  bool IsEdge(const int& SrcNId, const int& DstNId, const bool& IsDir = true) const;
236  TEdgeI BegEI() const { TNodeI NI=BegNI(); while(NI<EndNI() && NI.GetOutDeg()==0){NI++;} return TEdgeI(NI, EndNI()); }
238  TEdgeI EndEI() const { return TEdgeI(EndNI(), EndNI()); }
239  // /// Not supported/implemented!
240  // TEdgeI GetEI(const int& EId) const; // not supported
242  TEdgeI GetEI(const int& SrcNId, const int& DstNId) const;
243 
245  int GetRndNId(TRnd& Rnd=TInt::Rnd) { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
247  TNodeI GetRndNI(TRnd& Rnd=TInt::Rnd) { return GetNI(GetRndNId(Rnd)); }
249  void GetNIdV(TIntV& NIdV) const;
250 
252  bool Empty() const { return GetNodes()==0; }
254  void Clr() { MxNId=0; NodeH.Clr(); }
256  void Reserve(const int& Nodes, const int& Edges) { if (Nodes>0) { NodeH.Gen(Nodes); } }
258  void ReserveNodeDegs(const int& Idx, const int& InDeg, const int& OutDeg) { if (InDeg > 0) NodeH[Idx].InNIdV.Reserve(InDeg); if (OutDeg > 0) NodeH[Idx].OutNIdV.Reserve(OutDeg); }
260  void ReserveNIdInDeg(const int& NId, const int& InDeg) { GetNode(NId).InNIdV.Reserve(InDeg); }
262  void ReserveNIdOutDeg(const int& NId, const int& OutDeg) { GetNode(NId).OutNIdV.Reserve(OutDeg); }
264  void SortEdges(const int& Idx, const int& InDeg, const int& OutDeg) { if (InDeg > 0) NodeH[Idx].InNIdV.Sort(); if (OutDeg > 0) NodeH[Idx].OutNIdV.Sort(); }
266  void SortNodeAdjV() { for (TNodeI NI = BegNI(); NI < EndNI(); NI++) { NI.SortNIdV();} }
268 
273  void Defrag(const bool& OnlyNodeLinks=false);
275 
278  bool IsOk(const bool& ThrowExcept=true) const;
280  void Dump(FILE *OutF=stdout) const;
282 
286  static PNGraphMP GetSmallGraph();
287  friend class TPt<TNGraphMP>;
288  friend class TNGraphMPMtx;
289 };
290 
291 // set flags
292 namespace TSnap {
293 template <> struct IsDirected<TNGraphMP> { enum { Val = 1 }; };
294 }
295 #endif // GCC_ATOMIC
Definition: bd.h:440
TIter GetI(const TKey &Key) const
Definition: hashmp.h:158
TNGraphMP TNet
Definition: graphmp.h:26
void AddOutEdge2(const int &SrcNId, const int &DstNId)
Definition: graphmp.cpp:272
int GetInDeg() const
Definition: graphmp.h:41
int GetDeg() const
Definition: graphmp.h:40
bool Empty() const
Tests whether the graph is empty (has zero nodes).
Definition: graphmp.h:252
TNGraphMP()
Definition: graphmp.h:129
bool operator<(const TEdgeI &EdgeI) const
Definition: graphmp.h:111
int GetOutNId(const int &NodeN) const
Definition: graphmp.h:44
int AddOutEdge1(int &SrcIdx, const int &SrcNId, const int &DstNId)
Definition: graphmp.cpp:234
void Save(TSOut &SOut) const
Definition: hashmp.h:129
bool IsNbrNId(const int &NId) const
Definition: graphmp.h:48
void ReserveNIdInDeg(const int &NId, const int &InDeg)
Reserves memory for node ID NId having InDeg in-edges.
Definition: graphmp.h:260
Definition: dt.h:11
int GetMxNId() const
Returns the maximum id of a any node in the graph.
Definition: graphmp.h:202
void Save(TSOut &SOut) const
Definition: dt.h:1060
TNGraphMP(const TNGraphMP &Graph)
Definition: graphmp.h:132
void SortEdges(const int &Idx, const int &InDeg, const int &OutDeg)
Sorts in-edges and out-edges.
Definition: graphmp.h:264
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
Definition: graphmp.h:198
TIntV OutNIdV
Definition: graphmp.h:32
Tests (at compile time) if the graph is directed.
Definition: gbase.h:28
void ReserveNIdOutDeg(const int &NId, const int &OutDeg)
Reserves memory for node ID NId having OutDeg out-edges.
Definition: graphmp.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TEdgeI & operator++(int)
Increment iterator.
Definition: graphmp.h:109
static PNGraphMP New()
Static constructor that returns a pointer to the graph. Call: PNGraphMP Graph = TNGraphMP::New().
Definition: graphmp.h:138
TNode(const TNode &Node)
Definition: graphmp.h:36
void DelNode(const int &NId)
Deletes node of ID NId from the graph.
Definition: graphmp.cpp:68
TEdgeI(const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
Definition: graphmp.h:105
TPt< TNGraphMP > PNet
Definition: graphmp.h:27
void SetLen(const int &Length)
Definition: hashmp.h:166
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
Definition: graphmp.h:85
int AddEdge(const TEdgeI &EdgeI)
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() to the graph.
Definition: graphmp.h:218
bool operator<(const TNodeI &NodeI) const
Definition: graphmp.h:66
const TNode & GetNode(const int &NId) const
Definition: graphmp.h:127
static TRnd Rnd
Definition: dt.h:1053
int GetNbrNId(const int &NodeN) const
Definition: graphmp.h:45
void Save(TSOut &SOut) const
Definition: graphmp.h:38
void DelEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true)
Deletes an edge from node IDs SrcNId to DstNId from the graph.
Definition: graphmp.cpp:112
TNodeI(const THashIter &NodeHIter)
Definition: graphmp.h:61
void Dump(FILE *OutF=stdout) const
Print the graph in a human readable form to an output stream OutF.
Definition: graphmp.cpp:206
int GetEdges() const
Returns the number of edges in the graph.
Definition: graphmp.cpp:89
void ReserveNodeDegs(const int &Idx, const int &InDeg, const int &OutDeg)
Reserves memory for node Idx having InDeg in-edges and OutDeg out-edges.
Definition: graphmp.h:258
Definition: fl.h:58
void Save(TSOut &SOut) const
Definition: ds.h:903
void SortNIdV()
Sorts the adjacency lists of the current node.
Definition: graphmp.h:77
TNode(const int &NId)
Definition: graphmp.h:35
int GetInNId(const int &NodeN) const
Definition: graphmp.h:43
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the graph.
Definition: graphmp.h:247
static PNGraphMP New(const int &Nodes, const int &Edges)
Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and...
Definition: graphmp.h:142
int GetOutDeg() const
Definition: graphmp.h:42
TIter EndI() const
Definition: hashmp.h:156
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: graphmp.h:256
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: graphmp.h:236
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: graphmp.h:194
int AddEdgeUnchecked(const int &SrcNId, const int &DstNId)
Adds an edge from node IDs SrcNId to node DstNId to the graph without performing checks.
Definition: graphmp.cpp:106
TCRef CRef
Definition: graphmp.h:122
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the graph.
Definition: graphmp.cpp:149
bool operator==(const TEdgeI &EdgeI) const
Definition: graphmp.h:112
int AddNode(const TNodeI &NodeId)
Adds a node of ID NodeI.GetId() to the graph.
Definition: graphmp.h:163
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1254
void AddInEdge2(const int &SrcNId, const int &DstNId)
Definition: graphmp.cpp:276
TIntV InNIdV
Definition: graphmp.h:32
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the graph.
Definition: graphmp.h:245
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: graphmp.h:196
void SortNIdV()
Definition: graphmp.h:51
TNGraphMP & operator=(const TNGraphMP &Graph)
Definition: graphmp.h:147
int GetSrcNId() const
Gets the source node of an edge.
Definition: graphmp.h:116
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the graph.
Definition: graphmp.h:190
void PackOutNIdV()
Definition: graphmp.h:49
void Save(TSOut &SOut) const
Saves the graph to a (binary) stream SOut.
Definition: graphmp.h:136
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: graphmp.h:192
void SetNodes(const int &Length)
Sets the number of nodes in the graph.
Definition: graphmp.h:153
Directed graph for multi-threaded operations.
Definition: graphmp.h:24
int GetDeg() const
Returns degree of the current node, the sum of in-degree and out-degree.
Definition: graphmp.h:71
int GetDstNId() const
Gets destination node of an edge.
Definition: graphmp.h:118
TEdgeI GetEI(const int &SrcNId, const int &DstNId) const
Returns an iterator referring to edge (SrcNId, DstNId) in the graph.
Definition: graphmp.cpp:136
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
Definition: graphmp.h:93
int GetId() const
Returns ID of the current node.
Definition: graphmp.h:69
TNGraphMP(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a graph of Nodes nodes and Edges edges.
Definition: graphmp.h:131
int AddInEdge1(int &DstIdx, const int &SrcNId, const int &DstNId)
Definition: graphmp.cpp:253
Edge iterator. Only forward iteration (operator++) is supported.
Definition: graphmp.h:99
Definition: fl.h:128
Node iterator. Only forward iteration (operator++) is supported.
Definition: graphmp.h:55
bool IsInNId(const int &NId) const
Definition: graphmp.h:46
void Clr()
Deletes all nodes and edges from the graph.
Definition: graphmp.h:254
TSizeTy SearchBin(const TVal &Val) const
Returns the position of an element with value Val.
Definition: ds.h:1454
void AddNodeWithEdges(const TInt &NId, TIntV &InNIdV, TIntV &OutNIdV)
Adds a node of ID NId to the graph, creates edges to the node from all nodes in vector InNIdV...
Definition: graphmp.cpp:282
Definition: dt.h:1044
friend class TNGraphMPMtx
Definition: graphmp.h:288
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the graph (see the TGraphFlag for flags).
Definition: graphmp.cpp:6
int GetReservedKeyIds() const
Definition: hashmp.h:169
THashIter NodeHI
Definition: graphmp.h:58
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
Definition: graphmp.h:91
int GetRndKeyId(TRnd &Rnd) const
Get an index of a random element. If the hash table has many deleted keys, this may take a long time...
Definition: hashmp.h:558
int GetId() const
Definition: graphmp.h:39
void Gen(const int &ExpectVals)
Definition: hashmp.h:160
THashMP< TInt, TNode > NodeH
Definition: graphmp.h:124
TNGraphMP(TSIn &SIn)
Constructor that loads the graph from a (binary) stream SIn.
Definition: graphmp.h:134
bool IsOutNId(const int &NId) const
Definition: graphmp.h:47
bool IsOk(const bool &ThrowExcept=true) const
Checks the graph data structure for internal consistency.
Definition: graphmp.cpp:160
TIter BegI() const
Definition: hashmp.h:153
int GetOutDeg() const
Returns out-degree of the current node.
Definition: graphmp.h:75
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the graph.
Definition: graphmp.cpp:143
int GetId() const
Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.
Definition: graphmp.h:114
void SortNodeAdjV()
Sorts the adjacency lists of each node.
Definition: graphmp.h:266
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
Definition: graphmp.h:89
void Pack()
Reduces vector capacity (frees memory) to match its size.
Definition: ds.h:1005
enum TGraphFlag_ TGraphFlag
Graph Flags, used for quick testing of graph types.
int GetInDeg() const
Returns in-degree of the current node.
Definition: graphmp.h:73
TEdgeI & operator=(const TEdgeI &EdgeI)
Definition: graphmp.h:107
TInt MxNId
Definition: graphmp.h:123
Hash-Table with multiprocessing support.
Definition: hashmp.h:81
TNode(TSIn &SIn)
Definition: graphmp.h:37
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: graphmp.h:238
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
Definition: graphmp.h:95
Definition: bd.h:196
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graphmp.h:151
void Clr(const bool &DoDel=true)
Definition: hashmp.h:474
void PackNIdV()
Definition: graphmp.h:50
static PNGraphMP GetSmallGraph()
Returns a small graph on 5 nodes and 6 edges.
Definition: graphmp.cpp:223
void Reserve(const TSizeTy &_MxVals)
Reserves enough memory for the vector to store _MxVals elements.
Definition: ds.h:515
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
Definition: graphmp.cpp:10
bool operator==(const TNodeI &NodeI) const
Definition: graphmp.h:67
int Reserved() const
Definition: graphmp.h:203
TNodeI & operator++(int)
Increment iterator.
Definition: graphmp.h:65
TNodeI CurNode
Definition: graphmp.h:101
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the graph without performing checks.
Definition: graphmp.cpp:21
static PNGraphMP Load(TSIn &SIn)
Static constructor that loads the graph from a stream SIn and returns a pointer to it...
Definition: graphmp.h:144
TPt< TNGraphMP > PNGraphMP
Definition: graphmp.h:4
TNodeI & operator=(const TNodeI &NodeI)
Definition: graphmp.h:63
TEdgeI(const TEdgeI &EdgeI)
Definition: graphmp.h:106
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
Definition: graphmp.h:81
bool IsEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true) const
Tests whether an edge from node IDs SrcNId to DstNId exists in the graph.
Definition: graphmp.cpp:130
TNodeI EndNode
Definition: graphmp.h:101
TNode & GetNode(const int &NId)
Definition: graphmp.h:126
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node IDs SrcNId to node DstNId to the graph.
Definition: graphmp.cpp:97
THashMP< TInt, TNode >::TIter THashIter
Definition: graphmp.h:57
TNodeI(const TNodeI &NodeI)
Definition: graphmp.h:62
int Len() const
Definition: hashmp.h:165
const TKey & GetKey(const int &KeyId) const
Definition: hashmp.h:185