16 template <
class TNodeData>
29 TNode() : Id(-1), NodeDat(), InNIdV(), OutNIdV() { }
30 TNode(
const int& NId) : Id(NId), NodeDat(), InNIdV(), OutNIdV() { }
31 TNode(
const int& NId,
const TNodeData& NodeData) : Id(NId), NodeDat(NodeData), InNIdV(), OutNIdV() { }
32 TNode(
const TNode& Node) : Id(Node.Id), NodeDat(Node.NodeDat), InNIdV(Node.InNIdV), OutNIdV(Node.OutNIdV) { }
33 TNode(
TSIn& SIn) : Id(SIn), NodeDat(SIn), InNIdV(SIn), OutNIdV(SIn) { }
41 int GetInNId(
const int& NodeN)
const {
return InNIdV[NodeN]; }
42 int GetOutNId(
const int& NodeN)
const {
return OutNIdV[NodeN]; }
49 NodeDat = TNodeData(MStream);
66 TNodeI(
const TNodeI& NodeI) : NodeHI(NodeI.NodeHI), Net(NodeI.Net) { }
74 int GetId()
const {
return NodeHI.GetDat().GetId(); }
76 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
78 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
80 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
84 int GetInNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetInNId(NodeN); }
88 int GetOutNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetOutNId(NodeN); }
92 int GetNbrNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetNbrNId(NodeN); }
94 bool IsInNId(
const int& NId)
const {
return NodeHI.GetDat().IsInNId(NId); }
96 bool IsOutNId(
const int& NId)
const {
return NodeHI.GetDat().IsOutNId(NId); }
99 const TNodeData&
operator () ()
const {
return NodeHI.GetDat().NodeDat; }
101 const TNodeData&
GetDat()
const {
return NodeHI.GetDat().GetDat(); }
102 TNodeData&
GetDat() {
return NodeHI.GetDat().GetDat(); }
118 TEdgeI() : CurNode(), EndNode(), CurEdge(0) { }
119 TEdgeI(
const TNodeI& NodeI,
const TNodeI& EndNodeI,
const int& EdgeN=0) : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
120 TEdgeI(
const TEdgeI& EdgeI) : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
124 while (CurNode < EndNode && CurNode.
GetOutDeg()==0) { CurNode++; } }
return *
this; }
162 explicit TNodeNet(
const int& Nodes,
const int& Edges) : MxNId(0) {
Reserve(Nodes, Edges); }
181 return PNet(Network);
186 if (
this!=&NodeNet) { NodeH=NodeNet.
NodeH; MxNId=NodeNet.
MxNId; }
return *
this; }
207 int AddNode(
int NId,
const TNodeData& NodeDat);
209 int AddNode(
const TNodeI& NodeI) {
return AddNode(NodeI.GetId(), NodeI.GetDat()); }
213 virtual void DelNode(
const int& NId);
219 TNodeI
BegNI()
const {
return TNodeI(NodeH.
BegI(),
this); }
221 TNodeI
EndNI()
const {
return TNodeI(NodeH.
EndI(),
this); }
223 TNodeI
GetNI(
const int& NId)
const {
return TNodeI(NodeH.
GetI(NId),
this); }
227 void SetNDat(
const int& NId,
const TNodeData& NodeDat);
245 int AddEdge(
const int& SrcNId,
const int& DstNId);
247 int AddEdge(
const TEdgeI& EdgeI) {
return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId()); }
253 void DelEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true);
255 bool IsEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true)
const;
261 TEdgeI
GetEI(
const int& EId)
const;
263 TEdgeI
GetEI(
const int& SrcNId,
const int& DstNId)
const;
275 void Clr(
const bool& DoDel=
true,
const bool& ResetDat=
true) {
276 MxNId = 0; NodeH.
Clr(DoDel, -1, ResetDat); }
278 void Reserve(
const int& Nodes,
const int& Edges) {
if (Nodes>0) { NodeH.
Gen(Nodes/2); } }
289 void Defrag(
const bool& OnlyNodeLinks=
false);
294 bool IsOk(
const bool& ThrowExcept=
true)
const;
305 template <
class TNodeData>
310 template <
class TNodeData>
313 NId = MxNId; MxNId++;
318 NodeH.AddDat(NId,
TNode(NId));
322 template <
class TNodeData>
325 NId = MxNId; MxNId++;
327 if (IsNode(NId)) {
return -1;}
330 NodeH.AddDat(NId,
TNode(NId));
334 template <
class TNodeData>
337 NId = MxNId; MxNId++;
342 NodeH.AddDat(NId,
TNode(NId, NodeDat));
346 template <
class TNodeData>
348 {
TNode& Node = GetNode(NId);
349 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
351 if (nbr == NId) {
continue; }
352 TNode& N = GetNode(nbr);
356 for (
int e = 0; e < Node.
GetInDeg(); e++) {
358 if (nbr == NId) {
continue; }
359 TNode& N = GetNode(nbr);
366 template <
class TNodeData>
369 NodeH.GetDat(NId).NodeDat = NodeDat;
372 template <
class TNodeData>
375 for (
int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N);) {
376 edges+=NodeH[N].GetOutDeg(); }
380 template <
class TNodeData>
382 IAssertR(IsNode(SrcNId) && IsNode(DstNId),
TStr::Fmt(
"%d or %d not a node.", SrcNId, DstNId).CStr());
383 if (IsEdge(SrcNId, DstNId)) {
return -2; }
384 GetNode(SrcNId).OutNIdV.AddSorted(DstNId);
385 GetNode(DstNId).InNIdV.AddSorted(SrcNId);
389 template <
class TNodeData>
391 IAssertR(IsNode(SrcNId) && IsNode(DstNId),
TStr::Fmt(
"%d or %d not a node.", SrcNId, DstNId).CStr());
392 GetNode(SrcNId).OutNIdV.DelIfIn(DstNId);
393 GetNode(DstNId).InNIdV.DelIfIn(SrcNId);
395 GetNode(DstNId).OutNIdV.DelIfIn(SrcNId);
396 GetNode(SrcNId).InNIdV.DelIfIn(DstNId);
400 template <
class TNodeData>
402 if (! IsNode(SrcNId) || ! IsNode(DstNId)) {
return false; }
403 if (IsDir) {
return GetNode(SrcNId).IsOutNId(DstNId); }
404 else {
return GetNode(SrcNId).IsOutNId(DstNId) || GetNode(DstNId).IsOutNId(SrcNId); }
407 template <
class TNodeData>
410 for (
int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
411 NIdV.
Add(NodeH.GetKey(N)); }
414 template <
class TNodeData>
416 const TNodeI SrcNI = GetNI(SrcNId);
417 const int NodeN = SrcNI.
NodeHI.GetDat().OutNIdV.SearchBin(DstNId);
418 if (NodeN == -1) {
return EndEI(); }
419 return TEdgeI(SrcNI, EndNI(), NodeN);
422 template <
class TNodeData>
424 for (
int n = NodeH.FFirstKeyId(); NodeH.FNextKeyId(n); ) {
425 TNode& Node = NodeH[n];
428 if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) {
432 template <
class TNodeData>
435 for (
int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
436 const TNode& Node = NodeH[N];
438 const TStr Msg =
TStr::Fmt(
"Out-neighbor list of node %d is not sorted.", Node.
GetId());
442 const TStr Msg =
TStr::Fmt(
"In-neighbor list of node %d is not sorted.", Node.
GetId());
447 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
449 const TStr Msg =
TStr::Fmt(
"Out-edge %d --> %d: node %d does not exist.",
453 if (e > 0 && prevNId == Node.
GetOutNId(e)) {
454 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate out-edge %d --> %d.",
462 for (
int e = 0; e < Node.
GetInDeg(); e++) {
464 const TStr Msg =
TStr::Fmt(
"In-edge %d <-- %d: node %d does not exist.",
468 if (e > 0 && prevNId == Node.
GetInNId(e)) {
469 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate in-edge %d <-- %d.",
490 template <
class TNodeData,
class TEdgeData>
506 TNode() : Id(-1), NodeDat(), InNIdV(), OutNIdV() { }
507 TNode(
const int& NId) : Id(NId), NodeDat(), InNIdV(), OutNIdV() { }
508 TNode(
const int& NId,
const TNodeData& NodeData) : Id(NId), NodeDat(NodeData), InNIdV(), OutNIdV() { }
509 TNode(
const TNode& Node) : Id(Node.Id), NodeDat(Node.NodeDat), InNIdV(Node.InNIdV), OutNIdV(Node.OutNIdV) { }
510 TNode(
TSIn& SIn) : Id(SIn), NodeDat(SIn), InNIdV(SIn), OutNIdV(SIn) { }
518 int GetInNId(
const int& EdgeN)
const {
return InNIdV[EdgeN]; }
519 int GetOutNId(
const int& EdgeN)
const {
return OutNIdV[EdgeN].Val1; }
521 TEdgeData&
GetOutEDat(
const int& EdgeN) {
return OutNIdV[EdgeN].Val2; }
522 const TEdgeData&
GetOutEDat(
const int& EdgeN)
const {
return OutNIdV[EdgeN].Val2; }
528 NodeDat = TNodeData(MStream);
553 int GetId()
const {
return NodeHI.GetDat().GetId(); }
555 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
557 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
559 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
563 int GetInNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetInNId(NodeN); }
567 int GetOutNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetOutNId(NodeN); }
571 int GetNbrNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetNbrNId(NodeN); }
573 bool IsInNId(
const int& NId)
const {
return NodeHI.GetDat().IsInNId(NId); }
575 bool IsOutNId(
const int& NId)
const {
return NodeHI.GetDat().IsOutNId(NId); }
579 const TNodeData&
operator () ()
const {
return NodeHI.GetDat().NodeDat; }
581 const TNodeData&
GetDat()
const {
return NodeHI.GetDat().GetDat(); }
582 TNodeData&
GetDat() {
return NodeHI.GetDat().GetDat(); }
590 TEdgeData&
GetOutEDat(
const int& EdgeN) {
return NodeHI.GetDat().GetOutEDat(EdgeN); }
591 const TEdgeData&
GetOutEDat(
const int& EdgeN)
const {
return NodeHI.GetDat().GetOutEDat(EdgeN); }
605 TEdgeI() : CurNode(), EndNode(), CurEdge(0) { }
606 TEdgeI(
const TNodeI& NodeI,
const TNodeI& EndNodeI,
const int& EdgeN=0) : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
607 TEdgeI(
const TEdgeI& EdgeI) : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
611 while (CurNode < EndNode && CurNode.
GetOutDeg()==0) { CurNode++; } }
return *
this; }
670 TNet* Network =
new TNet();
672 return PNet(Network);
677 NodeH=NodeNet.
NodeH; MxNId=NodeNet.
MxNId; }
return *
this; }
698 int AddNode(
int NId,
const TNodeData& NodeDat);
700 int AddNode(
const TNodeI& NodeI) {
return AddNode(NodeI.GetId(), NodeI.GetDat()); }
710 TNodeI
BegNI()
const {
return TNodeI(NodeH.
BegI(),
this); }
712 TNodeI
EndNI()
const {
return TNodeI(NodeH.
EndI(),
this); }
714 TNodeI
GetNI(
const int& NId)
const {
return TNodeI(NodeH.
GetI(NId),
this); }
718 void SetNDat(
const int& NId,
const TNodeData& NodeDat);
736 int AddEdge(
const int& SrcNId,
const int& DstNId);
744 int AddEdge(
const int& SrcNId,
const int& DstNId,
const TEdgeData& EdgeDat);
746 int AddEdge(
const TEdgeI& EdgeI) {
return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), EdgeI()); }
752 void DelEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true);
754 bool IsEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true)
const;
760 TEdgeI
GetEI(
const int& EId)
const;
762 TEdgeI
GetEI(
const int& SrcNId,
const int& DstNId)
const;
764 void SetEDat(
const int& SrcNId,
const int& DstNId,
const TEdgeData& EdgeDat);
768 bool GetEDat(
const int& SrcNId,
const int& DstNId, TEdgeData& EdgeDat)
const;
770 TEdgeData&
GetEDat(
const int& SrcNId,
const int& DstNId);
772 const TEdgeData&
GetEDat(
const int& SrcNId,
const int& DstNId)
const;
786 void Clr(
const bool& DoDel=
true,
const bool& ResetDat=
true) {
787 MxNId = 0; NodeH.
Clr(DoDel, -1, ResetDat); }
789 void Reserve(
const int& Nodes,
const int& Edges) {
if (Nodes>0) { NodeH.
Gen(Nodes/2); } }
800 void Defrag(
const bool& OnlyNodeLinks=
false);
805 bool IsOk(
const bool& ThrowExcept=
true)
const;
817 template <
class TNodeData,
class TEdgeData>
822 template <
class TNodeData,
class TEdgeData>
824 int LValN=0, RValN = NIdV.Len()-1;
825 while (RValN >= LValN) {
826 const int ValN = (LValN+RValN)/2;
827 const int CurNId = NIdV[ValN].Val1;
828 if (NId == CurNId) {
return ValN; }
829 if (NId < CurNId) { RValN=ValN-1; }
830 else { LValN=ValN+1; }
835 template <
class TNodeData,
class TEdgeData>
838 NId = MxNId; MxNId++;
843 NodeH.AddDat(NId,
TNode(NId));
847 template <
class TNodeData,
class TEdgeData>
850 NId = MxNId; MxNId++;
852 if (IsNode(NId)) {
return -1;}
855 NodeH.AddDat(NId,
TNode(NId));
859 template <
class TNodeData,
class TEdgeData>
862 NId = MxNId; MxNId++;
867 NodeH.AddDat(NId,
TNode(NId, NodeDat));
871 template <
class TNodeData,
class TEdgeData>
874 NodeH.GetDat(NId).NodeDat = NodeDat;
877 template <
class TNodeData,
class TEdgeData>
879 const TNode& Node = GetNode(NId);
880 for (
int out = 0; out < Node.
GetOutDeg(); out++) {
882 if (nbr == NId) {
continue; }
883 TIntV& NIdV = GetNode(nbr).InNIdV;
885 if (pos != -1) { NIdV.
Del(pos); }
887 for (
int in = 0; in < Node.
GetInDeg(); in++) {
889 if (nbr == NId) {
continue; }
891 const int pos = GetNIdPos(NIdDatV, NId);
892 if (pos != -1) { NIdDatV.
Del(pos); }
897 template <
class TNodeData,
class TEdgeData>
900 for (
int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
901 edges+=NodeH[N].GetOutDeg(); }
905 template <
class TNodeData,
class TEdgeData>
907 return AddEdge(SrcNId, DstNId, TEdgeData());
910 template <
class TNodeData,
class TEdgeData>
912 IAssertR(IsNode(SrcNId) && IsNode(DstNId),
TStr::Fmt(
"%d or %d not a node.", SrcNId, DstNId).CStr());
914 if (IsEdge(SrcNId, DstNId)) {
915 GetEDat(SrcNId, DstNId) = EdgeDat;
919 GetNode(DstNId).InNIdV.AddSorted(SrcNId);
923 template <
class TNodeData,
class TEdgeData>
925 IAssertR(IsNode(SrcNId) && IsNode(DstNId),
TStr::Fmt(
"%d or %d not a node.", SrcNId, DstNId).CStr());
926 int pos = GetNIdPos(GetNode(SrcNId).OutNIdV, DstNId);
927 if (pos != -1) { GetNode(SrcNId).OutNIdV.Del(pos); }
928 pos = GetNode(DstNId).InNIdV.SearchBin(SrcNId);
929 if (pos != -1) { GetNode(DstNId).InNIdV.Del(pos); }
931 pos = GetNIdPos(GetNode(DstNId).OutNIdV, SrcNId);
932 if (pos != -1) { GetNode(DstNId).OutNIdV.Del(pos); }
933 pos = GetNode(SrcNId).InNIdV.SearchBin(DstNId);
934 if (pos != -1) { GetNode(SrcNId).InNIdV.Del(pos); }
938 template <
class TNodeData,
class TEdgeData>
940 if (! IsNode(SrcNId) || ! IsNode(DstNId)) {
return false; }
941 if (IsDir) {
return GetNode(SrcNId).IsOutNId(DstNId); }
942 else {
return GetNode(SrcNId).IsOutNId(DstNId) || GetNode(DstNId).IsOutNId(SrcNId); }
945 template <
class TNodeData,
class TEdgeData>
947 IAssertR(IsNode(SrcNId) && IsNode(DstNId),
TStr::Fmt(
"%d or %d not a node.", SrcNId, DstNId).CStr());
948 IAssertR(IsEdge(SrcNId, DstNId),
TStr::Fmt(
"Edge between %d and %d does not exist.", SrcNId, DstNId).CStr());
949 GetEDat(SrcNId, DstNId) = EdgeDat;
952 template <
class TNodeData,
class TEdgeData>
954 if (! IsEdge(SrcNId, DstNId)) {
return false; }
955 const TNode& N = GetNode(SrcNId);
960 template <
class TNodeData,
class TEdgeData>
962 Assert(IsEdge(SrcNId, DstNId));
963 TNode& N = GetNode(SrcNId);
967 template <
class TNodeData,
class TEdgeData>
969 Assert(IsEdge(SrcNId, DstNId));
970 const TNode& N = GetNode(SrcNId);
974 template <
class TNodeData,
class TEdgeData>
976 for (
TEdgeI EI = BegEI(); EI < EndEI(); EI++) {
981 template <
class TNodeData,
class TEdgeData>
983 const TNodeI SrcNI = GetNI(SrcNId);
987 int LValN=0, RValN=NIdDatV.
Len()-1;
988 while (RValN>=LValN){
989 int ValN=(LValN+RValN)/2;
990 if (DstNId==NIdDatV[ValN].Val1){ NodeN=ValN;
break; }
991 if (DstNId<NIdDatV[ValN].Val1){RValN=ValN-1;}
else {LValN=ValN+1;}
993 if (NodeN == -1) {
return EndEI(); }
994 else {
return TEdgeI(SrcNI, EndNI(), NodeN); }
997 template <
class TNodeData,
class TEdgeData>
1000 for (
int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
1001 NIdV.
Add(NodeH.GetKey(N)); }
1004 template <
class TNodeData,
class TEdgeData>
1006 for (
int n = NodeH.FFirstKeyId(); NodeH.FNextKeyId(n);) {
1007 TNode& Node = NodeH[n];
1010 if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) {
1015 template <
class TNodeData,
class TEdgeData>
1018 for (
int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
1019 const TNode& Node = NodeH[N];
1021 const TStr Msg =
TStr::Fmt(
"Out-neighbor list of node %d is not sorted.", Node.
GetId());
1025 const TStr Msg =
TStr::Fmt(
"In-neighbor list of node %d is not sorted.", Node.
GetId());
1030 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
1032 const TStr Msg =
TStr::Fmt(
"Out-edge %d --> %d: node %d does not exist.",
1036 if (e > 0 && prevNId == Node.
GetOutNId(e)) {
1037 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate out-edge %d --> %d.",
1045 for (
int e = 0; e < Node.
GetInDeg(); e++) {
1047 const TStr Msg =
TStr::Fmt(
"In-edge %d <-- %d: node %d does not exist.",
1051 if (e > 0 && prevNId == Node.
GetInNId(e)) {
1052 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate in-edge %d <-- %d.",
1073 template <
class TNodeData,
class TEdgeData>
1087 TNode() : Id(-1), InEIdV(), OutEIdV(), NodeDat() { }
1088 TNode(
const int& NId) : Id(NId), InEIdV(), OutEIdV(), NodeDat() { }
1089 TNode(
const int& NId,
const TNodeData& NodeData) : Id(NId), InEIdV(), OutEIdV(), NodeDat(NodeData) { }
1090 TNode(
const TNode& Node) : Id(Node.Id), InEIdV(Node.InEIdV), OutEIdV(Node.OutEIdV), NodeDat(Node.NodeDat) { }
1091 TNode(
TSIn& SIn) : Id(SIn), InEIdV(SIn), OutEIdV(SIn), NodeDat(SIn) { }
1100 int GetInEId(
const int& NodeN)
const {
return InEIdV[NodeN]; }
1101 int GetOutEId(
const int& NodeN)
const {
return OutEIdV[NodeN]; }
1110 NodeDat = TNodeData(MStream);
1120 TEdge() : Id(-1), SrcNId(-1), DstNId(-1), EdgeDat() { }
1121 TEdge(
const int& EId,
const int& SourceNId,
const int& DestNId) : Id(EId), SrcNId(SourceNId), DstNId(DestNId), EdgeDat() { }
1122 TEdge(
const int& EId,
const int& SourceNId,
const int& DestNId,
const TEdgeData& EdgeData) : Id(EId), SrcNId(SourceNId), DstNId(DestNId), EdgeDat(EdgeData) { }
1123 TEdge(
const TEdge& Edge) : Id(Edge.Id), SrcNId(Edge.SrcNId), DstNId(Edge.DstNId), EdgeDat(Edge.EdgeDat) { }
1124 TEdge(
TSIn& SIn) : Id(SIn), SrcNId(SIn), DstNId(SIn), EdgeDat(SIn) { }
1131 Id =
TInt(InStream);
1132 SrcNId =
TInt(InStream);
1133 DstNId =
TInt(InStream);
1134 EdgeDat = TEdgeData(InStream);
1158 int GetId()
const {
return NodeHI.GetDat().GetId(); }
1160 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
1162 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
1164 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
1168 int GetInNId(
const int& EdgeN)
const {
return Net->
GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
1172 int GetOutNId(
const int& EdgeN)
const {
return Net->
GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
1179 bool IsInNId(
const int& NId)
const;
1181 bool IsOutNId(
const int& NId)
const;
1185 const TNodeData&
operator () ()
const {
return NodeHI.GetDat().GetDat(); }
1187 const TNodeData&
GetDat()
const {
return NodeHI.GetDat().GetDat(); }
1188 TNodeData&
GetDat() {
return NodeHI.GetDat().GetDat(); }
1197 int GetInEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetInEId(EdgeN); }
1199 int GetOutEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetOutEId(EdgeN); }
1201 int GetNbrEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetNbrEId(EdgeN); }
1203 bool IsInEId(
const int& EId)
const {
return NodeHI.GetDat().IsInEId(EId); }
1205 bool IsOutEId(
const int& EId)
const {
return NodeHI.GetDat().IsOutEId(EId); }
1207 bool IsNbrEId(
const int& EId)
const {
return NodeHI.GetDat().IsNbrEId(EId); }
1233 int GetId()
const {
return EdgeHI.GetDat().GetId(); }
1235 int GetSrcNId()
const {
return EdgeHI.GetDat().GetSrcNId(); }
1237 int GetDstNId()
const {
return EdgeHI.GetDat().GetDstNId(); }
1238 const TEdgeData&
operator () ()
const {
return EdgeHI.GetDat().GetDat(); }
1240 const TEdgeData&
GetDat()
const {
return EdgeHI.GetDat().GetDat(); }
1241 TEdgeData&
GetDat() {
return EdgeHI.GetDat().GetDat(); }
1269 MxNId =
TInt(ShMIn);
1270 MxEId =
TInt(ShMIn);
1271 LoadTNodeFunctor fn;
1278 explicit TNodeEdgeNet(
const int& Nodes,
const int& Edges) : CRef(), MxNId(0), MxEId(0) {
Reserve(Nodes, Edges); }
1297 TNet* Network =
new TNet();
1299 return PNet(Network);
1304 if (
this!=&Net) { NodeH=Net.
NodeH; EdgeH=Net.
EdgeH; MxNId=Net.
MxNId; MxEId=Net.
MxEId; }
return *
this; }
1325 int AddNode(
int NId,
const TNodeData& NodeDat);
1342 TNodeI
GetNI(
const int& NId)
const {
return TNodeI(NodeH.
GetI(NId),
this); }
1344 void SetNDat(
const int& NId,
const TNodeData& NodeDat);
1363 int AddEdge(
const int& SrcNId,
const int& DstNId,
int EId = -1);
1370 int AddEdge(
const int& SrcNId,
const int& DstNId,
int EId,
const TEdgeData& EdgeDat);
1372 int AddEdge(
const TEdgeI& EdgeI) {
return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), EdgeI.GetId(), EdgeI.GetDat()); }
1380 void DelEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true);
1384 bool IsEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true)
const {
int EId;
return IsEdge(SrcNId, DstNId, EId, IsDir); }
1386 bool IsEdge(
const int& SrcNId,
const int& DstNId,
int& EId,
const bool& IsDir =
true)
const;
1387 int GetEId(
const int& SrcNId,
const int& DstNId)
const {
int EId;
return IsEdge(SrcNId, DstNId, EId)?EId:-1; }
1393 TEdgeI
GetEI(
const int& EId)
const {
return TEdgeI(EdgeH.
GetI(EId),
this); }
1395 TEdgeI
GetEI(
const int& SrcNId,
const int& DstNId)
const {
return GetEI(
GetEId(SrcNId, DstNId)); }
1397 void SetEDat(
const int& EId,
const TEdgeData& EdgeDat);
1423 void Reserve(
const int& Nodes,
const int& Edges) {
1424 if (Nodes>0) { NodeH.
Gen(Nodes/2); }
if (Edges>0) { EdgeH.
Gen(Edges/2); } }
1439 void Defrag(
const bool& OnlyNodeLinks=
false);
1444 bool IsOk(
const bool& ThrowExcept=
true)
const;
1457 template <
class TNodeData,
class TEdgeData>
1462 template <
class TNodeData,
class TEdgeData>
1472 template <
class TNodeData,
class TEdgeData>
1482 template <
class TNodeData,
class TEdgeData>
1494 template <
class TNodeData,
class TEdgeData>
1499 if (
IsNode(NId)) {
return -1;}
1506 template <
class TNodeData,
class TEdgeData>
1518 template <
class TNodeData,
class TEdgeData>
1521 for (
int out = 0; out < Node.
GetOutDeg(); out++) {
1528 for (
int in = 0; in < Node.
GetInDeg(); in++) {
1538 template <
class TNodeData,
class TEdgeData>
1544 template <
class TNodeData,
class TEdgeData>
1548 const int Src = EI.GetSrcNId();
1549 const int Dst = EI.GetDstNId();
1553 return UniqESet.
Len();
1556 template <
class TNodeData,
class TEdgeData>
1568 template <
class TNodeData,
class TEdgeData>
1580 template <
class TNodeData,
class TEdgeData>
1590 template <
class TNodeData,
class TEdgeData>
1599 template <
class TNodeData,
class TEdgeData>
1601 if (!
IsNode(SrcNId)) {
return false; }
1602 if (!
IsNode(DstNId)) {
return false; }
1607 EId = Edge.
GetId();
return true; }
1613 EId = Edge.
GetId();
return true; }
1619 template <
class TNodeData,
class TEdgeData>
1625 template <
class TNodeData,
class TEdgeData>
1633 template <
class TNodeData,
class TEdgeData>
1641 template <
class TNodeData,
class TEdgeData>
1649 template <
class TNodeData,
class TEdgeData>
1659 template <
class TNodeData,
class TEdgeData>
1674 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
1679 if (e > 0 && prevEId == Node.
GetOutEId(e)) {
1687 for (
int e = 0; e < Node.
GetInDeg(); e++) {
1692 if (e > 0 && prevEId == Node.
GetInEId(e)) {
1751 TNode() : Id(-1), InEIdV(), OutEIdV() { }
1752 TNode(
const int& NId) : Id(NId), InEIdV(), OutEIdV() { }
1753 TNode(
const TNode& Node) : Id(Node.Id), InEIdV(Node.InEIdV), OutEIdV(Node.OutEIdV) { }
1757 int GetDeg()
const {
return GetInDeg() + GetOutDeg(); }
1760 int GetInEId(
const int& EdgeN)
const {
return InEIdV[EdgeN]; }
1761 int GetOutEId(
const int& EdgeN)
const {
return OutEIdV[EdgeN]; }
1762 int GetNbrEId(
const int& EdgeN)
const {
return EdgeN<GetOutDeg()?GetOutEId(EdgeN):GetInEId(EdgeN-GetOutDeg()); }
1776 TEdge() : Id(-1), SrcNId(-1), DstNId(-1) { }
1777 TEdge(
const int& EId,
const int& SourceNId,
const int& DestNId) : Id(EId), SrcNId(SourceNId), DstNId(DestNId) { }
1778 TEdge(
const TEdge& Edge) : Id(Edge.Id), SrcNId(Edge.SrcNId), DstNId(Edge.DstNId) { }
1785 Id =
TInt(InStream);
1786 SrcNId =
TInt(InStream);
1787 DstNId =
TInt(InStream);
1799 TNodeI(
const THashIter& NodeHIter,
const TNEANet* GraphPt) : NodeHI(NodeHIter), Graph(GraphPt) { }
1803 TNodeI& operator++ (
int) { NodeHI++;
return *
this; }
1804 bool operator < (
const TNodeI& NodeI)
const {
return NodeHI < NodeI.
NodeHI; }
1805 bool operator == (
const TNodeI& NodeI)
const {
return NodeHI == NodeI.
NodeHI; }
1807 int GetId()
const {
return NodeHI.GetDat().GetId(); }
1809 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
1811 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
1813 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
1817 int GetInNId(
const int& EdgeN)
const {
return Graph->
GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
1821 int GetOutNId(
const int& EdgeN)
const {
return Graph->
GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
1827 bool IsInNId(
const int& NId)
const;
1829 bool IsOutNId(
const int& NId)
const;
1831 bool IsNbrNId(
const int& NId)
const {
return IsOutNId(NId) || IsInNId(NId); }
1833 int GetInEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetInEId(EdgeN); }
1835 int GetOutEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetOutEId(EdgeN); }
1837 int GetNbrEId(
const int& EdgeN)
const {
return NodeHI.GetDat().GetNbrEId(EdgeN); }
1839 bool IsInEId(
const int& EId)
const {
return NodeHI.GetDat().IsInEId(EId); }
1841 bool IsOutEId(
const int& EId)
const {
return NodeHI.GetDat().IsOutEId(EId); }
1843 bool IsNbrEId(
const int& EId)
const {
return IsInEId(EId) || IsOutEId(EId); }
1874 TEdgeI(
const THashIter& EdgeHIter,
const TNEANet *GraphPt) : EdgeHI(EdgeHIter), Graph(GraphPt) { }
1878 TEdgeI& operator++ (
int) { EdgeHI++;
return *
this; }
1879 bool operator < (
const TEdgeI& EdgeI)
const {
return EdgeHI < EdgeI.
EdgeHI; }
1880 bool operator == (
const TEdgeI& EdgeI)
const {
return EdgeHI == EdgeI.
EdgeHI; }
1882 int GetId()
const {
return EdgeHI.GetDat().GetId(); }
1884 int GetSrcNId()
const {
return EdgeHI.GetDat().GetSrcNId(); }
1886 int GetDstNId()
const {
return EdgeHI.GetDat().GetDstNId(); }
1920 TAIntI(
const TIntVecIter& HIter,
TStr attribute,
bool isEdgeIter,
const TNEANet* GraphPt) : HI(HIter), attr(), Graph(GraphPt) { isNode = !isEdgeIter; attr = attribute; }
1923 bool operator < (
const TAIntI& I)
const {
return HI < I.
HI; }
1924 bool operator == (
const TAIntI& I)
const {
return HI == I.
HI; }
1944 TAIntVI() : HI(), IsDense(), HHI(), attr(), Graph(NULL) { }
1945 TAIntVI(
const TIntVVecIter& HIter,
const TIntHVecIter& HHIter,
TStr attribute,
bool isEdgeIter,
const TNEANet* GraphPt,
bool is_dense) : HI(HIter), IsDense(is_dense), HHI(HHIter), attr(), Graph(GraphPt) {
1946 isNode = !isEdgeIter; attr = attribute;
1948 TAIntVI(
const TAIntVI& I) : HI(I.HI), IsDense(I.IsDense), HHI(I.HHI), attr(I.attr), Graph(I.Graph) { isNode = I.
isNode; }
1950 bool operator < (
const TAIntVI& I)
const {
return HI == I.
HI ? HHI < I.
HHI : HI < I.
HI; }
1951 bool operator == (
const TAIntVI& I)
const {
return HI == I.
HI && HHI == I.
HHI; }
1969 TAFltVI() : HI(), IsDense(), HHI(), attr(), Graph(NULL) { }
1970 TAFltVI(
const TFltVVecIter& HIter,
const TFltHVecIter& HHIter,
TStr attribute,
bool isEdgeIter,
const TNEANet* GraphPt,
bool is_dense) : HI(HIter), IsDense(is_dense), HHI(HHIter), attr(), Graph(GraphPt) {
1971 isNode = !isEdgeIter; attr = attribute;
1973 TAFltVI(
const TAFltVI& I) : HI(I.HI), IsDense(I.IsDense), HHI(I.HHI), attr(I.attr), Graph(I.Graph) { isNode = I.
isNode; }
1975 bool operator < (
const TAFltVI& I)
const {
return HI == I.
HI ? HHI < I.
HHI : HI < I.
HI; }
1976 bool operator == (
const TAFltVI& I)
const {
return HI == I.
HI && HHI == I.
HHI; }
1993 TAStrI(
const TStrVecIter& HIter,
TStr attribute,
bool isEdgeIter,
const TNEANet* GraphPt) : HI(HIter), attr(), Graph(GraphPt) { isNode = !isEdgeIter; attr = attribute; }
1996 bool operator < (
const TAStrI& I)
const {
return HI < I.
HI; }
1997 bool operator == (
const TAStrI& I)
const {
return HI == I.
HI; }
2016 TAFltI(
const TFltVecIter& HIter,
TStr attribute,
bool isEdgeIter,
const TNEANet* GraphPt) : HI(HIter), attr(), Graph(GraphPt) { isNode = !isEdgeIter; attr = attribute; }
2019 bool operator < (
const TAFltI& I)
const {
return HI < I.
HI; }
2020 bool operator == (
const TAFltI& I)
const {
return HI == I.
HI; }
2083 template<
typename TElem>
2091 template<
typename TElem>
2094 n->LoadShM(ShMIn, f);
2101 template<
typename TElem>
2104 n->LoadShM(ShMIn, f);
2111 if (!KeyToDenseN.
IsKey(attr))
return -1;
2112 if (KeyToDenseN.
GetDat(attr))
return 1;
2117 if (!KeyToDenseE.
IsKey(attr))
return -1;
2118 if (KeyToDenseE.
GetDat(attr))
return 1;
2124 TNEANet() : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
2125 KeyToIndexTypeN(), KeyToIndexTypeE(), KeyToDenseN(), KeyToDenseE(), IntDefaultsN(), IntDefaultsE(),
2126 StrDefaultsN(), StrDefaultsE(), FltDefaultsN(), FltDefaultsE(),
2127 VecOfIntVecsN(), VecOfIntVecsE(), VecOfStrVecsN(), VecOfStrVecsE(),
2128 VecOfFltVecsN(), VecOfFltVecsE(), VecOfIntVecVecsN(), VecOfIntVecVecsE(),
2129 VecOfFltVecVecsN(), VecOfFltVecVecsE(),
2130 VecOfIntHashVecsN(), VecOfIntHashVecsE(),
2131 VecOfFltHashVecsN(), VecOfFltHashVecsE(),
2132 SAttrN(), SAttrE(){ }
2134 explicit TNEANet(
const int& Nodes,
const int& Edges) : CRef(),
2135 MxNId(0), MxEId(0), NodeH(), EdgeH(), KeyToIndexTypeN(), KeyToIndexTypeE(), KeyToDenseN(), KeyToDenseE(),
2136 IntDefaultsN(), IntDefaultsE(), StrDefaultsN(), StrDefaultsE(),
2137 FltDefaultsN(), FltDefaultsE(), VecOfIntVecsN(), VecOfIntVecsE(),
2138 VecOfStrVecsN(), VecOfStrVecsE(), VecOfFltVecsN(), VecOfFltVecsE(), VecOfIntVecVecsN(), VecOfIntVecVecsE(),
2139 VecOfFltVecVecsN(), VecOfFltVecVecsE(),
2140 VecOfIntHashVecsN(), VecOfIntHashVecsE(),
2141 VecOfFltHashVecsN(), VecOfFltHashVecsE(),
2145 NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(), KeyToIndexTypeE(), KeyToDenseN(), KeyToDenseE(),
2146 IntDefaultsN(), IntDefaultsE(), StrDefaultsN(), StrDefaultsE(),
2147 FltDefaultsN(), FltDefaultsE(), VecOfIntVecsN(), VecOfIntVecsE(),
2148 VecOfStrVecsN(), VecOfStrVecsE(), VecOfFltVecsN(), VecOfFltVecsE(), VecOfIntVecVecsN(), VecOfIntVecVecsE(),
2149 VecOfFltVecVecsN(), VecOfFltVecVecsE(),
2150 VecOfIntHashVecsN(), VecOfIntHashVecsE(),
2151 VecOfFltHashVecsN(), VecOfFltHashVecsE(),
2152 SAttrN(), SAttrE() { }
2155 KeyToIndexTypeN(SIn), KeyToIndexTypeE(SIn), KeyToDenseN(SIn), KeyToDenseE(SIn), IntDefaultsN(SIn), IntDefaultsE(SIn),
2156 StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
2157 VecOfIntVecsN(SIn), VecOfIntVecsE(SIn), VecOfStrVecsN(SIn),VecOfStrVecsE(SIn),
2158 VecOfFltVecsN(SIn), VecOfFltVecsE(SIn), VecOfIntVecVecsN(SIn), VecOfIntVecVecsE(SIn),
2159 VecOfFltVecVecsN(SIn), VecOfFltVecVecsE(SIn),
2160 VecOfIntHashVecsN(SIn), VecOfIntHashVecsE(SIn),
2161 VecOfFltHashVecsN(SIn), VecOfFltHashVecsE(SIn),
2162 SAttrN(SIn), SAttrE(SIn) { }
2164 TNEANet(
const TNEANet& Graph,
bool modeSubGraph) : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
2165 NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(), KeyToIndexTypeE(Graph.KeyToIndexTypeE), KeyToDenseN(), KeyToDenseE(Graph.KeyToDenseE),
2166 IntDefaultsN(Graph.IntDefaultsN), IntDefaultsE(Graph.IntDefaultsE), StrDefaultsN(Graph.StrDefaultsN), StrDefaultsE(Graph.StrDefaultsE),
2167 FltDefaultsN(Graph.FltDefaultsN), FltDefaultsE(Graph.FltDefaultsE), VecOfIntVecsN(Graph.VecOfIntVecsN), VecOfIntVecsE(Graph.VecOfIntVecsE),
2168 VecOfStrVecsN(Graph.VecOfStrVecsN), VecOfStrVecsE(Graph.VecOfStrVecsE), VecOfFltVecsN(Graph.VecOfFltVecsN), VecOfFltVecsE(Graph.VecOfFltVecsE),
2169 VecOfIntVecVecsN(), VecOfIntVecVecsE(Graph.VecOfIntVecVecsE),
2170 VecOfFltVecVecsN(), VecOfFltVecVecsE(Graph.VecOfFltVecVecsE),
2171 VecOfIntHashVecsN(), VecOfIntHashVecsE(Graph.VecOfIntHashVecsE),
2172 VecOfFltHashVecsN(), VecOfFltHashVecsE(Graph.VecOfFltHashVecsE)
2174 TNEANet(
bool copyAll,
const TNEANet& Graph) : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
2175 NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(Graph.KeyToIndexTypeN), KeyToIndexTypeE(Graph.KeyToIndexTypeE), KeyToDenseN(Graph.KeyToDenseN), KeyToDenseE(Graph.KeyToDenseE),
2176 IntDefaultsN(Graph.IntDefaultsN), IntDefaultsE(Graph.IntDefaultsE), StrDefaultsN(Graph.StrDefaultsN), StrDefaultsE(Graph.StrDefaultsE),
2177 FltDefaultsN(Graph.FltDefaultsN), FltDefaultsE(Graph.FltDefaultsE), VecOfIntVecsN(Graph.VecOfIntVecsN), VecOfIntVecsE(Graph.VecOfIntVecsE),
2178 VecOfStrVecsN(Graph.VecOfStrVecsN), VecOfStrVecsE(Graph.VecOfStrVecsE), VecOfFltVecsN(Graph.VecOfFltVecsN), VecOfFltVecsE(Graph.VecOfFltVecsE),
2179 VecOfIntVecVecsN(Graph.VecOfIntVecVecsN), VecOfIntVecVecsE(Graph.VecOfIntVecVecsE),
2180 VecOfFltVecVecsN(Graph.VecOfFltVecVecsN), VecOfFltVecVecsE(Graph.VecOfFltVecVecsE),
2181 VecOfIntHashVecsN(Graph.VecOfIntHashVecsN), VecOfIntHashVecsE(Graph.VecOfIntHashVecsE),
2182 VecOfFltHashVecsN(Graph.VecOfFltHashVecsN), VecOfFltHashVecsE(Graph.VecOfFltHashVecsE),
2183 SAttrN(Graph.SAttrN), SAttrE(Graph.SAttrE) { }
2189 KeyToIndexTypeN.
Save(SOut); KeyToIndexTypeE.
Save(SOut);
2190 KeyToDenseN.
Save(SOut); KeyToDenseE.
Save(SOut);
2191 IntDefaultsN.
Save(SOut); IntDefaultsE.
Save(SOut);
2192 StrDefaultsN.
Save(SOut); StrDefaultsE.
Save(SOut);
2193 FltDefaultsN.
Save(SOut); FltDefaultsE.
Save(SOut);
2194 VecOfIntVecsN.
Save(SOut); VecOfIntVecsE.
Save(SOut);
2195 VecOfStrVecsN.
Save(SOut); VecOfStrVecsE.
Save(SOut);
2196 VecOfFltVecsN.
Save(SOut); VecOfFltVecsE.
Save(SOut);
2197 VecOfIntVecVecsN.
Save(SOut); VecOfIntVecVecsE.
Save(SOut);
2198 VecOfFltVecVecsN.
Save(SOut); VecOfFltVecVecsE.
Save(SOut);
2199 VecOfIntHashVecsN.
Save(SOut); VecOfIntHashVecsE.
Save(SOut);
2200 VecOfFltHashVecsN.
Save(SOut); VecOfFltHashVecsE.
Save(SOut);
2201 SAttrN.
Save(SOut); SAttrE.
Save(SOut); }
2205 KeyToIndexTypeN.
Save(SOut); KeyToIndexTypeE.
Save(SOut);
2206 IntDefaultsN.
Save(SOut); IntDefaultsE.
Save(SOut);
2207 StrDefaultsN.
Save(SOut); StrDefaultsE.
Save(SOut);
2208 FltDefaultsN.
Save(SOut); FltDefaultsE.
Save(SOut);
2209 VecOfIntVecsN.
Save(SOut); VecOfIntVecsE.
Save(SOut);
2210 VecOfStrVecsN.
Save(SOut); VecOfStrVecsE.
Save(SOut);
2211 VecOfFltVecsN.
Save(SOut); VecOfFltVecsE.
Save(SOut); }
2215 KeyToIndexTypeN.
Save(SOut); KeyToIndexTypeE.
Save(SOut);
2216 IntDefaultsN.
Save(SOut); IntDefaultsE.
Save(SOut);
2217 StrDefaultsN.
Save(SOut); StrDefaultsE.
Save(SOut);
2218 FltDefaultsN.
Save(SOut); FltDefaultsE.
Save(SOut);
2219 VecOfIntVecsN.
Save(SOut); VecOfIntVecsE.
Save(SOut);
2220 VecOfStrVecsN.
Save(SOut); VecOfStrVecsE.
Save(SOut);
2221 VecOfFltVecsN.
Save(SOut); VecOfFltVecsE.
Save(SOut);
2222 VecOfIntVecVecsN.
Save(SOut); VecOfIntVecVecsE.
Save(SOut);
2223 VecOfFltVecVecsN.
Save(SOut); VecOfFltVecVecsE.
Save(SOut);
2224 SAttrN.
Save(SOut); SAttrE.
Save(SOut); }
2236 Graph->MxNId.Load(SIn); Graph->MxEId.Load(SIn);
2237 Graph->NodeH.Load(SIn); Graph->EdgeH.Load(SIn);
2238 Graph->KeyToIndexTypeN.Load(SIn); Graph->KeyToIndexTypeE.Load(SIn);
2239 Graph->IntDefaultsN.Load(SIn); Graph->IntDefaultsE.Load(SIn);
2240 Graph->StrDefaultsN.Load(SIn); Graph->StrDefaultsE.Load(SIn);
2241 Graph->FltDefaultsN.Load(SIn); Graph->FltDefaultsE.Load(SIn);
2242 Graph->VecOfIntVecsN.Load(SIn); Graph->VecOfIntVecsE.Load(SIn);
2243 Graph->VecOfStrVecsN.Load(SIn); Graph->VecOfStrVecsE.Load(SIn);
2244 Graph->VecOfFltVecsN.Load(SIn); Graph->VecOfFltVecsE.Load(SIn);
2251 Graph->MxNId.Load(SIn); Graph->MxEId.Load(SIn);
2252 Graph->NodeH.Load(SIn); Graph->EdgeH.Load(SIn);
2253 Graph->KeyToIndexTypeN.Load(SIn); Graph->KeyToIndexTypeE.Load(SIn);
2254 Graph->IntDefaultsN.Load(SIn); Graph->IntDefaultsE.Load(SIn);
2255 Graph->StrDefaultsN.Load(SIn); Graph->StrDefaultsE.Load(SIn);
2256 Graph->FltDefaultsN.Load(SIn); Graph->FltDefaultsE.Load(SIn);
2257 Graph->VecOfIntVecsN.Load(SIn); Graph->VecOfIntVecsE.Load(SIn);
2258 Graph->VecOfStrVecsN.Load(SIn); Graph->VecOfStrVecsE.Load(SIn);
2259 Graph->VecOfFltVecsN.Load(SIn); Graph->VecOfFltVecsE.Load(SIn);
2260 Graph->VecOfIntVecVecsN.Load(SIn); Graph->VecOfIntVecVecsE.Load(SIn);
2261 Graph->VecOfFltVecVecsN.Load(SIn); Graph->VecOfFltVecVecsE.Load(SIn);
2262 Graph->SAttrN.Load(SIn); Graph->SAttrE.Load(SIn);
2280 TInt VecLength = VecOfIntVecVecsN.
Len();
2282 if (VecLength != 0) {
2284 for (iter = KeyToIndexTypeN.
BegI(); !iter.IsEnd(); iter=iter.Next()) {
2288 for (
int i=0; i<VecOfIntVecVecsN[index].
Len(); i++) {
2289 if(VecOfIntVecVecsN[index][i].Len() > 0) {
2290 VecOfIntHashVecsN[index].AddDat(
TInt(i), VecOfIntVecVecsN[index][i]);
2297 VecOfIntVecVecsN.
Clr();
2299 VecLength = VecOfIntVecVecsE.
Len();
2300 if (VecLength != 0) {
2302 for (iter = KeyToIndexTypeE.
BegI(); !iter.IsEnd(); iter=iter.Next()) {
2306 for (
int i=0; i<VecOfIntVecVecsE[index].
Len(); i++) {
2307 if(VecOfIntVecVecsE[index][i].Len() > 0) {
2308 VecOfIntHashVecsE[index].AddDat(
TInt(i), VecOfIntVecVecsE[index][i]);
2315 VecOfIntVecVecsE.
Clr();
2317 VecLength = VecOfFltVecVecsN.
Len();
2318 if (VecLength != 0) {
2320 for (iter = KeyToIndexTypeN.
BegI(); !iter.IsEnd(); iter=iter.Next()) {
2324 for (
int i=0; i<VecOfFltVecVecsN[index].
Len(); i++) {
2325 if(VecOfFltVecVecsN[index][i].Len() > 0) {
2326 VecOfFltHashVecsN[index].AddDat(
TInt(i), VecOfFltVecVecsN[index][i]);
2333 VecOfFltVecVecsN.
Clr();
2335 VecLength = VecOfFltVecVecsE.
Len();
2336 if (VecLength != 0) {
2338 for (iter = KeyToIndexTypeE.
BegI(); !iter.IsEnd(); iter=iter.Next()) {
2342 for (
int i=0; i<VecOfFltVecVecsE[index].
Len(); i++) {
2343 if(VecOfFltVecVecsE[index][i].Len() > 0) {
2344 VecOfFltHashVecsE[index].AddDat(
TInt(i), VecOfFltVecVecsE[index][i]);
2351 VecOfFltVecVecsE.
Clr();
2381 virtual void DelNode(
const int& NId);
2406 TInt location = CheckDenseOrSparseN(attr);
2407 TBool IsDense =
true;
2408 if (location != -1) {
2410 if (location == 1) {
2411 HI = VecOfIntVecVecsN[index].
BegI();
2414 HHI = VecOfIntHashVecsN[index].
BegI();
2417 return TAIntVI(HI, HHI, attr,
false,
this, IsDense);
2423 TInt location = CheckDenseOrSparseN(attr);
2424 TBool IsDense =
true;
2425 if (location != -1) {
2427 if (location == 1) {
2428 HI = VecOfIntVecVecsN[index].
EndI();
2431 HHI = VecOfIntHashVecsN[index].
EndI();
2434 return TAIntVI(HI, HHI, attr,
false,
this, IsDense);
2442 TInt location = CheckDenseOrSparseN(attr);
2443 TBool IsDense =
true;
2444 if (location != -1) {
2446 if (location == 1) {
2447 HI = VecOfIntVecVecsN[index].
GetI(NodeH.
GetKeyId(NId));
2450 HHI = VecOfIntHashVecsN[index].
GetI(NodeH.
GetKeyId(NId));
2453 return TAIntVI(HI, HHI, attr,
false,
this, IsDense);
2460 TInt location = CheckDenseOrSparseN(attr);
2461 TBool IsDense =
true;
2462 if (location != -1) {
2464 if (location == 1) {
2465 HI = VecOfFltVecVecsN[index].
BegI();
2468 HHI = VecOfFltHashVecsN[index].
BegI();
2471 return TAFltVI(HI, HHI, attr,
false,
this, IsDense);
2477 TInt location = CheckDenseOrSparseN(attr);
2478 TBool IsDense =
true;
2479 if (location != -1) {
2481 if (location == 1) {
2482 HI = VecOfFltVecVecsN[index].
EndI();
2485 HHI = VecOfFltHashVecsN[index].
EndI();
2488 return TAFltVI(HI, HHI, attr,
false,
this, IsDense);
2496 TInt location = CheckDenseOrSparseN(attr);
2497 TBool IsDense =
true;
2498 if (location != -1) {
2500 if (location == 1) {
2501 HI = VecOfFltVecVecsN[index].
GetI(NodeH.
GetKeyId(NId));
2504 HHI = VecOfFltHashVecsN[index].
GetI(NodeH.
GetKeyId(NId));
2507 return TAFltVI(HI, HHI, attr,
false,
this, IsDense);
2532 AttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2536 AttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2541 IntAttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2545 IntAttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2551 IntVAttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2555 IntVAttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2560 FltVAttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2564 FltVAttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2570 StrAttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2574 StrAttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2578 FltAttrNameNI(NId, KeyToIndexTypeN.
BegI(), Names);}
2582 FltAttrValueNI(NId, KeyToIndexTypeN.
BegI(), Values);}
2587 AttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2591 AttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2595 IntAttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2599 IntAttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2605 IntVAttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2609 IntVAttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2614 FltVAttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2618 FltVAttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2624 StrAttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2628 StrAttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2632 FltAttrNameEI(EId, KeyToIndexTypeE.
BegI(), Names);}
2636 FltAttrValueEI(EId, KeyToIndexTypeE.
BegI(), Values);}
2656 TInt location = CheckDenseOrSparseE(attr);
2657 TBool IsDense =
true;
2658 if (location != -1) {
2660 if (location == 1) {
2661 HI = VecOfIntVecVecsE[index].
BegI();
2664 HHI = VecOfIntHashVecsE[index].
BegI();
2667 return TAIntVI(HI, HHI, attr,
true,
this, IsDense);
2673 TInt location = CheckDenseOrSparseE(attr);
2674 TBool IsDense =
true;
2675 if (location != -1) {
2677 if (location == 1) {
2678 HI = VecOfIntVecVecsE[index].
EndI();
2681 HHI = VecOfIntHashVecsE[index].
EndI();
2684 return TAIntVI(HI, HHI, attr,
true,
this, IsDense);
2690 TInt location = CheckDenseOrSparseE(attr);
2691 TBool IsDense =
true;
2692 if (location != -1) {
2694 if (location == 1) {
2695 HI = VecOfIntVecVecsE[index].
GetI(EdgeH.
GetKeyId(EId));
2698 HHI = VecOfIntHashVecsE[index].
GetI(EdgeH.
GetKeyId(EId));
2701 return TAIntVI(HI, HHI, attr,
true,
this, IsDense);
2708 TInt location = CheckDenseOrSparseE(attr);
2709 TBool IsDense =
true;
2710 if (location != -1) {
2712 if (location == 1) {
2713 HI = VecOfFltVecVecsE[index].
BegI();
2716 HHI = VecOfFltHashVecsE[index].
BegI();
2719 return TAFltVI(HI, HHI, attr,
true,
this, IsDense);
2725 TInt location = CheckDenseOrSparseE(attr);
2726 TBool IsDense =
true;
2727 if (location != -1) {
2729 if (location == 1) {
2730 HI = VecOfFltVecVecsE[index].
EndI();
2733 HHI = VecOfFltHashVecsE[index].
EndI();
2736 return TAFltVI(HI, HHI, attr,
true,
this, IsDense);
2742 TInt location = CheckDenseOrSparseE(attr);
2743 TBool IsDense =
true;
2744 if (location != -1) {
2746 if (location == 1) {
2747 HI = VecOfFltVecVecsE[index].
GetI(EdgeH.
GetKeyId(EId));
2750 HHI = VecOfFltHashVecsE[index].
GetI(EdgeH.
GetKeyId(EId));
2753 return TAFltVI(HI, HHI, attr,
true,
this, IsDense);
2792 int AddEdge(
const int& SrcNId,
const int& DstNId,
int EId = -1);
2802 void DelEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true);
2806 bool IsEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true)
const {
int EId;
return IsEdge(SrcNId, DstNId, EId, IsDir); }
2808 bool IsEdge(
const int& SrcNId,
const int& DstNId,
int& EId,
const bool& IsDir =
true)
const;
2810 int GetEId(
const int& SrcNId,
const int& DstNId)
const {
int EId;
return IsEdge(SrcNId, DstNId, EId)?EId:-1; }
2837 KeyToIndexTypeN.
Clr(); KeyToIndexTypeE.
Clr(); IntDefaultsN.
Clr(); IntDefaultsE.
Clr();
2838 StrDefaultsN.
Clr(); StrDefaultsE.
Clr(); FltDefaultsN.
Clr(); FltDefaultsE.
Clr();
2839 VecOfIntVecsN.
Clr(); VecOfIntVecsE.
Clr(); VecOfStrVecsN.
Clr(); VecOfStrVecsE.
Clr();
2840 VecOfFltVecsN.
Clr(); VecOfFltVecsE.
Clr(); VecOfIntVecVecsN.
Clr(); VecOfIntVecVecsE.
Clr();
2841 VecOfFltVecVecsN.
Clr(); VecOfFltVecVecsE.
Clr();
2842 SAttrN.
Clr(); SAttrE.
Clr();}
2844 void Reserve(
const int& Nodes,
const int& Edges) {
2845 if (Nodes>0) { NodeH.
Gen(Nodes/2); }
if (Edges>0) { EdgeH.
Gen(Edges/2); } }
2852 void Defrag(
const bool& OnlyNodeLinks=
false);
2857 bool IsOk(
const bool& ThrowExcept=
true)
const;
2859 void Dump(FILE *OutF=stdout)
const;
2863 int AddIntAttrDatN(
const int& NId,
const TInt& value,
const TStr& attr);
2866 int AddStrAttrDatN(
const int& NId,
const TStr& value,
const TStr& attr);
2869 int AddFltAttrDatN(
const int& NId,
const TFlt& value,
const TStr& attr);
2872 int AddIntVAttrDatN(
const int& NId,
const TIntV& value,
const TStr& attr,
TBool UseDense=
true);
2875 int AddFltVAttrDatN(
const int& NId,
const TFltV& value,
const TStr& attr,
TBool UseDense=
true);
2881 int AppendIntVAttrDatN(
const int& NId,
const TInt& value,
const TStr& attr,
TBool UseDense=
true);
2884 int DelFromIntVAttrDatN(
const int& NId,
const TInt& value,
const TStr& attr);
2888 int AppendFltVAttrDatN(
const int& NId,
const TFlt& value,
const TStr& attr,
TBool UseDense=
true);
2891 int DelFromFltVAttrDatN(
const int& NId,
const TFlt& value,
const TStr& attr);
2899 int AddIntAttrDatE(
const int& EId,
const TInt& value,
const TStr& attr);
2904 int AddStrAttrDatE(
const int& EId,
const TStr& value,
const TStr& attr);
2909 int AddFltAttrDatE(
const int& EId,
const TFlt& value,
const TStr& attr);
2916 int AddIntVAttrDatE(
const int& EId,
const TIntV& value,
const TStr& attr,
TBool UseDense=
true);
2919 int AppendIntVAttrDatE(
const int& EId,
const TInt& value,
const TStr& attr,
TBool UseDense=
true);
2925 int AddFltVAttrDatE(
const int& EId,
const TFltV& value,
const TStr& attr,
TBool UseDense=
true);
2928 int AppendFltVAttrDatE(
const int& EId,
const TFlt& value,
const TStr& attr,
TBool UseDense=
true);
2932 TInt GetIntAttrDatN(
const int& NId,
const TStr& attr);
2936 TStr GetStrAttrDatN(
const int& NId,
const TStr& attr);
2939 TFlt GetFltAttrDatN(
const int& NId,
const TStr& attr);
2942 TIntV GetIntVAttrDatN(
const int& NId,
const TStr& attr)
const;
2946 TFltV GetFltVAttrDatN(
const int& NId,
const TStr& attr)
const;
2949 int GetIntAttrIndN(
const TStr& attr);
2951 int GetAttrIndN(
const TStr& attr);
2956 TInt GetIntAttrIndDatN(
const int& NId,
const int& index);
2961 TStr GetStrAttrIndDatN(
const int& NId,
const int& index);
2966 TFlt GetFltAttrIndDatN(
const int& NId,
const int& index);
2970 TInt GetIntAttrDatE(
const int& EId,
const TStr& attr);
2973 TStr GetStrAttrDatE(
const int& EId,
const TStr& attr);
2976 TFlt GetFltAttrDatE(
const int& EId,
const TStr& attr);
2979 TIntV GetIntVAttrDatE(
const int& EId,
const TStr& attr);
2983 TFltV GetFltVAttrDatE(
const int& EId,
const TStr& attr);
2986 int GetIntAttrIndE(
const TStr& attr);
2988 int GetAttrIndE(
const TStr& attr);
2993 TInt GetIntAttrIndDatE(
const int& EId,
const int& index);
2998 TFlt GetFltAttrIndDatE(
const int& EId,
const int& index);
3003 TStr GetStrAttrIndDatE(
const int& EId,
const int& index);
3007 int DelAttrDatN(
const int& NId,
const TStr& attr);
3010 int DelAttrDatE(
const int& EId,
const TStr& attr);
3019 int AddIntVAttrN(
const TStr& attr,
TBool UseDense=
true);
3022 int AddFltVAttrN(
const TStr& attr,
TBool UseDense=
true);
3031 int AddIntVAttrE(
const TStr& attr,
TBool UseDense=
true);
3034 int AddFltVAttrE(
const TStr& attr,
TBool UseDense=
true);
3037 int DelAttrN(
const TStr& attr);
3039 int DelAttrE(
const TStr& attr);
3042 bool IsAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3044 bool IsIntAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3046 bool IsIntVAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3048 bool IsFltVAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3050 bool IsStrAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3052 bool IsFltAttrDeletedN(
const int& NId,
const TStr& attr)
const;
3057 bool NodeAttrIsIntDeleted(
const int& NId,
const TStrIntPrH::TIter& NodeHI)
const;
3059 bool NodeAttrIsIntVDeleted(
const int& NId,
const TStrIntPrH::TIter& NodeHI)
const;
3061 bool NodeAttrIsFltVDeleted(
const int& NId,
const TStrIntPrH::TIter& NodeHI)
const;
3063 bool NodeAttrIsStrDeleted(
const int& NId,
const TStrIntPrH::TIter& NodeHI)
const;
3065 bool NodeAttrIsFltDeleted(
const int& NId,
const TStrIntPrH::TIter& NodeHI)
const;
3068 bool IsAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3070 bool IsIntAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3072 bool IsIntVAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3074 bool IsFltVAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3076 bool IsStrAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3078 bool IsFltAttrDeletedE(
const int& EId,
const TStr& attr)
const;
3083 bool EdgeAttrIsIntDeleted(
const int& EId,
const TStrIntPrH::TIter& EdgeHI)
const;
3085 bool EdgeAttrIsIntVDeleted(
const int& EId,
const TStrIntPrH::TIter& EdgeHI)
const;
3087 bool EdgeAttrIsFltVDeleted(
const int& EId,
const TStrIntPrH::TIter& EdgeHI)
const;
3089 bool EdgeAttrIsStrDeleted(
const int& EId,
const TStrIntPrH::TIter& EdgeHI)
const;
3091 bool EdgeAttrIsFltDeleted(
const int& EId,
const TStrIntPrH::TIter& EdgeHI)
const;
3099 TFlt GetWeightOutEdges(
const TNodeI& NI,
const TStr& attr);
3101 bool IsFltAttrE(
const TStr& attr);
3103 bool IsIntAttrE(
const TStr& attr);
3105 bool IsStrAttrE(
const TStr& attr);
3109 int GetFltKeyIdE(
const int& EId);
3112 void GetWeightOutEdgesV(
TFltV& OutWeights,
const TFltV& AttrVal) ;
3114 void GetAttrNNames(
TStrV& IntAttrNames,
TStrV& FltAttrNames,
TStrV& StrAttrNames)
const;
3116 void GetAttrENames(
TStrV& IntAttrNames,
TStrV& FltAttrNames,
TStrV& StrAttrNames)
const;
3120 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TInt& Val);
3122 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TInt& Val);
3126 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3130 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3134 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TFlt& Val);
3136 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TFlt& Val);
3140 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3144 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3148 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TStr& Val);
3150 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TStr& Val);
3154 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3158 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3162 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TInt& ValX)
const;
3164 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TInt& ValX)
const;
3168 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3172 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3176 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TFlt& ValX)
const;
3178 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TFlt& ValX)
const;
3182 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3186 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3190 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TStr& ValX)
const;
3192 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TStr& ValX)
const;
3196 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3200 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3204 int DelSAttrDatN(
const TInt& NId,
const TStr& AttrName);
3206 int DelSAttrDatN(
const TInt& NId,
const TInt& AttrId);
3210 return DelSAttrDatN(NodeI.
GetId(), AttrName);
3214 return DelSAttrDatN(NodeI.
GetId(), AttrId);
3221 return GetSAttrVN(NodeI.
GetId(), AttrType, AttrV);
3225 int GetIdVSAttrN(
const TStr& AttrName,
TIntV& IdV)
const;
3227 int GetIdVSAttrN(
const TInt& AttrId,
TIntV& IdV)
const;
3238 int AddSAttrDatE(
const TInt& EId,
const TStr& AttrName,
const TInt& Val);
3240 int AddSAttrDatE(
const TInt& EId,
const TInt& AttrId,
const TInt& Val);
3244 return AddSAttrDatE(EdgeI.
GetId(), AttrName, Val);
3248 return AddSAttrDatE(EdgeI.
GetId(), AttrId, Val);
3252 int AddSAttrDatE(
const TInt& EId,
const TStr& AttrName,
const TFlt& Val);
3254 int AddSAttrDatE(
const TInt& EId,
const TInt& AttrId,
const TFlt& Val);
3258 return AddSAttrDatE(EdgeI.
GetId(), AttrName, Val);
3262 return AddSAttrDatE(EdgeI.
GetId(), AttrId, Val);
3266 int AddSAttrDatE(
const TInt& EId,
const TStr& AttrName,
const TStr& Val);
3268 int AddSAttrDatE(
const TInt& EId,
const TInt& AttrId,
const TStr& Val);
3272 return AddSAttrDatE(EdgeI.
GetId(), AttrName, Val);
3276 return AddSAttrDatE(EdgeI.
GetId(), AttrId, Val);
3280 int GetSAttrDatE(
const TInt& EId,
const TStr& AttrName,
TInt& ValX)
const;
3282 int GetSAttrDatE(
const TInt& EId,
const TInt& AttrId,
TInt& ValX)
const;
3286 return GetSAttrDatE(EdgeI.
GetId(), AttrName, ValX);
3290 return GetSAttrDatE(EdgeI.
GetId(), AttrId, ValX);
3294 int GetSAttrDatE(
const TInt& EId,
const TStr& AttrName,
TFlt& ValX)
const;
3296 int GetSAttrDatE(
const TInt& EId,
const TInt& AttrId,
TFlt& ValX)
const;
3300 return GetSAttrDatE(EdgeI.
GetId(), AttrName, ValX);
3304 return GetSAttrDatE(EdgeI.
GetId(), AttrId, ValX);
3308 int GetSAttrDatE(
const TInt& EId,
const TStr& AttrName,
TStr& ValX)
const;
3310 int GetSAttrDatE(
const TInt& EId,
const TInt& AttrId,
TStr& ValX)
const;
3314 return GetSAttrDatE(EdgeI.
GetId(), AttrName, ValX);
3318 return GetSAttrDatE(EdgeI.
GetId(), AttrId, ValX);
3322 int DelSAttrDatE(
const TInt& EId,
const TStr& AttrName);
3324 int DelSAttrDatE(
const TInt& EId,
const TInt& AttrId);
3328 return DelSAttrDatE(EdgeI.
GetId(), AttrName);
3332 return DelSAttrDatE(EdgeI.
GetId(), AttrId);
3338 return GetSAttrVE(EdgeI.
GetId(), AttrType, AttrV);
3342 int GetIdVSAttrE(
const TStr& AttrName,
TIntV& IdV)
const;
3344 int GetIdVSAttrE(
const TInt& AttrId,
TIntV& IdV)
const;
3359 static PNEANet GetSmallGraph();
3408 TNode(
const int& NId) : Id(NId), NIdV() { }
3416 int GetInNId(
const int& NodeN)
const {
return GetNbrNId(NodeN); }
3417 int GetOutNId(
const int& NodeN)
const {
return GetNbrNId(NodeN); }
3418 int GetNbrNId(
const int& NodeN)
const {
return NIdV[NodeN]; }
3420 bool IsInNId(
const int& NId)
const {
return IsNbrNId(NId); }
3421 bool IsOutNId(
const int& NId)
const {
return IsNbrNId(NId); }
3430 friend class TUndirNetMtx;
3439 TNodeI(
const THashIter& NodeHIter) : NodeHI(NodeHIter) { }
3444 TNodeI& operator++ (
int) { NodeHI++;
return *
this; }
3446 TNodeI& operator-- (
int) { NodeHI--;
return *
this; }
3449 bool operator < (
const TNodeI& NodeI)
const {
return NodeHI < NodeI.
NodeHI; }
3450 bool operator == (
const TNodeI& NodeI)
const {
return NodeHI == NodeI.
NodeHI; }
3453 int GetId()
const {
return NodeHI.GetDat().GetId(); }
3455 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
3457 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
3459 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
3466 int GetInNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetInNId(NodeN); }
3471 int GetOutNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetOutNId(NodeN); }
3476 int GetNbrNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetNbrNId(NodeN); }
3478 bool IsInNId(
const int& NId)
const {
return NodeHI.GetDat().IsInNId(NId); }
3480 bool IsOutNId(
const int& NId)
const {
return NodeHI.GetDat().IsOutNId(NId); }
3482 bool IsNbrNId(
const int& NId)
const {
return NodeHI.GetDat().IsNbrNId(NId); }
3491 TEdgeI() : CurNode(), EndNode(), CurEdge(0) { }
3492 TEdgeI(
const TNodeI& NodeI,
const TNodeI& EndNodeI,
const int& EdgeN=0) : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
3493 TEdgeI(
const TEdgeI& EdgeI) : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
3496 TEdgeI& operator++ (
int) {
do { CurEdge++;
if (CurEdge >= CurNode.
GetOutDeg()) { CurEdge=0; CurNode++;
while (CurNode < EndNode && CurNode.
GetOutDeg()==0) { CurNode++; } } }
while (CurNode < EndNode && GetSrcNId()>GetDstNId());
return *
this; }
3526 MxNId =
TInt(ShMIn);
3527 NEdges =
TInt(ShMIn);
3534 TUndirNet() : CRef(), MxNId(0), NEdges(0), NodeH(), SAttrN(), SAttrE() { }
3536 explicit TUndirNet(
const int& Nodes,
const int& Edges) : MxNId(0), NEdges(0), SAttrN(), SAttrE() {
Reserve(Nodes, Edges); }
3538 SAttrN(), SAttrE() { }
3540 TUndirNet(
TSIn& SIn) : MxNId(SIn), NEdges(SIn), NodeH(SIn), SAttrN(SIn), SAttrE(SIn) { }
3543 SAttrN.
Save(SOut); SAttrE.
Save(SOut); }
3551 static PUndirNet
New(
const int& Nodes,
const int& Edges) {
return new TUndirNet(Nodes, Edges); }
3556 Graph->MxNId.Load(SIn); Graph->NEdges.Load(SIn); Graph->NodeH.Load(SIn);
return Graph;
3573 if (
this!=&Graph) { MxNId=Graph.
MxNId; NEdges=Graph.
NEdges; NodeH=Graph.
NodeH; }
return *
this; }
3639 int AddEdge(
const int& SrcNId,
const int& DstNId);
3648 int AddEdgeUnchecked(
const int& SrcNId,
const int& DstNId);
3656 void DelEdge(
const int& SrcNId,
const int& DstNId);
3658 bool IsEdge(
const int& SrcNId,
const int& DstNId)
const;
3664 TEdgeI
GetEI(
const int& EId)
const;
3669 TEdgeI
GetEI(
const int& SrcNId,
const int& DstNId)
const;
3683 void Reserve(
const int& Nodes,
const int& Edges) {
if (Nodes>0) NodeH.
Gen(Nodes/2); }
3694 void Defrag(
const bool& OnlyNodeLinks=
false);
3699 bool IsOk(
const bool& ThrowExcept=
true)
const;
3701 void Dump(FILE *OutF=stdout)
const;
3709 static PUndirNet GetSmallGraph();
3712 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TInt& Val);
3714 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TInt& Val);
3718 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3722 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3726 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TFlt& Val);
3728 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TFlt& Val);
3732 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3736 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3740 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TStr& Val);
3742 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TStr& Val);
3746 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
3750 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
3754 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TInt& ValX)
const;
3756 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TInt& ValX)
const;
3760 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3764 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3768 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TFlt& ValX)
const;
3770 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TFlt& ValX)
const;
3774 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3778 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3782 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TStr& ValX)
const;
3784 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TStr& ValX)
const;
3788 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
3792 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
3796 int DelSAttrDatN(
const TInt& NId,
const TStr& AttrName);
3798 int DelSAttrDatN(
const TInt& NId,
const TInt& AttrId);
3802 return DelSAttrDatN(NodeI.
GetId(), AttrName);
3806 return DelSAttrDatN(NodeI.
GetId(), AttrId);
3813 return GetSAttrVN(NodeI.
GetId(), AttrType, AttrV);
3817 int GetIdVSAttrN(
const TStr& AttrName,
TIntV& IdV)
const;
3819 int GetIdVSAttrN(
const TInt& AttrId,
TIntV& IdV)
const;
3830 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TInt& Val);
3832 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TInt& Val);
3844 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TFlt& Val);
3846 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TFlt& Val);
3858 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TStr& Val);
3860 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TStr& Val);
3872 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TInt& ValX)
const;
3874 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TInt& ValX)
const;
3886 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TFlt& ValX)
const;
3888 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TFlt& ValX)
const;
3900 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TStr& ValX)
const;
3902 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TStr& ValX)
const;
3914 int DelSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName);
3916 int DelSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId);
3927 int GetSAttrVE(
const int& SrcNId,
const int& DstNId,
const TAttrType AttrType,
TAttrPrV& AttrV)
const;
3934 int GetIdVSAttrE(
const TStr& AttrName,
TIntPrV& IdV)
const;
3936 int GetIdVSAttrE(
const TInt& AttrId,
TIntPrV& IdV)
const;
3946 friend class TUndirNetMtx;
3976 TNode() : Id(-1), InNIdV(), OutNIdV() { }
3977 TNode(
const int& NId) : Id(NId), InNIdV(), OutNIdV() { }
3978 TNode(
const TNode& Node) : Id(Node.Id), InNIdV(Node.InNIdV), OutNIdV(Node.OutNIdV) { }
3982 int GetDeg()
const {
return GetInDeg() + GetOutDeg(); }
3985 int GetInNId(
const int& NodeN)
const {
return InNIdV[NodeN]; }
3986 int GetOutNId(
const int& NodeN)
const {
return OutNIdV[NodeN]; }
3987 int GetNbrNId(
const int& NodeN)
const {
return NodeN<GetOutDeg()?GetOutNId(NodeN):GetInNId(NodeN-GetOutDeg()); }
3990 bool IsNbrNId(
const int& NId)
const {
return IsOutNId(NId) || IsInNId(NId); }
4000 friend class TDirNetMtx;
4009 TNodeI(
const THashIter& NodeHIter) : NodeHI(NodeHIter) { }
4013 TNodeI& operator++ (
int) { NodeHI++;
return *
this; }
4015 TNodeI& operator-- (
int) { NodeHI--;
return *
this; }
4017 bool operator < (
const TNodeI& NodeI)
const {
return NodeHI < NodeI.
NodeHI; }
4018 bool operator == (
const TNodeI& NodeI)
const {
return NodeHI == NodeI.
NodeHI; }
4020 int GetId()
const {
return NodeHI.GetDat().GetId(); }
4022 int GetDeg()
const {
return NodeHI.GetDat().GetDeg(); }
4024 int GetInDeg()
const {
return NodeHI.GetDat().GetInDeg(); }
4026 int GetOutDeg()
const {
return NodeHI.GetDat().GetOutDeg(); }
4032 int GetInNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetInNId(NodeN); }
4036 int GetOutNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetOutNId(NodeN); }
4040 int GetNbrNId(
const int& NodeN)
const {
return NodeHI.GetDat().GetNbrNId(NodeN); }
4042 bool IsInNId(
const int& NId)
const {
return NodeHI.GetDat().IsInNId(NId); }
4044 bool IsOutNId(
const int& NId)
const {
return NodeHI.GetDat().IsOutNId(NId); }
4046 bool IsNbrNId(
const int& NId)
const {
return IsOutNId(NId) || IsInNId(NId); }
4055 TEdgeI() : CurNode(), EndNode(), CurEdge(0) { }
4056 TEdgeI(
const TNodeI& NodeI,
const TNodeI& EndNodeI,
const int& EdgeN=0) : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
4057 TEdgeI(
const TEdgeI& EdgeI) : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
4060 TEdgeI& operator++ (
int) { CurEdge++;
if (CurEdge >= CurNode.
GetOutDeg()) { CurEdge=0; CurNode++;
4061 while (CurNode < EndNode && CurNode.
GetOutDeg()==0) { CurNode++; } }
return *
this; }
4089 MxNId =
TInt(ShMIn);
4096 TDirNet() : CRef(), MxNId(0), NodeH(), SAttrN(), SAttrE() { }
4098 explicit TDirNet(
const int& Nodes,
const int& Edges) : MxNId(0), SAttrN(), SAttrE() {
Reserve(Nodes, Edges); }
4099 TDirNet(
const TDirNet& Graph) : MxNId(Graph.MxNId), NodeH(Graph.NodeH), SAttrN(), SAttrE() { }
4101 TDirNet(
TSIn& SIn) : MxNId(SIn), NodeH(SIn), SAttrN(SIn), SAttrE(SIn) { }
4111 static PDirNet
New(
const int& Nodes,
const int& Edges) {
return new TDirNet(Nodes, Edges); }
4116 Graph->MxNId.Load(SIn); Graph->NodeH.Load(SIn);
return Graph;
4131 if (
this!=&Graph) { MxNId=Graph.
MxNId; NodeH=Graph.
NodeH; }
return *
this; }
4200 int AddEdge(
const int& SrcNId,
const int& DstNId);
4209 int AddEdgeUnchecked(
const int& SrcNId,
const int& DstNId);
4217 void DelEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true);
4219 bool IsEdge(
const int& SrcNId,
const int& DstNId,
const bool& IsDir =
true)
const;
4225 TEdgeI
GetEI(
const int& EId)
const;
4227 TEdgeI
GetEI(
const int& SrcNId,
const int& DstNId)
const;
4241 void Reserve(
const int& Nodes,
const int& Edges) {
if (Nodes>0) { NodeH.
Gen(Nodes/2); } }
4254 void Defrag(
const bool& OnlyNodeLinks=
false);
4259 bool IsOk(
const bool& ThrowExcept=
true)
const;
4261 void Dump(FILE *OutF=stdout)
const;
4267 static PDirNet GetSmallGraph();
4270 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TInt& Val);
4272 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TInt& Val);
4276 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
4280 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
4284 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TFlt& Val);
4286 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TFlt& Val);
4290 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
4294 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
4298 int AddSAttrDatN(
const TInt& NId,
const TStr& AttrName,
const TStr& Val);
4300 int AddSAttrDatN(
const TInt& NId,
const TInt& AttrId,
const TStr& Val);
4304 return AddSAttrDatN(NodeI.
GetId(), AttrName, Val);
4308 return AddSAttrDatN(NodeI.
GetId(), AttrId, Val);
4312 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TInt& ValX)
const;
4314 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TInt& ValX)
const;
4318 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
4322 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
4326 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TFlt& ValX)
const;
4328 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TFlt& ValX)
const;
4332 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
4336 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
4340 int GetSAttrDatN(
const TInt& NId,
const TStr& AttrName,
TStr& ValX)
const;
4342 int GetSAttrDatN(
const TInt& NId,
const TInt& AttrId,
TStr& ValX)
const;
4346 return GetSAttrDatN(NodeI.
GetId(), AttrName, ValX);
4350 return GetSAttrDatN(NodeI.
GetId(), AttrId, ValX);
4354 int DelSAttrDatN(
const TInt& NId,
const TStr& AttrName);
4356 int DelSAttrDatN(
const TInt& NId,
const TInt& AttrId);
4360 return DelSAttrDatN(NodeI.
GetId(), AttrName);
4364 return DelSAttrDatN(NodeI.
GetId(), AttrId);
4371 return GetSAttrVN(NodeI.
GetId(), AttrType, AttrV);
4375 int GetIdVSAttrN(
const TStr& AttrName,
TIntV& IdV)
const;
4377 int GetIdVSAttrN(
const TInt& AttrId,
TIntV& IdV)
const;
4388 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TInt& Val);
4390 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TInt& Val);
4402 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TFlt& Val);
4404 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TFlt& Val);
4416 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
const TStr& Val);
4418 int AddSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
const TStr& Val);
4430 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TInt& ValX)
const;
4432 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TInt& ValX)
const;
4444 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TFlt& ValX)
const;
4446 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TFlt& ValX)
const;
4458 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName,
TStr& ValX)
const;
4460 int GetSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId,
TStr& ValX)
const;
4472 int DelSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TStr& AttrName);
4474 int DelSAttrDatE(
const int& SrcNId,
const int& DstNId,
const TInt& AttrId);
4485 int GetSAttrVE(
const int& SrcNId,
const int& DstNId,
const TAttrType AttrType,
TAttrPrV& AttrV)
const;
4492 int GetIdVSAttrE(
const TStr& AttrName,
TIntPrV& IdV)
const;
4494 int GetIdVSAttrE(
const TInt& AttrId,
TIntPrV& IdV)
const;
4505 friend class TDirNetMtx;
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
int GetSAttrVE(const TEdgeI &EdgeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for EdgeI.
int GetNbrEId(const int &EdgeN) const
int AddEdge(const TEdgeI &EdgeI)
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() to the network.
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
TEdgeI GetEI(const int &EId) const
Not supported/implemented!
void LoadNetworkShM(TShMIn &ShMIn)
TEdgeDat & GetOutEDat(const int &EdgeN)
static int GetNIdPos(const TVec< TPair< TInt, TEdgeData > > &NIdV, const int &NId)
TVec< TIntV > VecOfIntVecsN
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to NodeI.
TNEANet(TSIn &SIn)
Constructor for loading the graph from a (binary) stream SIn.
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from EdgeI.
TEdgeI(const THashIter &EdgeHIter, const TNodeEdgeNet *NetPt)
static const T & Mn(const T &LVal, const T &RVal)
TNodeI & operator++(int)
Increment iterator.
THash< TStr, TBool > KeyToDenseE
TNodeNet(const TNodeNet &NodeNet)
TNodeI(const THashIter &NodeHIter, const TNodeNet *NetPt)
TPair< TInt, TInt > TIntPr
Tests (at compile time) if the graph is a network with data on nodes.
void IntVAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
int DelSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from EdgeI.
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
TNodeData & GetOutNDat(const int &EdgeN)
bool IsDeleted() const
Returns true if the attribute has been deleted.
TInt GetIntAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of int attr from the node attr value vector.
bool IsOutNId(const int &NId) const
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from NodeI.
Main namespace for all the Snap global entities.
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the graph.
TVec< TFltV >::TIter TFltVVecIter
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
int GetDeg() const
Returns degree of the current node.
void Clr()
Deletes all nodes and edges from the network.
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
int GetInEId(const int &EdgeN) const
Returns ID of EdgeN-th in-edge.
const TNodeData & GetInNDat(const int &EdgeN) const
int GetNbrEId(const int &EdgeN) const
Returns ID of EdgeN-th in or out-edge.
static PUndirNet New()
Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New()...
int GetNodes() const
Returns the number of nodes in the network.
TPt< TIntNEDNet > PIntNEDNet
const TEdgeDat & GetOutEDat(const int &EdgeN) const
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from NodeI.
void SetNDat(const int &NId, const TNodeData &NodeDat)
Sets node data for the node of ID NId in the network.
bool IsKeyIdEqKeyN() const
TPt< TIntFltNEDNet > PIntFltNEDNet
void SortEIdByDat(const bool &Asc=true)
Sorts edges by edge data.
void LoadShM(TShMIn &MStream)
THash< TInt, TNode >::TIter THashIter
#define IAssertR(Cond, Reason)
int GetOutNId(const int &EdgeN) const
Returns ID of EdgeN-th out-node (the node the current node points to).
void LoadNetworkShM(TShMIn &ShMIn)
TStr GetStrAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of str attr from the node attr value vector.
THash< TStr, TFlt > FltDefaultsE
int AppendIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
virtual void Save(TSOut &SOut) const
Saves the network to a (binary) stream SOut.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to EdgeI.
int GetDeg() const
Returns degree of the current node.
int AddFltAttrDatE(const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
TNode(const int &NId, const TNodeData &NodeData)
int GetOutNId(const int &EdgeN) const
Returns ID of EdgeN-th out-node (the node the current node points to).
TDirNet(const TDirNet &Graph)
TNode & GetNode(const int &NId)
TAStrI GetNAStrI(const TStr &attr, const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
void Save_V1(TSOut &SOut) const
Saves the network to a (binary) stream SOut. Available for backwards compatibility.
THash< TInt, TNode > NodeH
int AddFltVAttrDatE(const TEdgeI &EdgeI, const TFltV &value, const TStr &attr)
Attribute based add function for attr to TFltV value.
int GetOutDeg() const
Returns out-degree of the current node.
TEdgeI(const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from NodeI.
enum TAttrType_ TAttrType
Types for tables, sparse and dense attributes.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
const TNodeData & GetNDat(const int &NId) const
Returns node data for the node of ID NId in the network.
const TNodeData & GetDat() const
TVec< TStrV > VecOfStrVecsE
THash< TStr, TInt > IntDefaultsE
int GetInNId(const int &EdgeN) const
Returns ID of EdgeN-th in-node (the node pointing to the current node).
void Save(TSOut &SOut) const
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from NodeI.
TNodeEDatNet & operator=(const TNodeEDatNet &NodeNet)
const TNodeData & operator()() const
void Save(TSOut &SOut) const
void Save_V1(TSOut &SOut) const
Saves the graph to a (binary) stream SOut. Available for backwards compatibility. ...
int AddNode(const TNodeI &NodeI)
Adds a node NodeI and its node data to the network.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
TNode & GetNode(const int &NId)
int GetId() const
Returns edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from EdgeI.
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
int AddEdge(const TEdgeI &EdgeI)
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() and its edge data to the network...
int GetOutDeg() const
Returns out-degree of the current node (returns same as value GetDeg() since the network is undirecte...
int DelSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from EdgeI.
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from NodeI.
void SortNIdById(const bool &Asc=true)
Sorts nodes by node IDs.
bool Empty() const
Tests whether the network is empty (has zero nodes).
int GetInNId(const int &NodeN) const
int GetInNId(const int &NodeN) const
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
TEdgeI GetEI(const int &EId) const
Returns an iterator referring to edge with edge ID EId.
void DelNode(const int &NId)
Deletes node of ID NId from the network.
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to EdgeI.
int GetEdges() const
Returns the number of edges in the network.
void DelEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true)
Deletes an edge from node IDs SrcNId to DstNId from the network.
int AddEdge(const TEdgeI &EdgeI)
Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from NodeI.
bool operator<(const TEdgeI &EdgeI) const
void SortNIdV()
Sorts the adjacency lists of the current node.
const TNode & GetNode(const int &NId) const
Returns node element for the node of ID NId in the network.
bool IsNbrEId(const int &EId) const
TEdgeI(const THashIter &EdgeHIter, const TNEANet *GraphPt)
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
TPt< TStrIntNEDNet > PStrIntNEDNet
THash< TInt, TNode >::TIter THashIter
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
int AddEdge(const TEdgeI &EdgeI)
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
Edge iterator. Only forward iteration (operator++) is supported.
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
void AttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of attr names for edge EId.
static const T & Mx(const T &LVal, const T &RVal)
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
int GetSAttrVE(const TEdgeI &EdgeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for EdgeI.
int GetOutNId(const int &NodeN) const
void SortNIdByDat(const bool &Asc=true)
Sorts nodes by node data.
TNodeData & GetOutNDat(const int &NodeN)
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
void GetNIdV(TIntV &NIdV) const
Returns a vector of all node IDs in the network.
const TNodeData & GetDat() const
THash< TInt, TFltV >::TIter TFltHVecIter
int GetId() const
Returns ID of the current node.
void Save(TSOut &SOut) const
static PNEANet Load(TSIn &SIn)
Static constructor that loads the graph from a stream SIn and returns a pointer to it...
TEdgeData & GetInEDat(const int &EdgeN)
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from EdgeI.
TNode & GetNode(const int &NId)
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
int AddNode(const TNodeI &NodeI)
void StrAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of str attr names for node NId.
TNodeI(const TNodeI &NodeI)
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to EdgeI.
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the network.
void FltAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
bool IsInEId(const int &EId) const
Tests whether the edge with ID EId is an in-edge of current node.
TNodeI(const THashIter &NodeHIter, const TNodeEdgeNet *NetPt)
void IntVAttrValueEI(const TInt &EId, TVec< TIntV > &Values) const
Returns a vector of attr values for edge EId.
bool operator<(const TNodeI &NodeI) const
void SortNodeAdjV()
Sorts the adjacency lists of each node.
void ReserveNIdInDeg(const int &NId, const int &InDeg)
Reserves memory for node ID NId having InDeg in-edges.
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
void Save(TSOut &SOut) const
Saves the network to a (binary) stream SOut. Expects data structures for sparse attributes.
bool IsOutNId(const int &NId) const
const TNodeData & GetOutNDat(const int &EdgeN) const
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
TInt CheckDenseOrSparseE(const TStr &attr) const
TNodeI(const TNodeI &NodeI)
TNodeEdgeNet< TFlt, TFlt > TFltNENet
bool IsEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the graph.
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
bool operator<(const TEdgeI &EdgeI) const
TEdgeI(const TEdgeI &EdgeI)
TNodeEDatNet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
bool IsInNId(const int &NId) const
THash< TInt, TNode >::TIter THashIter
TPt< TIntNENet > PIntNENet
void DelEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true)
Deletes an edge from node IDs SrcNId to DstNId from the network.
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from EdgeI.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to EdgeI.
Tests (at compile time) if the graph is directed.
int AddIntVAttrDatE(const TEdgeI &EdgeI, const TIntV &value, const TStr &attr)
Attribute based add function for attr to IntV value.
int GetInNId(const int &EdgeN) const
Returns ID of EdgeN-th in-node (the node pointing to the current node).
bool operator<(const TNodeI &NodeI) const
const TEdge & GetEdgeKId(const int &EdgeKeyId) const
const TNode & GetNode(const int &NId) const
static PUndirNet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from memory.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to EdgeI.
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
void LoadShM(TShMIn &MStream)
TSizeTy Len() const
Returns the number of elements in the vector.
int GetInDeg() const
Returns in-degree of the current node.
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the network.
TAFltVI BegEAFltVI(const TStr &attr) const
Returns an iterator referring to the first edge's int attribute.
void GetFltAttrVal(TFltV &Val) const
Gets vector of flt attribute values.
TEdgeI(const TEdgeI &EdgeI)
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
void SetEDat(const int &SrcNId, const int &DstNId, const TEdgeData &EdgeDat)
Sets edge data for the edge between nodes SrcNId and DstNId in the network.
bool operator<(const TNode &Node) const
void Save(TSOut &SOut) const
int AppendFltVAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Appends value onto the TFltV attribute for the given node.
void FltVAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of flt attr names for edge EId.
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
TEdge(const int &EId, const int &SourceNId, const int &DestNId, const TEdgeData &EdgeData)
TNodeEdgeNet(const TNodeEdgeNet &Net)
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
static PNet New()
Static constructor that returns a pointer to the network. Call: TPt > Net = TNod...
TIntV GetIntVAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of the intv attr from the edge attr value vector.
const TNodeData & GetInNDat(const int &NodeN) const
TAFltVI BegNAFltVI(const TStr &attr) const
Returns an iterator referring to the first node's flt attribute.
int GetNodes() const
Returns the number of nodes in the network.
TNodeI & operator++(int)
Increment iterator.
TStrIntPrH KeyToIndexTypeE
const TNodeData & GetInNDat(const int &NodeN) const
TEdgeData & GetOutEDat(const int &EdgeN)
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from EdgeI.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from EdgeI.
TStr GetStrAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of str attr from the edge attr value vector.
Edge iterator. Only forward iteration (operator++) is supported.
int GetNbrNId(const int &NodeN) const
void SetAllEDat(const TEdgeData &EdgeDat)
Sets edge data for all the edges in the network to EDat.
bool IsInNId(const int &NId) const
void Save(TSOut &SOut) const
Saves the network to a (binary) stream SOut. Expects data structures for sparse attributes.
TNodeI & operator=(const TNodeI &NodeI)
TEdgeI GetEI(const int &SrcNId, const int &DstNId) const
Returns an iterator referring to edge (SrcNId, DstNId) in the graph.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
TNodeI(const TNodeI &NodeI)
int GetEdges() const
Returns the number of edges in the network.
int GetRndEId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random edge in the graph.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from NodeI.
bool IsOutEId(const int &EId) const
Tests whether the edge with ID EId is an out-edge of current node.
int GetOutEId(const int &EdgeN) const
Returns ID of EdgeN-th out-edge.
TAFltVI EndNAFltVI(const TStr &attr) const
Returns an iterator referring to the past-the-end node's attribute.
THash< TInt, TNode > NodeH
Node iterator. Only forward iteration (operator++) is supported.
TStr GetDat() const
Returns an attribute of the node.
int GetOutNId(const int &NodeN) const
TNodeData & GetNbrNDat(const int &NodeN)
TNodeI & operator++(int)
Increment iterator.
TInt GetDat() const
Returns an attribute of the node.
TVec< TIntV >::TIter TIntVVecIter
bool IsNbrNId(const int &NId) const
THash< TStr, TFlt > FltDefaultsN
void SortNIdById(const bool &Asc=true)
Sorts nodes by node IDs.
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
TEdgeI GetRndEI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random edge in the graph.
const TEdge & GetEdge(const int &EId) const
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
static PNet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from shared memory.
const TNodeData & GetNbrNDat(const int &NodeN) const
int GetUniqEdges(const bool &IsDir=true) const
Returns the number of edges in the network with a unique pair of nodes.
TNodeEDatNet< TInt, TFlt > TIntFltNEDNet
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
TNodeData & GetNbrNDat(const int &EdgeN)
int AppendFltVAttrDatE(const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Appends value onto the TFltV attribute for the given node.
TNodeData & GetInNDat(const int &NodeN)
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
TEdgeI GetEI(const int &EId) const
Not supported/implemented!
int AddIntAttrDatE(const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
void ReserveNIdOutDeg(const int &NId, const int &OutDeg)
Reserves memory for node ID NId having OutDeg out-edges.
int GetNbrNId(const int &EdgeN) const
Returns ID of EdgeN-th neighboring node.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to EdgeI.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to NodeI.
TEdgeI(const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
TFlt GetDat() const
Returns an attribute of the node.
int GetDeg() const
Returns degree of the current node, the sum of in-degree and out-degree.
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
bool IsOutEId(const int &EId) const
TAIntI BegNAIntI(const TStr &attr) const
Returns an iterator referring to the first node's int attribute.
const TDat & GetDat(const TKey &Key) const
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to NodeI.
TIntV GetIntVAttrDatN(const TNodeI &NodeI, const TStr &attr) const
Gets the value of the intv attr from the node attr value vector.
Node iterator. Only forward iteration (operator++) is supported.
Node/edge integer attribute iterator. Iterates through all nodes/edges for one integer attribute...
int GetInNId(const int &EdgeN) const
void AttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
int GetSrcNId() const
Gets the source node of an edge.
void GetStrAttrNames(TStrV &Names) const
Gets vector of str attribute names.
bool GetEDat(const int &SrcNId, const int &DstNId, TEdgeData &EdgeDat) const
Returns edge data in Data for the edge from node IDs SrcNId to DstNId.
TVec< TIntV > VecOfIntVecsE
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the network.
TNodeI & operator=(const TNodeI &NodeI)
const TEdgeData & GetInEDat(const int &EdgeN) const
int DelSAttrDatN(const TNodeI &NodeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from NodeI.
bool IsNbrEId(const int &EId) const
Tests whether the edge with ID EId is an in or out-edge of current node.
void IntAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
int GetSrcNId() const
Gets the source node of an edge.
TAIntVI EndNAIntVI(const TStr &attr) const
Returns an iterator referring to the past-the-end node's attribute.
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the network.
int GetNodes() const
Returns the number of nodes in the network.
bool IsNbrNId(const int &NId) const
static PUndirNet New(const int &Nodes, const int &Edges)
Static constructor that returns a pointer to the network and reserves enough memory for Nodes nodes a...
bool IsNbrNId(const int &NId) const
TEdgeI GetEI(const int &EId) const
Not supported/implemented!
void LoadNetworkShM(TShMIn &ShMIn)
TAFltI GetEAFltI(const TStr &attr, const int &EId) const
Returns an iterator referring to the edge of ID EId in the graph.
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
int GetNbrEId(const int &EdgeN) const
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to NodeI.
bool IsDeleted() const
Returns true if the attribute has been deleted.
TAFltVI & operator++(int)
int GetInDeg() const
Returns in-degree of the current node.
TAFltI BegEAFltI(const TStr &attr) const
Returns an iterator referring to the first edge's flt attribute.
void SetNDat(const int &NId, const TNodeData &NodeDat)
Sets node data for the node of ID NId in the network.
TAStrI GetEAStrI(const TStr &attr, const int &EId) const
Returns an iterator referring to the edge of ID EId in the graph.
TVec< TVec< TFltV > > VecOfFltVecVecsN
Node/edge float attribute iterator. Iterates through all nodes/edges for one float attribute...
int AddNode(const TNodeI &NodeI)
Adds a node of ID NodeI.GetId() to the graph.
Node Edge Network (directed multigraph, TNEGraph with data on nodes and edges).
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from EdgeI.
int GetId() const
Returns edge ID.
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
static PUndirNet Load(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
void Load(TSIn &InStream)
int GetOutNId(const int &EdgeN) const
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
void ErrNotify(const char *NotifyCStr)
TNodeEDatNet< TInt, TInt > TIntNEDNet
bool IsOutEId(const int &EId) const
TAIntI BegEAIntI(const TStr &attr) const
Returns an iterator referring to the first edge's int attribute.
int GetNbrNId(const int &NodeN) const
virtual void Save(TSOut &SOut) const
Saves the network to a (binary) stream SOut.
const TNodeData & GetNDat(const int &NId) const
Returns node data for the node of ID NId in the network.
int DelSAttrDatN(const TNodeI &NodeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from NodeI.
bool operator==(const TEdgeI &EdgeI) const
TEdge(const int &EId, const int &SourceNId, const int &DestNId)
TVec< TStrV > VecOfStrVecsN
void GetStrAttrVal(TStrV &Val) const
Gets vector of str attribute values.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
TNodeEDatNet(const TNodeEDatNet &NodeNet)
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
void Save(TSOut &SOut) const
TEdgeI & operator++(int)
Increment iterator.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
int AddEdge(const int &SrcNId, const int &DstNId, int EId=-1)
Adds an edge between node IDs SrcNId and DstNId to the graph.
int GetDeg() const
Returns degree of the current node, the sum of in-degree and out-degree.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from NodeI.
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the network.
int AddFltAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
int GetInEId(const int &EdgeN) const
Returns ID of EdgeN-th in-edge.
int DelSAttrDatN(const TNodeI &NodeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from NodeI.
void IntVAttrValueNI(const TInt &NId, TVec< TIntV > &Values) const
Returns a vector of attr values for node NId.
int GetInDeg() const
Returns in-degree of the current node.
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to NodeI.
THash< TInt, TIntV >::TIter TIntHVecIter
THash< TInt, TEdge > EdgeH
static PNet New()
Static constructor that returns a pointer to the network. Call: TPt > Net = TNodeEDatNet::New().
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from EdgeI.
TNodeI(const THashIter &NodeHIter)
TAIntI GetEAIntI(const TStr &attr, const int &EId) const
Returns an iterator referring to the edge of ID EId in the graph.
int DelFromIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Deletes value from the TIntV attribute for the given node.
int AddIntVAttrDatN(const TNodeI &NodeI, const TIntV &value, const TStr &attr)
Attribute based add function for attr to IntV value.
const TNodeData & GetSrcNDat() const
TAStrI EndEAStrI(const TStr &attr) const
Returns an iterator referring to the past-the-end edge's attribute.
int GetDstNId() const
Returns the destination of the edge.
TNode(const int &NId, const TNodeData &NodeData)
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from EdgeI.
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to EdgeI.
const TEdgeData & GetOutEDat(const int &EdgeN) const
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
TStr GetStrAttrIndDatE(const TEdgeI &EdgeI, const int &index)
Gets the value of a string edge attr specified by edge iterator EdgeI and the attr index...
bool operator==(const TNodeI &NodeI) const
bool operator==(const TEdgeI &EdgeI) const
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to NodeI.
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
static PNEANet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from memory.
TEdgeI(const TEdgeI &EdgeI)
TAStrI BegEAStrI(const TStr &attr) const
Returns an iterator referring to the first edge's str attribute.
virtual void DelNode(const int &NId)
Deletes node of ID NId from the network.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node SrcNId to node DstNId to the network.
const TNodeData & GetDat() const
TNodeData & GetInNDat(const int &EdgeN)
const TNode & GetNode(const int &NId) const
TAStrI EndNAStrI(const TStr &attr) const
Returns an iterator referring to the past-the-end node's attribute.
void Save(TSOut &SOut) const
TAIntVI(const TAIntVI &I)
TEdgeI(const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
TNodeData & GetInNDat(const int &NodeN)
THash< TInt, TNode > NodeH
void Clr()
Deletes all nodes and edges from the network.
int AddEdge(const TEdgeI &EdgeI)
Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the network.
void DelKey(const TKey &Key)
Edge iterator. Only forward iteration (operator++) is supported.
TAIntI EndNAIntI(const TStr &attr) const
Returns an iterator referring to the past-the-end node's attribute.
void LoadShM(TShMIn &MStream)
Edge iterator. Only forward iteration (operator++) is supported.
int GetId() const
Returns ID of the current node.
void GetStrAttrVal(TStrV &Val) const
Gets vector of str attribute values.
bool IsOutEId(const int &EId) const
Tests whether the edge with ID EId is an out-edge of current node.
int GetSAttrVN(const TNodeI &NodeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for NodeI.
TAIntI EndEAIntI(const TStr &attr) const
Returns an iterator referring to the past-the-end edge's attribute.
int GetOutDeg() const
Returns out-degree of the current node.
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the network.
TAFltI BegNAFltI(const TStr &attr) const
Returns an iterator referring to the first node's flt attribute.
void Clr(const bool &DoDel=true, const bool &ResetDat=true)
Deletes all nodes and edges from the network.
int GetOutNId(const int &NodeN) const
const TNodeData & GetDat() const
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from EdgeI.
TNEANet(const TNEANet &Graph, bool modeSubGraph)
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from EdgeI.
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Node Edge Network (directed graph, TNGraph with data on nodes and edges).
TVec< TFltV > VecOfFltVecsE
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
int DelSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from EdgeI.
TNode & GetNode(const int &NId)
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
TAFltI EndNAFltI(const TStr &attr) const
Returns an iterator referring to the past-the-end node's attribute.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
TInt GetIntAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of int attr from the edge attr value vector.
virtual void Save(TSOut &SOut) const
Saves the network to a (binary) stream SOut.
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
int AddStrAttrDatN(const TNodeI &NodeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
int DelSAttrDatN(const TNodeI &NodeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from NodeI.
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
void Gen(const int &ExpectVals)
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
#define HasGraphFlag(TGraph, Flag)
For quick testing of the properties of the graph/network object (see TGraphFlag). ...
TNode & GetNode(const int &NId)
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
Tests (at compile time) if the graph is a network with data on edges.
TAIntI(const TIntVecIter &HIter, TStr attribute, bool isEdgeIter, const TNEANet *GraphPt)
void LoadNetworkShM(TShMIn &ShMIn)
bool Empty() const
Tests whether the network is empty (has zero nodes).
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
void GetIntVAttrVal(TVec< TIntV > &Val) const
Gets vector of int attribute values.
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the network.
TEdgeDat & GetNbrEDat(const int &EdgeN)
static PNet Load(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
TNodeI(const TNodeI &NodeI)
void SortNIdByDat(const bool &Asc=true)
Sorts nodes by node data.
int GetId() const
Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.
int GetNbrNId(const int &EdgeN) const
Returns ID of EdgeN-th neighboring node.
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from NodeI.
bool IsOutNId(const int &NId) const
bool Empty() const
Tests whether the network is empty (has zero nodes).
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
TVec< TVec< TFltV > > VecOfFltVecVecsE
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from EdgeI.
static PUndirNet Load_V1(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
void ReserveNIdDeg(const int &NId, const int &Deg)
Reserves memory for node ID NId having Deg edges.
TEdgeI & operator=(const TEdgeI &EdgeI)
TEdgeI & operator++(int)
Increment iterator.
TNode & GetNode(const int &NId)
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node SrcNId to node DstNId to the network.
TEdgeI GetRndEI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random edge in the network.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from EdgeI.
int GetDstNId() const
Gets the destination node of an edge.
static PDirNet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from memory.
const TVal & GetDat(const TVal &Val) const
Returns reference to the first occurrence of element Val.
int AddNode(const TNodeI &NodeId)
Adds a node of ID NodeI.GetId() to the network.
bool operator<(const TNode &Node) const
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 network.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from EdgeI.
const TNodeData & GetDat() const
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
const TNodeData & GetSrcNDat() const
void SortNIdById(const bool &Asc=true)
Sorts nodes by node IDs.
TNEANet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a graph of nodes and edges.
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
int DelSAttrDatN(const TNodeI &NodeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from NodeI.
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
bool FNextKeyId(int &KeyId) const
TNodeI(const THashIter &NodeHIter)
THash< TStr, TStr > StrDefaultsN
void AttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of attr names for node NId.
void operator()(TNode *n, TShMIn &ShMIn)
const TEdgeData & GetDat() const
Tests (at compile time) if the graph is a multigraph with multiple edges between the same nodes...
THash< TInt, TNode > NodeH
TAIntVI EndEAIntVI(const TStr &attr) const
Returns an iterator referring to the past-the-end edge's attribute.
THash< TInt, TNode > NodeH
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the graph.
TNodeNet(TSIn &SIn)
Constructor that loads the network from a (binary) stream SIn.
bool Empty() const
Tests whether the network is empty (has zero nodes).
TFlt GetFltAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of flt attr from the node attr value vector.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
TNodeEDatNet(TSIn &SIn)
Constructor that loads the network from a (binary) stream SIn.
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to NodeI.
void SortNIdByDat(const bool &Asc=true)
Sorts nodes by node data.
const TNodeData & operator()() const
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
bool IsOk(const bool &ThrowExcept=true) const
Checks the network data structure for internal consistency.
TNodeEDatNet< TNodeData, TEdgeData > TNet
TNodeI(const TNodeI &NodeI)
TInt GetIntAttrIndDatN(const TNodeI &NodeI, const int &index)
Gets the value of an int node attr specified by node iterator NodeI and the attr index.
void IntVAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
bool IsInNId(const int &NId) const
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
TAIntVI GetNAIntVI(const TStr &attr, const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
int AddKey(const TKey &Key)
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to EdgeI.
void Save(TSOut &SOut) const
void FltVAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of flt attr names for node NId.
int GetId() const
Returns edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.
int GetId() const
Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.
TAIntI GetNAIntI(const TStr &attr, const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
int GetOutEId(const int &EdgeN) const
Returns ID of EdgeN-th out-edge.
TPt< TUndirNet > PUndirNet
Pointer to an undirected network (TUndirNet)
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to NodeI.
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
TAFltVI(const TAFltVI &I)
int GetInDeg() const
Returns in-degree of the current node.
TFltV GetFltVAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of the fltv attr from the edge attr value vector.
TNodeI(const THashIter &NodeHIter, const TNodeEDatNet *NetPt)
THash< TInt, TNode >::TIter THashIter
TVec< TPair< TInt, TEdgeData > > TNIdDatPrV
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to NodeI.
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
int GetSrcNId() const
Returns the source of the edge.
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
const TNodeData & GetNDat(const int &NId) const
Returns node data for the node of ID NId in the network.
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the network.
Node iterator. Only forward iteration (operator++) is supported.
TVec< TVec< TIntV > > VecOfIntVecVecsE
TNodeEdgeNet & operator=(const TNodeEdgeNet &Net)
void LoadShM(TShMIn &MStream)
void GetAttrVal(TStrV &Val) const
Gets vector of attribute values.
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to EdgeI.
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
int GetDstNId() const
Returns the destination of the edge. Since the network is undirected, this is the node with a greater...
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
TAFltVI GetEAFltVI(const TStr &attr, const int &EId) const
Returns an iterator referring to the edge of ID EId in the graph.
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to EdgeI.
TEdgeI(const TEdgeI &EdgeI)
void Save_V2(TSOut &SOut) const
Saves the graph without any sparse data structures. Available for backwards compatibility.
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the network.
bool IsInNId(const int &NId) const
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to EdgeI.
THash< TInt, TEdge > EdgeH
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
void SetAllEDat(const TEdgeData &EdgeDat)
Sets edge data for all the edges in the network to EDat.
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
void AttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for edge EId.
int GetOutDeg() const
Returns out-degree of the current node.
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from NodeI.
Directed multigraph with node edge attributes.
bool operator==(const TEdgeI &EdgeI) const
TEdgeData & GetOutEDat(const int &EdgeN)
void LoadNetworkShM(TShMIn &ShMIn)
load network from shared memory for this network
static PDirNet New(const int &Nodes, const int &Edges)
Static constructor that returns a pointer to the network and reserves enough memory for Nodes nodes a...
void GetAttrNames(TStrV &Names) const
Gets vector of attribute names.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to NodeI.
void GetFltAttrVal(TFltV &Val) const
Gets vector of flt attribute values.
bool Empty() const
Tests whether the graph is empty (has zero nodes).
static PNet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from shared memory.
TSizeTy SearchBin(const TVal &Val) const
Returns the position of an element with value Val.
int DelSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from EdgeI.
TAStrI BegNAStrI(const TStr &attr) const
Returns an iterator referring to the first node's str attribute.
void GetFltAttrNames(TStrV &Names) const
Gets vector of flt attribute names.
TNodeNet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
bool IsEdge(const int &EId) const
Tests whether an edge with ID EId exists in the network.
bool IsDeleted() const
Returns true if the attribute has been deleted.
const TNodeData & operator()() const
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
int AddNode(const TNodeI &NodeI)
Adds a node NodeI and its node data to the network.
int GetSrcNId() const
Gets the source of an edge.
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from NodeI.
bool IsInEId(const int &EId) const
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to EdgeI.
void SortByKey(const bool &Asc=true)
void SetEDat(const int &EId, const TEdgeData &EdgeDat)
Sets edge data for the edge of ID NId in the network.
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 network.
void LoadShM(TShMIn &MStream)
TVal * TIter
Random access iterator to TVal.
TEdge & GetEdge(const int &EId)
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
const TNode & GetNode(const int &NId) const
TAIntVI BegEAIntVI(const TStr &attr) const
Returns an iterator referring to the first edge's int attribute.
void FltVAttrValueEI(const TInt &EId, TVec< TFltV > &Values) const
Returns a vector of attr values for edge EId.
int GetNbrNId(const int &EdgeN) const
void LoadShM(TShMIn &MStream)
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the network.
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the graph.
int GetEId(const int &SrcNId, const int &DstNId) const
int GetId() const
Returns ID of the current node.
int GetKeyId(const TKey &Key) const
THash< TInt, TEdge >::TIter THashIter
Edge iterator. Only forward iteration (operator++) is supported.
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from NodeI.
void LoadNetworkShM(TShMIn &ShMIn)
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the network.
TAIntVI GetEAIntVI(const TStr &attr, const int &EId) const
Returns an iterator referring to the edge of ID EId in the graph.
bool IsNbrNId(const int &NId) const
TUndirNet(const TUndirNet &Graph)
void GetIntAttrNames(TStrV &Names) const
Gets vector of int attribute names.
const TNodeData & GetOutNDat(const int &NodeN) const
const TEdgeData & operator()() const
int GetId() const
Gets edge ID.
const TEdgeDat & GetNbrEDat(const int &EdgeN) const
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
TUndirNet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
TNodeNet< TInt > TIntNNet
TNodeNet< TFlt > TFltNNet
TFltV GetDat() const
Returns an attribute of the node.
int GetSAttrVN(const TNodeI &NodeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for NodeI.
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
Edge iterator. Only forward iteration (operator++) is supported.
static PNEANet Load_V2(TSIn &SIn)
Static constructor that loads the graph from a stream SIn and returns a pointer to it...
int DelAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Deletes the edge attribute for NodeI.
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
int GetNodes() const
Returns the number of nodes in the network.
void SortEIdById(const bool &Asc=true)
Sorts edges by edge IDs.
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
THash< TInt, TEdge >::TIter THashIter
void FltAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for node NId.
int AddNode(const TNodeI &NodeI)
Adds a node of ID NodeI.GetId() to the network.
TNodeEdgeNet(TSIn &SIn)
Constructor that loads the network from a (binary) stream SIn.
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
void Clr()
Deletes all nodes and edges from the network.
TNodeEdgeNet< TNodeData, TEdgeData > TNet
void FltVAttrValueNI(const TInt &NId, TVec< TFltV > &Values) const
Returns a vector of flt values for node NId.
bool operator<(const TEdgeI &EdgeI) const
THash< TStr, TStr > StrDefaultsE
const TEdgeData & GetDat() const
int GetInEId(const int &NodeN) const
void Clr()
Clears the contents of the attribute map.
void SetNDat(const int &NId, const TNodeData &NodeDat)
Sets node data for the node of ID NId in the network.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
const TNode & GetNodeKId(const int &NodeKeyId) const
const TNodeData & GetSrcNDat() const
void StrAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of str attr names for node NId.
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
void Load(TSIn &InStream)
int GetEdges() const
Returns the number of edges in the graph.
void Save(TSOut &SOut) const
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the network.
TNodeNet< TNodeData > TNet
static PDirNet Load_V1(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
TNodeNet< TStr > TStrNNet
int GetOutEId(const int &EdgeN) const
int GetInDeg() const
Returns in-degree of the current node.
void Save(TSOut &SOut) const
Saves the graph to a (binary) stream SOut. Expects data structures for sparse attributes.
void GetEIdV(TIntV &EIdV) const
Returns a vector of all edge IDs in the network.
bool IsInEId(const int &EId) const
TEdgeI(const TEdgeI &EdgeI)
int GetDstNId() const
Returns the destination node of the edge.
TAIntVI BegNAIntVI(const TStr &attr) const
Returns an iterator referring to the first node's int attribute.
int AddStrAttrDatE(const TEdgeI &EdgeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
void GetAttrVal(TStrV &Val) const
Gets vector of attribute values.
const TEdgeDat & GetInEDat(const int &EdgeN) const
const TNodeData & GetDstNDat() const
TNodeNet & operator=(const TNodeNet &NodeNet)
const TNodeData & GetNbrNDat(const int &NodeN) const
TNEANet(const TNEANet &Graph)
static PNEANet Load_V1(TSIn &SIn)
Static constructor that loads the graph from a stream SIn and returns a pointer to it...
TEdgeI(const TEdgeI &EdgeI)
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
static TStr Fmt(const char *FmtStr,...)
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
bool IsSorted(const bool &Asc=true) const
Checks whether the vector is sorted in ascending (if Asc=true) or descending (if Asc=false) order...
void Pack()
Reduces vector capacity (frees memory) to match its size.
static PNet New()
Static constructor that returns a pointer to the network.
void DelEdge(const int &EId)
Deletes an edge with ID EId from the network.
enum TGraphFlag_ TGraphFlag
Graph Flags, used for quick testing of graph types.
int DelSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from EdgeI.
void operator()(TNode *n, TShMIn &ShMIn)
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
bool operator<(const TEdge &Edge) const
int GetOutDeg() const
Returns out-degree of the current node.
const TNode & GetNode(const int &NId) const
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TStr &ValX) const
Gets Str sparse attribute with id AttrId from NodeI.
int AddFltVAttrDatN(const TNodeI &NodeI, const TFltV &value, const TStr &attr)
Attribute based add function for attr to FltV value.
int GetMxEId() const
Returns an ID that is larger than any edge ID in the network.
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from NodeI.
int GetEdges() const
Returns the number of edges in the network.
int GetNbrEId(const int &EdgeN) const
Returns ID of EdgeN-th in or out-edge.
int DelSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId)
Deletes sparse attribute with id AttrId from EdgeI.
const TEdgeData & GetDat() const
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to NodeI.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to EdgeI.
TVec< TFltV > VecOfFltVecsN
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from NodeI.
TAFltI EndEAFltI(const TStr &attr) const
Returns an iterator referring to the past-the-end edge's attribute.
TAFltI GetNAFltI(const TStr &attr, const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
#define EAssertR(Cond, MsgStr)
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to EdgeI.
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
void Clr()
Deletes all nodes and edges from the graph.
void Clr(const bool &DoDel=true, const bool &ResetDat=true)
Deletes all nodes and edges from the network.
TEdgeData & GetNbrEDat(const int &EdgeN)
void Save(TSOut &SOut) const
void operator()(TNode *n, TShMIn &ShMIn)
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
const TNodeData & GetNbrNDat(const int &EdgeN) const
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to EdgeI.
int GetEId(const int &SrcNId, const int &DstNId) const
Returns an edge ID between node IDs SrcNId and DstNId, if such an edge exists. Otherwise, return -1.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
bool Empty() const
Tests whether the network is empty (has zero nodes).
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to NodeI.
void GetIntVAttrNames(TStrV &Names) const
Gets vector of int attribute names.
const TNodeData & GetOutNDat(const int &NodeN) const
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the network.
TEdgeI GetEI(const int &SrcNId, const int &DstNId) const
Returns an iterator referring to edge (SrcNId, DstNId) in the graph.
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
bool IsInEId(const int &EId) const
Tests whether the edge with ID EId is an in-edge of current node.
bool operator<(const TNode &Node) const
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TFlt &ValX) const
Gets Flt sparse attribute with id AttrId from EdgeI.
int AddEdge(const TEdgeI &EdgeI)
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() and its edge data to the network...
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the network.
THash< TStr, TInt > IntDefaultsN
TNodeI(const THashIter &NodeHIter, const TNEANet *GraphPt)
TAIntVI(const TIntVVecIter &HIter, const TIntHVecIter &HHIter, TStr attribute, bool isEdgeIter, const TNEANet *GraphPt, bool is_dense)
const TNode & GetNode(const int &NId) const
Returns node element for the node of ID NId in the network.
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
int GetNodes() const
Returns the number of nodes in the network.
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the network.
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the network.
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the network.
void DelNode(const int &NId)
Deletes node of ID NId from the network.
int GetOutDeg() const
Returns out-degree of the current node.
THash< TInt, TNode > NodeH
int AppendIntVAttrDatE(const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
int GetSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from NodeI.
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...
bool IsNbrNId(const int &NId) const
Tests whether node with ID NId is a neighbor of the current node.
static PDirNet New()
Static constructor that returns a pointer to the network. Call: PDirNet Graph = TDirNet::New().
TEdge & GetEdge(const int &EId)
TAFltVI GetNAFltVI(const TStr &attr, const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
int GetSAttrVN(const TNodeI &NodeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for NodeI.
int GetSrcNId() const
Returns the source of the edge. Since the network is undirected, this is the node with a smaller ID o...
TEdgeI & operator=(const TEdgeI &EdgeI)
TFlt GetFltAttrIndDatN(const TNodeI &NodeI, const int &index)
Gets the value of a float node attr specified by node iterator NodeI and the attr index...
int GetDstNId() const
Gets the destination node of an edge.
TDirNet(TSIn &SIn)
Constructor that loads the network from a (binary) stream SIn.
TEdgeI & operator=(const TEdgeI &EdgeI)
bool IsNbrEId(const int &EId) const
Tests whether the edge with ID EId is an in or out-edge of current node.
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the network.
TVec< TVec< TIntV > > VecOfIntVecVecsN
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to NodeI.
int AddSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, const TStr &Val)
Adds Str sparse attribute with name AttrName to EdgeI.
void Reserve(const TSizeTy &_MxVals)
Reserves enough memory for the vector to store _MxVals elements.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from EdgeI.
TEdge(const int &EId, const int &SourceNId, const int &DestNId)
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
const TEdgeData & GetOutEDat(const int &EdgeN) const
int DelFromFltVAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Deletes value from the TFltV attribute for the given node.
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
int GetInEId(const int &EdgeN) const
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to NodeI.
void IntAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
int GetSAttrDatE(const TEdgeI &EdgeI, const TStr &AttrName, TFlt &ValX) const
Gets Flt sparse attribute with name AttrName from EdgeI.
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
void GetIntAttrNames(TStrV &Names) const
Gets vector of int attribute names.
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
TNodeI & operator=(const TNodeI &NodeI)
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
TAStrI(const TStrVecIter &HIter, TStr attribute, bool isEdgeIter, const TNEANet *GraphPt)
void Load(TSIn &SIn)
Load attribute from input stream.
TNodeEdgeNet< TInt, TInt > TIntNENet
static PNet Load(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
bool IsOk(const bool &ThrowExcept=true) const
Checks the network data structure for internal consistency.
int GetInNId(const int &NodeN) const
void DelNode(const TNode &NodeI)
Deletes node of ID NodeI.GetId() from the network.
bool IsOutNId(const int &NId) const
TDirNet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
TNodeData & GetNbrNDat(const int &NodeN)
int GetInDeg() const
Returns in-degree of the current node (returns same as value GetDeg() since the network is undirected...
Node iterator. Only forward iteration (operator++) is supported.
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TStr &ValX) const
Gets Str sparse attribute with name AttrName from NodeI.
int DelSAttrDatN(const TNodeI &NodeI, const TStr &AttrName)
Deletes sparse attribute with name AttrName from NodeI.
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TFlt &Val)
Adds Flt sparse attribute with name AttrName to NodeI.
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
bool IsKey(const TKey &Key) const
TIntV GetDat() const
Returns an attribute of the node.
static PDirNet Load(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
int AddAttributes(const int NId)
const TEdge & GetEdge(const int &EId) const
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
int GetSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, TInt &ValX) const
Gets Int sparse attribute with id AttrId from EdgeI.
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
void GetFltAttrNames(TStrV &Names) const
Gets vector of flt attribute names.
bool IsOk(const bool &ThrowExcept=true) const
Checks the network data structure for internal consistency.
static PNet LoadShM(TShMIn &ShMIn)
Static constructor that loads the network from memory.
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
TAIntVI & operator++(int)
TNodeI(const TNodeI &NodeI)
int GetSrcNId() const
Returns the source node of the edge.
TNodeData & GetOutNDat(const int &NodeN)
int DelAttrDatN(const TNodeI &NodeI, const TStr &attr)
Deletes the node attribute for NodeI.
int GetDeg() const
Returns degree of the current node, the sum of in-degree and out-degree.
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
void GetStrAttrNames(TStrV &Names) const
Gets vector of str attribute names.
TNEANet(bool copyAll, const TNEANet &Graph)
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 network.
TDat & AddDat(const TKey &Key)
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.
bool operator==(const TNodeI &NodeI) const
TEdgeDat & GetInEDat(const int &EdgeN)
int GetSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from NodeI.
TFltV GetFltVAttrDatN(const TNodeI &NodeI, const TStr &attr) const
Gets the value of the fltv attr from the node attr value vector.
void Save(TSOut &SOut) const
int GetSAttrVE(const TEdgeI &EdgeI, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for EdgeI.
Node/edge string attribute iterator. Iterates through all nodes/edges for one string attribute...
bool operator<(const TNodeI &NodeI) const
void SortNodeAdjV()
Sorts the adjacency lists of each node.
void GetAttrNames(TStrV &Names) const
Gets vector of attribute names.
Node iterator. Only forward iteration (operator++) is supported.
TAFltVI EndEAFltVI(const TStr &attr) const
Returns an iterator referring to the past-the-end edge's attribute.
int AddIntAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
void GetIntAttrVal(TIntV &Val) const
Gets vector of int attribute values.
int AddSAttrDatN(const TNodeI &NodeI, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to NodeI.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to EdgeI.
void GetIntVAttrVal(TVec< TIntV > &Val) const
Gets vector of int attribute values.
TAFltI(const TFltVecIter &HIter, TStr attribute, bool isEdgeIter, const TNEANet *GraphPt)
void Save(TSOut &SOut) const
TStr GetStrAttrIndDatN(const TNodeI &NodeI, const int &index)
Gets the value of a string node attr specified by node iterator NodeI and the attr index...
THash< TInt, TNode >::TIter THashIter
TEdgeI(const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
void GetIntAttrVal(TIntV &Val) const
Gets vector of int attribute values.
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
void SortNIdV()
Sorts the adjacency lists of the current node.
Node iterator. Only forward iteration (operator++) is supported.
int GetOutEId(const int &NodeN) const
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
static PNEANet New(const int &Nodes, const int &Edges)
Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and...
int GetRndEId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random edge in the network.
void Clr()
Clears the contents of the attribute map.
const TKey & GetKey(const int &KeyId) const
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TStr &Val)
Adds Str sparse attribute with id AttrId to NodeI.
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
THash< TInt, TNode >::TIter THashIter
Node Network (directed graph, TNGraph with data on nodes only).
int GetId() const
Returns ID of the current node.
int AddSAttrDatE(const TEdgeI &EdgeI, const TInt &AttrId, const TInt &Val)
Adds Int sparse attribute with id AttrId to EdgeI.
int GetDeg() const
Returns degree of the current node.
const TEdgeData & GetEDat(const int &EId) const
Returns edge data for the edge with ID EId.
TNodeEDatNet< TStr, TInt > TStrIntNEDNet
int GetId() const
Returns ID of the current node.
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
TUndirNet(TSIn &SIn)
Constructor that loads the network from a (binary) stream SIn.
const TEdgeData & GetNbrEDat(const int &EdgeN) const
int GetId() const
Returns ID of the current node.
const TNodeData & GetDstNDat() const
const TNodeData & GetDat() const
TNode(const int &NId, const TNodeData &NodeData)
int GetDstNId() const
Gets destination of an edge.
int AddSAttrDatN(const TNodeI &NodeI, const TInt &AttrId, const TFlt &Val)
Adds Flt sparse attribute with id AttrId to NodeI.
int GetNbrNId(const int &NodeN) const
void GetIntVAttrNames(TStrV &Names) const
Gets vector of int attribute names.
bool operator==(const TNodeI &NodeI) const
TPt< TDirNet > PDirNet
Pointer to a directed network (TDirNet)
static PNet Load(TSIn &SIn)
Static constructor that loads the network from a stream SIn and returns a pointer to it...
TFlt GetFltAttrIndDatE(const TEdgeI &EdgeI, const int &index)
Gets the value of a float edge attr specified by edge iterator EdgeI and the attr index...
TAFltVI(const TFltVVecIter &HIter, const TFltHVecIter &HHIter, TStr attribute, bool isEdgeIter, const TNEANet *GraphPt, bool is_dense)
TNodeEdgeNet(const int &Nodes, const int &Edges)
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
int GetNodes() const
Returns the number of nodes in the network.
TInt GetIntAttrIndDatE(const TEdgeI &EdgeI, const int &index)
Gets the value of an int edge attr specified by edge iterator EdgeI and the attr index.
TNodeI GetRndNI(TRnd &Rnd=TInt::Rnd)
Returns an interator referring to a random node in the network.
TIter GetI(const TKey &Key) const
void SortByDat(const bool &Asc=true)
TPt< TFltNENet > PFltNENet
Implements a single CrossNet consisting of edges between two TModeNets (could be the same TModeNet) ...
int GetMxNId() const
Returns an ID that is larger than any node ID in the network.
void Save_V1(TSOut &SOut) const
Saves the network to a (binary) stream SOut. Available for backwards compatibility.
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.