6 LoadTNodeFunctor NodeFn;
23 LoadVecFunctor vec_fn;
32 LoadVecOfVecFunctor vec_of_vec_fn;
36 LoadHashOfVecFunctor hash_of_vec_fn;
60 const TNode& Node = NodeHI.GetDat();
70 while (!NodeHI.
IsEnd()) {
80 while (!NodeHI.
IsEnd()) {
90 while (!NodeHI.
IsEnd()) {
100 while (!NodeHI.
IsEnd()) {
111 while (!NodeHI.
IsEnd()) {
121 while (!NodeHI.
IsEnd()) {
128 if (val.
Len() != 0) Values.
Add(val);
142 while (!NodeHI.
IsEnd()) {
152 while (!NodeHI.
IsEnd()) {
163 while (!NodeHI.
IsEnd()) {
173 while (!NodeHI.
IsEnd()) {
187 return IntDel || StrDel || FltDel || IntVDel;
211 return IntDel || StrDel || FltDel || IntVDel;
262 while (!EdgeHI.
IsEnd()) {
272 while (!EdgeHI.
IsEnd()) {
282 while (!EdgeHI.
IsEnd()) {
292 while (!EdgeHI.
IsEnd()) {
303 while (!EdgeHI.
IsEnd()) {
313 while (!EdgeHI.
IsEnd()) {
320 if (val.
Len() != 0) Values.
Add(val);
334 while (!EdgeHI.
IsEnd()) {
344 while (!EdgeHI.
IsEnd()) {
355 while (!EdgeHI.
IsEnd()) {
365 while (!EdgeHI.
IsEnd()) {
379 return IntDel || StrDel || FltDel || IntVDel;
403 return IntDel || StrDel || FltDel || IntVDel;
460 if (
IsNode(NId)) {
return -1;}
474 if (IntVec.
Len() > KeyId) {
482 for (i = 0; i < DefIntVec.
Len(); i++) {
483 TStr attr = DefIntVec[i];
490 if (StrVec.
Len() > KeyId) {
498 for (i = 0; i < DefStrVec.
Len(); i++) {
499 TStr attr = DefStrVec[i];
506 if (FltVec.
Len() > KeyId) {
514 for (i = 0; i < DefFltVec.
Len(); i++) {
515 TStr attr = DefFltVec[i];
522 if (IntVecV.
Len() > KeyId) {
523 IntVecV[KeyId] =
TIntV();
536 for (
int out = 0; out < Node.
GetOutDeg(); out++) {
566 for (
int in = 0; in < Node.
GetInDeg(); in++) {
637 if (IntVec.
Len() > KeyId) {
645 for (i = 0; i < DefIntVec.
Len(); i++) {
646 TStr attr = DefIntVec[i];
659 if (StrVec.
Len() > KeyId) {
667 for (i = 0; i < DefStrVec.
Len(); i++) {
668 TStr attr = DefStrVec[i];
676 if (FltVec.
Len() > KeyId) {
684 for (i = 0; i < DefFltVec.
Len(); i++) {
685 TStr attr = DefFltVec[i];
722 bool Edge =
IsEdge(SrcNId, DstNId, EId, IsDir);
726 Edge =
IsEdge(SrcNId, DstNId, EId, IsDir);
730 bool TNEANet::IsEdge(
const int& SrcNId,
const int& DstNId,
int& EId,
const bool& IsDir)
const {
788 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
793 if (e > 0 && prevEId == Node.
GetOutEId(e)) {
801 for (
int e = 0; e < Node.
GetInDeg(); e++) {
806 if (e > 0 && prevEId == Node.
GetInEId(e)) {
828 const int NodePlaces = (int) ceil(log10((
double)
GetNodes()));
829 const int EdgePlaces = (int) ceil(log10((
double)
GetEdges()));
830 fprintf(OutF,
"-------------------------------------------------\nDirected Node-Edge Network with Attributes: nodes: %d, edges: %d\n",
GetNodes(),
GetEdges());
832 fprintf(OutF,
" %*d:", NodePlaces, NodeI.GetId());
833 fprintf(OutF,
" in[%d]", NodeI.GetInDeg());
835 fprintf(OutF,
" %*d", EdgePlaces, NodeI.GetInEId(
edge)); }
837 fprintf(OutF,
" out[%d]", NodeI.GetOutDeg());
839 fprintf(OutF,
" %*d", EdgePlaces, NodeI.GetOutEId(
edge)); }
845 fprintf(OutF,
" nai[%d]", IntAttrN.
Len());
846 for (
int i = 0; i < IntAttrN.
Len(); i++) {
847 fprintf(OutF,
" %*i", NodePlaces, IntAttrN[i]()); }
852 fprintf(OutF,
" nas[%d]", StrAttrN.
Len());
853 for (
int i = 0; i < StrAttrN.
Len(); i++) {
854 fprintf(OutF,
" %*s", NodePlaces, StrAttrN[i]()); }
859 fprintf(OutF,
" naf[%d]", FltAttrN.
Len());
860 for (
int i = 0; i < FltAttrN.
Len(); i++) {
861 fprintf(OutF,
" %*f", NodePlaces, FltAttrN[i]()); }
866 fprintf(OutF,
" %*d: %*d -> %*d", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
871 fprintf(OutF,
" eai[%d]", IntAttrE.Len());
872 for (
int i = 0; i < IntAttrE.Len(); i++) {
873 fprintf(OutF,
" %*i", EdgePlaces, IntAttrE[i]());
877 fprintf(OutF,
" eas[%d]", StrAttrE.
Len());
878 for (
int i = 0; i < StrAttrE.
Len(); i++) {
879 fprintf(OutF,
" %*s", EdgePlaces, StrAttrE[i]());
883 fprintf(OutF,
" eaf[%d]", FltAttrE.
Len());
884 for (
int i = 0; i < FltAttrE.
Len(); i++) {
885 fprintf(OutF,
" %*f", EdgePlaces, FltAttrE[i]());
908 for (i = 0; i <
MxNId; i++) {
928 IAssertR(location != 0,
TStr::Fmt(
"NodeId %d exists for %s in sparse representation", NId, attr.
CStr()));
932 IAssertR(location != 1,
TStr::Fmt(
"NodeId %d exists for %s in dense representation", NId, attr.
CStr()));
951 IAssertR(location != 0,
TStr::Fmt(
"NodeId %d exists for %s in sparse representation", NId, attr.
CStr()));
955 IAssertR(location != 1,
TStr::Fmt(
"NodeId %d exists for %s in dense representation", NId, attr.
CStr()));
969 if (location != -1) {
1001 for (i = 0; i <
MxNId; i++) {
1025 for (i = 0; i <
MxNId; i++) {
1048 for (i = 0; i <
MxEId; i++) {
1068 IAssertR(location != 0,
TStr::Fmt(
"EdgeID %d exists for %s in sparse representation", EId, attr.
CStr()));
1072 IAssertR(location != 1,
TStr::Fmt(
"NodeId %d exists for %s in dense representation", EId, attr.
CStr()));
1085 if (location==-1)
return -1;
1087 IAssertR(location != 0,
TStr::Fmt(
"Edge %d exists for %s in sparse representation", EId, attr.
CStr()));
1091 IAssertR(location != 1,
TStr::Fmt(
"Edge %d exists for %s in dense representation", EId, attr.
CStr()));
1112 for (i = 0; i <
MxEId; i++) {
1136 for (i = 0; i <
MxEId; i++) {
1233 }
else if (vecType ==
StrType) {
1235 }
else if (vecType ==
FltType) {
1252 }
else if (vecType ==
StrType) {
1254 }
else if (vecType ==
FltType) {
1273 for (i = 0; i <
MxNId; i++) {
1274 NewVec.
Ins(i, defaultValue);
1310 for (i = 0; i <
MxNId; i++) {
1311 NewVec.
Ins(i, defaultValue);
1330 for (i = 0; i <
MxNId; i++) {
1331 NewVec.
Ins(i, defaultValue);
1350 for (i = 0; i <
MxEId; i++) {
1351 NewVec.
Ins(i, defaultValue);
1387 for (i = 0; i <
MxEId; i++) {
1388 NewVec.
Ins(i, defaultValue);
1406 for (i = 0; i <
MxEId; i++) {
1407 NewVec.
Ins(i, defaultValue);
1425 }
else if (vecType ==
StrType) {
1430 }
else if (vecType ==
FltType) {
1454 }
else if (vecType ==
StrType) {
1459 }
else if (vecType ==
FltType) {
1474 for (
int i = 0; i < 5; i++) { Net->AddNode(i); }
1475 Net->AddEdge(0,1); Net->AddEdge(0,2);
1476 Net->AddEdge(0,3); Net->AddEdge(0,4);
1477 Net->AddEdge(1,2); Net->AddEdge(1,2);
1483 if (it.GetDat().GetVal1() ==
IntType) {
1484 IntAttrNames.
Add(it.GetKey());
1486 if (it.GetDat().GetVal1() ==
FltType) {
1487 FltAttrNames.
Add(it.GetKey());
1489 if (it.GetDat().GetVal1() ==
StrType) {
1490 StrAttrNames.
Add(it.GetKey());
1497 if (it.GetDat().GetVal1() ==
IntType) {
1498 IntAttrNames.
Add(it.GetKey());
1500 if (it.GetDat().GetVal1() ==
FltType) {
1501 FltAttrNames.
Add(it.GetKey());
1503 if (it.GetDat().GetVal1() ==
StrType) {
1504 StrAttrNames.
Add(it.GetKey());
1514 for (
int i = 0; i < len; i++) {
1522 int EId = it.GetId();
1523 int SrcId = it.GetSrcNId();
1817 if (
IsNode(NId)) {
return -1;}
1836 Node.
NIdV = NbrNIdV;
1839 for (
int i = 0; i < NbrNIdV.
Len(); i++) {
1840 GetNode(NbrNIdV[i]).NIdV.AddSorted(NewNId);
1870 for (
int e = 0; e < Node.
GetDeg(); e++) {
1872 if (nbr == NId) {
continue; }
1876 if (n!= -1) { N.
NIdV.
Del(n); }
1893 if (
IsEdge(SrcNId, DstNId)) {
return -2; }
1894 GetNode(SrcNId).NIdV.AddSorted(DstNId);
1895 if (SrcNId!=DstNId) {
1896 GetNode(DstNId).NIdV.AddSorted(SrcNId); }
1903 GetNode(SrcNId).NIdV.Add(DstNId);
1904 if (SrcNId!=DstNId) {
1905 GetNode(DstNId).NIdV.Add(SrcNId); }
1915 TIntPr Id(SrcNId, DstNId);
1917 if (n!= -1) { N.
NIdV.
Del(n); NEdges--; } }
1918 if (SrcNId != DstNId) {
1921 if (n!= -1) { N.
NIdV.
Del(n); }
1927 if (!
IsNode(SrcNId) || !
IsNode(DstNId))
return false;
1928 return GetNode(SrcNId).IsNbrNId(DstNId);
1933 const int MnNId =
TMath::Mn(SrcNId, DstNId);
1936 const int NodeN = SrcNI.
NodeHI.GetDat().NIdV.SearchBin(MxNId);
1970 for (
int e = 0; e < Node.
GetDeg(); e++) {
1972 const TStr Msg =
TStr::Fmt(
"Edge %d --> %d: node %d does not exist.",
1977 if (e > 0 && prevNId == Node.
GetNbrNId(e)) {
1978 const TStr Msg =
TStr::Fmt(
"Node %d has duplicate edge %d --> %d.",
1989 const TStr Msg =
TStr::Fmt(
"Number of edges counter is corrupted: GetEdges():%d, EdgeCount:%d.",
GetEdges(), EdgeCnt);
1998 const int NodePlaces = (int) ceil(log10((
double)
GetNodes()));
1999 fprintf(OutF,
"-------------------------------------------------\nUndirected Node Graph: nodes: %d, edges: %d\n",
GetNodes(),
GetEdges());
2002 fprintf(OutF,
" %*d [%d] ", NodePlaces, Node.
GetId(), Node.
GetDeg());
2005 fprintf(OutF,
"\n");
2007 fprintf(OutF,
"\n");
2013 for (
int i = 0; i < 5; i++) { Graph->AddNode(i); }
2014 Graph->AddEdge(0,1); Graph->AddEdge(0,2);
2015 Graph->AddEdge(0,3); Graph->AddEdge(0,4);
2016 Graph->AddEdge(1,2);
2147 if (SrcNId < DstNId) {
2148 return TIntPr(SrcNId, DstNId);
2150 return TIntPr(DstNId, SrcNId);
2154 if (!
IsEdge(SrcNId, DstNId)) {
2157 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2162 if (!
IsEdge(SrcNId, DstNId)) {
2165 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2170 if (!
IsEdge(SrcNId, DstNId)) {
2173 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2178 if (!
IsEdge(SrcNId, DstNId)) {
2181 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2186 if (!
IsEdge(SrcNId, DstNId)) {
2189 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2194 if (!
IsEdge(SrcNId, DstNId)) {
2197 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2202 if (!
IsEdge(SrcNId, DstNId)) {
2205 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2210 if (!
IsEdge(SrcNId, DstNId)) {
2213 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2218 if (!
IsEdge(SrcNId, DstNId)) {
2221 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2226 if (!
IsEdge(SrcNId, DstNId)) {
2229 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2234 if (!
IsEdge(SrcNId, DstNId)) {
2237 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2242 if (!
IsEdge(SrcNId, DstNId)) {
2245 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2250 if (!
IsEdge(SrcNId, DstNId)) {
2253 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2258 if (!
IsEdge(SrcNId, DstNId)) {
2261 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2266 if (!
IsEdge(SrcNId, DstNId)) {
2269 TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2315 if (
IsNode(NId)) {
return -1;}
2366 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
2368 if (nbr == NId) {
continue; }
2373 for (
int e = 0; e < Node.
GetInDeg(); e++) {
2375 if (nbr == NId) {
continue; }
2386 edges+=
NodeH[N].GetOutDeg();
2394 if (
IsEdge(SrcNId, DstNId)) {
return -2; }
2395 GetNode(SrcNId).OutNIdV.AddSorted(DstNId);
2396 GetNode(DstNId).InNIdV.AddSorted(SrcNId);
2401 GetNode(SrcNId).OutNIdV.Add(DstNId);
2402 GetNode(DstNId).InNIdV.Add(SrcNId);
2409 TIntPr Id(SrcNId, DstNId);
2427 if (!
IsNode(SrcNId) || !
IsNode(DstNId)) {
return false; }
2428 if (IsDir) {
return GetNode(SrcNId).IsOutNId(DstNId); }
2429 else {
return GetNode(SrcNId).IsOutNId(DstNId) ||
GetNode(DstNId).IsOutNId(SrcNId); }
2434 const int NodeN = SrcNI.
NodeHI.GetDat().OutNIdV.SearchBin(DstNId);
2459 const TStr Msg =
TStr::Fmt(
"Out-neighbor list of node %d is not sorted.", Node.
GetId());
2463 const TStr Msg =
TStr::Fmt(
"In-neighbor list of node %d is not sorted.", Node.
GetId());
2468 for (
int e = 0; e < Node.
GetOutDeg(); e++) {
2470 const TStr Msg =
TStr::Fmt(
"Out-edge %d --> %d: node %d does not exist.",
2474 if (e > 0 && prevNId == Node.
GetOutNId(e)) {
2475 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate out-edge %d --> %d.",
2483 for (
int e = 0; e < Node.
GetInDeg(); e++) {
2485 const TStr Msg =
TStr::Fmt(
"In-edge %d <-- %d: node %d does not exist.",
2489 if (e > 0 && prevNId == Node.
GetInNId(e)) {
2490 const TStr Msg =
TStr::Fmt(
"Node %d has duplidate in-edge %d <-- %d.",
2501 const int NodePlaces = (int) ceil(log10((
double)
GetNodes()));
2502 fprintf(OutF,
"-------------------------------------------------\nDirected Node Graph: nodes: %d, edges: %d\n",
GetNodes(),
GetEdges());
2505 fprintf(OutF,
" %*d]\n", NodePlaces, Node.
GetId());
2506 fprintf(OutF,
" in [%d]", Node.
GetInDeg());
2508 fprintf(OutF,
" %*d", NodePlaces, Node.
GetInNId(
edge)); }
2509 fprintf(OutF,
"\n out[%d]", Node.
GetOutDeg());
2512 fprintf(OutF,
"\n");
2514 fprintf(OutF,
"\n");
2519 for (
int i = 0; i < 5; i++) { G->AddNode(i); }
2520 G->AddEdge(0,1); G->AddEdge(1,2); G->AddEdge(0,2);
2521 G->AddEdge(1,3); G->AddEdge(3,4); G->AddEdge(2,3);
2652 if (!
IsEdge(SrcNId, DstNId)) {
2655 TIntPr EId(SrcNId, DstNId);
2660 if (!
IsEdge(SrcNId, DstNId)) {
2663 TIntPr EId(SrcNId, DstNId);
2668 if (!
IsEdge(SrcNId, DstNId)) {
2671 TIntPr EId(SrcNId, DstNId);
2676 if (!
IsEdge(SrcNId, DstNId)) {
2679 TIntPr EId(SrcNId, DstNId);
2684 if (!
IsEdge(SrcNId, DstNId)) {
2687 TIntPr EId(SrcNId, DstNId);
2692 if (!
IsEdge(SrcNId, DstNId)) {
2695 TIntPr EId(SrcNId, DstNId);
2700 if (!
IsEdge(SrcNId, DstNId)) {
2703 TIntPr EId(SrcNId, DstNId);
2708 if (!
IsEdge(SrcNId, DstNId)) {
2711 TIntPr EId(SrcNId, DstNId);
2716 if (!
IsEdge(SrcNId, DstNId)) {
2719 TIntPr EId(SrcNId, DstNId);
2724 if (!
IsEdge(SrcNId, DstNId)) {
2727 TIntPr EId(SrcNId, DstNId);
2732 if (!
IsEdge(SrcNId, DstNId)) {
2735 TIntPr EId(SrcNId, DstNId);
2740 if (!
IsEdge(SrcNId, DstNId)) {
2743 TIntPr EId(SrcNId, DstNId);
2748 if (!
IsEdge(SrcNId, DstNId)) {
2751 TIntPr EId(SrcNId, DstNId);
2756 if (!
IsEdge(SrcNId, DstNId)) {
2759 TIntPr EId(SrcNId, DstNId);
2764 if (!
IsEdge(SrcNId, DstNId)) {
2767 TIntPr EId(SrcNId, DstNId);
bool IsOk(const bool &ThrowExcept=true) const
Checks the network data structure for internal consistency.
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the graph.
TVec< TIntV > VecOfIntVecsN
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.
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
static const T & Mn(const T &LVal, const T &RVal)
THash< TStr, TBool > KeyToDenseE
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the network.
TPair< TInt, TInt > TIntPr
void IntVAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
TInt GetIntAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of int attr from the node attr value vector.
int GetAttrIndE(const TStr &attr)
Gets the index of the edge attr value vector specified by attr.
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
int GetEdges() const
Returns the number of edges in the network.
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
int GetSAttrIdE(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
static PUndirNet New()
Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New()...
void GetAttrENames(TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const
Fills each of the vectors with the names of edge attributes of the given type.
int GetNodes() const
Returns the number of nodes in the network.
bool IsKeyIdEqKeyN() const
int GetSAttrIdN(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
int GetSAttrVN(const TInt &NId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for node with id NId.
int GetSAttrIdE(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
#define IAssertR(Cond, Reason)
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 AddIntVAttrN(const TStr &attr, TBool UseDense=true)
Adds a new IntV node attribute to the hashmap.
int AppendIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
int AddFltAttrDatE(const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns edge attribute value, converted to Str type.
enum TAttrType_ TAttrType
Types for tables, sparse and dense attributes.
int GetSAttrIdN(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
TVec< TStrV > VecOfStrVecsE
THash< TStr, TInt > IntDefaultsE
int GetIntAttrIndN(const TStr &attr)
Gets the index of the node attr value vector specified by attr (same as GetAttrIndN for compatibility...
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node str attr iterator.
TFlt GetWeightOutEdges(const TNodeI &NI, const TStr &attr)
Gets the sum of the weights of all the outgoing edges of the node.
int DelAttrN(const TStr &attr)
Removes all the values for node attr.
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the network.
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
bool IsStrAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Str attr exists for node NId and has default value.
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
Edge iterator. Only forward iteration (operator++) is supported.
int GetIdVSAttrN(const TStr &AttrName, TIntV &IdV) const
Gets a list of all nodes that have a sparse attribute with name AttrName.
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 GetOutNId(const int &NodeN) const
int GetSAttrNameE(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
int GetSAttrVE(const TInt &EId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for edge with id EId.
int GetSAttrNameE(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
TNode & GetNode(const int &NId)
void StrAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of str attr names for node NId.
int AddSAttrDatE(const TInt &EId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with id EId.
void FltAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
void DelNode(const int &NId)
Deletes node of ID NId from the network.
void IntVAttrValueEI(const TInt &EId, TVec< TIntV > &Values) const
Returns a vector of attr values for edge EId.
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt attr iterator.
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
TInt CheckDenseOrSparseE(const TStr &attr) const
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
int AddIntVAttrDatE(const TEdgeI &EdgeI, const TIntV &value, const TStr &attr)
Attribute based add function for attr to IntV value.
bool IsAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if attr exists for edge EId and has default value.
bool IsFltAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Flt attr exists for edge NId and has default value.
TSizeTy Len() const
Returns the number of elements in the vector.
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int attr iterator.
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name.
int DelAttrE(const TStr &attr)
Removes all the values for edge attr.
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
int GetSAttrNameN(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
TIntV GetIntVAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of the intv attr from the edge attr value vector.
void GenExt(TVal *_ValT, const TSizeTy &_Vals)
Constructs a vector of _Vals elements of memory array _ValT.
TStrIntPrH KeyToIndexTypeE
TStr GetStrAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of str attr from the edge attr value vector.
int GetNbrNId(const int &NodeN) const
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Node iterator. Only forward iteration (operator++) is supported.
void DelEdge(const int &EId)
Deletes an edge with edge ID EId from the graph.
THash< TStr, TFlt > FltDefaultsN
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
static PUndirNet GetSmallGraph()
Returns a small network on 5 nodes and 5 edges.
int AddIntAttrDatE(const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
const TDat & GetDat(const TKey &Key) const
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.
void AttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
TVec< TIntV > VecOfIntVecsE
void IntAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
bool NodeAttrIsIntVDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int vector attr iterator. ...
virtual void DelNode(const int &NId)
Deletes node of ID NId from the graph.
int GetSAttrNameN(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
const TKey & GetKey() 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)
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
TVec< TStrV > VecOfStrVecsN
bool IsIntAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Int attr exists for edge EId and has default value.
void GetEIdV(TIntV &EIdV) const
Gets a vector IDs of all edges in the graph.
void Dump(FILE *OutF=stdout) const
Print the graph in a human readable form to an output stream OutF.
bool IsFltAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Flt attr exists for node NId and has default value.
int AddFltAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node flt attr iterator.
void IntVAttrValueNI(const TInt &NId, TVec< TIntV > &Values) const
Returns a vector of attr values for node NId.
THash< TInt, TEdge > EdgeH
void GetAttrNNames(TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const
Fills each of the vectors with the names of node attributes of the given type.
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.
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
int GetAttrIndN(const TStr &attr)
Gets the index of the node attr value vector specified by attr.
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...
void DelEdge(const int &SrcNId, const int &DstNId)
Deletes an edge between node IDs SrcNId and DstNId from the network.
bool IsStrAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Str attr exists for edge NId and has default value.
void DelKey(const TKey &Key)
int GetId() const
Returns ID of the current node.
int GetSAttrVN(const TInt &NId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for node with id NId.
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
int AddSAttrE(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
TVec< TFltV > VecOfFltVecsE
int GetFltKeyIdE(const int &EId)
Gets keyid for edge with id EId.
int AddNodeUnchecked(int NId=-1)
Adds a node of ID NId to the network, noop if the node already exists.
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
const TDat & GetDat() const
TInt GetIntAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of int attr from the edge attr value vector.
int AddStrAttrDatN(const TNodeI &NodeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
TVal * GetValVPt(const int &VId) const
Returns pointer to the first element of the vector with id VId.
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
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). ...
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
int GetSAttrIdE(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
int GetVLen(const int &VId) const
Returns the number of elements in the vector with id VId.
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the graph (see the TGraphFlag for flags).
int AddIntAttrN(const TStr &attr, TInt defaultValue=TInt::Mn)
Adds a new Int node attribute to the hashmap.
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
int AddEdge(const int &SrcNId, const int &DstNId, int EId=-1)
Adds an edge with ID EId between node IDs SrcNId and DstNId to the graph.
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
bool FNextKeyId(int &KeyId) const
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
THash< TStr, TStr > StrDefaultsN
void AttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of attr names for node NId.
int GetIdVSAttrE(const TStr &AttrName, TIntPrV &IdV) const
Gets a list of all edges that have a sparse attribute with name AttrName.
int AddStrAttrE(const TStr &attr, TStr defaultValue=TStr::GetNullStr())
Adds a new Str edge attribute to the hashmap.
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.
bool IsOk(const bool &ThrowExcept=true) const
Checks the graph data structure for internal consistency.
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 IsOk(const bool &ThrowExcept=true) const
Checks the network data structure for internal consistency.
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
int GetSAttrNameN(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
void DelEdge(const int &SrcNId, const int &DstNId, const bool &IsDir=true)
Deletes an edge from node IDs SrcNId to DstNId from the network.
bool HasFlag(const TGraphFlag &Flag) const
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
void DelNode(const int &NId)
Deletes node of ID NId from the network.
TStr GetNodeAttrValue(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns node attribute value, converted to Str type.
TVec< TVec< TIntV > > VecOfIntVecVecsE
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
void AttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for edge EId.
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
void GetNIdV(TIntV &NIdV) const
Gets a vector IDs of all nodes in the network.
Directed multigraph with node edge attributes.
void LoadNetworkShM(TShMIn &ShMIn)
load network from shared memory for this network
TSizeTy SearchBin(const TVal &Val) const
Returns the position of an element with value Val.
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge between node IDs SrcNId and DstNId to the network.
void GetSAttrV(const TInt &Id, const TAttrType AttrType, TAttrPrV &AttrV) const
Get a list of all attributes of type AttrType for the given id Id.
bool IsIntAttrE(const TStr &attr)
Checks if there is an edge attribute with name attr.
static PNEANet GetSmallGraph()
Returns a small multigraph on 5 nodes and 6 edges.
bool IsIntVAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if IntV attr exists for edge EId and is an empty vector.
int AddSAttrN(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
int AddSAttrE(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
TEdge & GetEdge(const int &EId)
void Dump(FILE *OutF=stdout) const
Print the network in a human readable form to an output stream OutF.
bool IsFltAttrE(const TStr &attr)
Checks if there is an edge attribute with name attr.
int GetKeyId(const TKey &Key) const
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.
bool EdgeAttrIsIntVDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int vector attr iterator.
int AddStrAttrN(const TStr &attr, TStr defaultValue=TStr::GetNullStr())
Adds a new Str node attribute to the hashmap.
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
bool IsIntAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Int attr exists for node NId and has default value.
Edge iterator. Only forward iteration (operator++) is supported.
int DelAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Deletes the edge attribute for NodeI.
int AddIntVAttrE(const TStr &attr, TBool UseDense=true)
Adds a new IntV edge attribute to the hashmap.
void FltAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for node NId.
int DelSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId.
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge from node SrcNId to node DstNId to the network.
THash< TStr, TStr > StrDefaultsE
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.
int GetEdges() const
Returns the number of edges in the graph.
void GetKeyV(TVec< TKey > &KeyV) const
int GetSAttrIdN(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Gets id and type for attribute with name Name.
int GetOutEId(const int &EdgeN) const
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge str attr iterator.
int GetEdges() const
Returns the number of edges in the network.
int AddStrAttrDatE(const TEdgeI &EdgeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
static TStr Fmt(const char *FmtStr,...)
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.
enum TGraphFlag_ TGraphFlag
Graph Flags, used for quick testing of graph types.
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the network.
void GetWeightOutEdgesV(TFltV &OutWeights, const TFltV &AttrVal)
Fills OutWeights with the outgoing weight from each node.
int GetIdVSAttrN(const TStr &AttrName, TIntV &IdV) const
Gets a list of all nodes that have a sparse attribute with name AttrName.
bool IsAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if attr exists for node NId and has default value.
TVec< TFltV > VecOfFltVecsN
int GetSAttrVE(const int &SrcNId, const int &DstNId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for edge with ids SrcId and DstId...
#define EAssertR(Cond, MsgStr)
int AddSAttrE(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
int GetSAttrNameE(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Gets name and type for attribute with id AttrId.
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
TVec< TFlt > & GetFltAttrVecE(const TStr &attr)
Gets Vector for the Flt Attribute attr.
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id.
THash< TStr, TInt > IntDefaultsN
#define AssertR(Cond, Reason)
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int attr iterator.
bool IsIntVAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if IntV attr exists for node NId and is an empty vector.
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.
static PDirNet New()
Static constructor that returns a pointer to the network. Call: PDirNet Graph = TDirNet::New().
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
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...
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
TVec< TVec< TIntV > > VecOfIntVecVecsN
int AddIntAttrE(const TStr &attr, TInt defaultValue=TInt::Mn)
Adds a new Int edge attribute to the hashmap.
void Dump(FILE *OutF=stdout) const
Print the network in a human readable form to an output stream OutF.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
int GetInEId(const int &EdgeN) const
int GetIdVSAttrE(const TStr &AttrName, TIntPrV &IdV) const
Gets a list of all edges that have a sparse attribute with name AttrName.
void IntAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
int GetIdVSAttrE(const TStr &AttrName, TIntV &IdV) const
Gets a list of all edges that have a sparse attribute with name AttrName.
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
void Load(TSIn &SIn)
Load attribute from input stream.
int GetInNId(const int &NodeN) const
bool IsKey(const TKey &Key) const
int AddAttributes(const int NId)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
int GetSAttrVN(const TInt &NId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for node with id NId.
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
int DelSAttrDatE(const TInt &EId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with id EId.
int GetSAttrVE(const int &SrcNId, const int &DstNId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for edge with ids SrcId and DstId...
int GetIdVSAttrN(const TStr &AttrName, TIntV &IdV) const
Gets a list of all nodes that have a sparse attribute with name AttrName.
TEdgeI GetEI(const int &EId) const
Not supported/implemented!
int DelSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId.
bool IsStrAttrE(const TStr &attr)
Checks if there is an edge attribute with name attr.
int AddEdgeUnchecked(const int &SrcNId, const int &DstNId)
Adds an edge between node IDs SrcNId and DstNId to the network.
int DelAttrDatN(const TNodeI &NodeI, const TStr &attr)
Deletes the node attribute for NodeI.
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
TDat & AddDat(const TKey &Key)
static PDirNet GetSmallGraph()
Returns a small network on 5 nodes and 6 edges.
int AddIntAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
TEdgeI GetEI(const int &EId) const
Not supported/implemented!
int GetIntAttrIndE(const TStr &attr)
Gets the index of the edge attr value vector specified by attr (same as GetAttrIndE for compatibility...
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...
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
int AddEdgeUnchecked(const int &SrcNId, const int &DstNId)
Adds an edge from node SrcNId to node DstNId to the network.
Node iterator. Only forward iteration (operator++) is supported.
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
const TKey & GetKey(const int &KeyId) const
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
void Defrag(const bool &OnlyNodeLinks=false)
Defragments the graph.
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
int AddFltAttrE(const TStr &attr, TFlt defaultValue=TFlt::Mn)
Adds a new Flt edge attribute to the hashmap.
int AddSAttrN(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
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...
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.
int AddSAttrN(const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
Adds mapping for sparse attribute with name Name and type AttrType.
TIter GetI(const TKey &Key) const
int AddFltAttrN(const TStr &attr, TFlt defaultValue=TFlt::Mn)
Adds a new Flt node attribute to the hashmap.