SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TNEANet Class Reference

Directed multigraph with node edge attributes. More...

#include <network.h>

Inherited by TModeNet.

Classes

class  LoadHashOfVecFunctor
 
class  LoadTNodeFunctor
 
class  LoadVecFunctor
 
class  LoadVecOfVecFunctor
 
class  TAFltI
 Node/edge float attribute iterator. Iterates through all nodes/edges for one float attribute. More...
 
class  TAFltVI
 
class  TAIntI
 Node/edge integer attribute iterator. Iterates through all nodes/edges for one integer attribute. More...
 
class  TAIntVI
 
class  TAStrI
 Node/edge string attribute iterator. Iterates through all nodes/edges for one string attribute. More...
 
class  TEdge
 
class  TEdgeI
 Edge iterator. Only forward iteration (operator++) is supported. More...
 
class  TNode
 
class  TNodeI
 Node iterator. Only forward iteration (operator++) is supported. More...
 

Public Types

typedef TNEANet TNet
 
typedef TPt< TNEANetPNet
 

Public Member Functions

 TNEANet ()
 
 TNEANet (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a graph of nodes and edges. More...
 
 TNEANet (const TNEANet &Graph)
 
 TNEANet (TSIn &SIn)
 Constructor for loading the graph from a (binary) stream SIn. More...
 
void Save (TSOut &SOut) const
 Saves the graph to a (binary) stream SOut. Expects data structures for sparse attributes. More...
 
void Save_V1 (TSOut &SOut) const
 Saves the graph to a (binary) stream SOut. Available for backwards compatibility. More...
 
void Save_V2 (TSOut &SOut) const
 Saves the graph without any sparse data structures. Available for backwards compatibility. More...
 
void LoadNetworkShM (TShMIn &ShMIn)
 load network from shared memory for this network More...
 
void ConvertToSparse ()
 
bool HasFlag (const TGraphFlag &Flag) const
 Allows for run-time checking the type of the graph (see the TGraphFlag for flags). More...
 
TNEANetoperator= (const TNEANet &Graph)
 
int GetNodes () const
 Returns the number of nodes in the network. More...
 
int AddNode (int NId=-1)
 Adds a node of ID NId to the network. More...
 
int AddNodeUnchecked (int NId=-1)
 Adds a node of ID NId to the network, noop if the node already exists. More...
 
int AddNode (const TNodeI &NodeI)
 Adds a node of ID NodeI.GetId() to the graph. More...
 
virtual void DelNode (const int &NId)
 Deletes node of ID NId from the graph. More...
 
void DelNode (const TNode &NodeI)
 Deletes node of ID NodeI.GetId() from the graph. More...
 
bool IsNode (const int &NId) const
 Tests whether ID NId is a node. More...
 
TNodeI BegNI () const
 Returns an iterator referring to the first node in the graph. More...
 
TNodeI EndNI () const
 Returns an iterator referring to the past-the-end node in the graph. More...
 
TNodeI GetNI (const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAIntI BegNAIntI (const TStr &attr) const
 Returns an iterator referring to the first node's int attribute. More...
 
TAIntI EndNAIntI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAIntI GetNAIntI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAIntVI BegNAIntVI (const TStr &attr) const
 Returns an iterator referring to the first node's int attribute. More...
 
TAIntVI EndNAIntVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAIntVI GetNAIntVI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAFltVI BegNAFltVI (const TStr &attr) const
 Returns an iterator referring to the first node's flt attribute. More...
 
TAFltVI EndNAFltVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAFltVI GetNAFltVI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAStrI BegNAStrI (const TStr &attr) const
 Returns an iterator referring to the first node's str attribute. More...
 
TAStrI EndNAStrI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAStrI GetNAStrI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAFltI BegNAFltI (const TStr &attr) const
 Returns an iterator referring to the first node's flt attribute. More...
 
TAFltI EndNAFltI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAFltI GetNAFltI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
void AttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of attr names for node NId. More...
 
void AttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void AttrValueNI (const TInt &NId, TStrV &Values) const
 Returns a vector of attr values for node NId. More...
 
void AttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Values) const
 
void IntAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void IntAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void IntAttrValueNI (const TInt &NId, TIntV &Values) const
 Returns a vector of attr values for node NId. More...
 
void IntAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TIntV &Values) const
 
void IntVAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void IntVAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void IntVAttrValueNI (const TInt &NId, TVec< TIntV > &Values) const
 Returns a vector of attr values for node NId. More...
 
void IntVAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TVec< TIntV > &Values) const
 
void FltVAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of flt attr names for node NId. More...
 
void FltVAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void FltVAttrValueNI (const TInt &NId, TVec< TFltV > &Values) const
 Returns a vector of flt values for node NId. More...
 
void FltVAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TVec< TFltV > &Values) const
 
void StrAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of str attr names for node NId. More...
 
void StrAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void StrAttrValueNI (const TInt &NId, TStrV &Values) const
 Returns a vector of attr values for node NId. More...
 
void StrAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Values) const
 
void FltAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void FltAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void FltAttrValueNI (const TInt &NId, TFltV &Values) const
 Returns a vector of attr values for node NId. More...
 
void FltAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TFltV &Values) const
 
void AttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of attr names for edge EId. More...
 
void AttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void AttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr values for edge EId. More...
 
void AttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Values) const
 
void IntAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for edge EId. More...
 
void IntAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void IntAttrValueEI (const TInt &EId, TIntV &Values) const
 Returns a vector of attr values for edge EId. More...
 
void IntAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TIntV &Values) const
 
void IntVAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for edge EId. More...
 
void IntVAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void IntVAttrValueEI (const TInt &EId, TVec< TIntV > &Values) const
 Returns a vector of attr values for edge EId. More...
 
void IntVAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TVec< TIntV > &Values) const
 
void FltVAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of flt attr names for edge EId. More...
 
void FltVAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void FltVAttrValueEI (const TInt &EId, TVec< TFltV > &Values) const
 Returns a vector of attr values for edge EId. More...
 
void FltVAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TVec< TFltV > &Values) const
 
void StrAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of str attr names for node NId. More...
 
void StrAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void StrAttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr values for node NId. More...
 
void StrAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Values) const
 
void FltAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void FltAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void FltAttrValueEI (const TInt &EId, TFltV &Values) const
 Returns a vector of attr values for node NId. More...
 
void FltAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TFltV &Values) const
 
TAIntI BegEAIntI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAIntI EndEAIntI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAIntI GetEAIntI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAIntVI BegEAIntVI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAIntVI EndEAIntVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAIntVI GetEAIntVI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAFltVI BegEAFltVI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAFltVI EndEAFltVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAFltVI GetEAFltVI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAStrI BegEAStrI (const TStr &attr) const
 Returns an iterator referring to the first edge's str attribute. More...
 
TAStrI EndEAStrI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAStrI GetEAStrI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAFltI BegEAFltI (const TStr &attr) const
 Returns an iterator referring to the first edge's flt attribute. More...
 
TAFltI EndEAFltI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAFltI GetEAFltI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
int GetMxNId () const
 Returns an ID that is larger than any node ID in the network. More...
 
int GetMxEId () const
 Returns an ID that is larger than any edge ID in the network. More...
 
int GetEdges () const
 Returns the number of edges in the graph. More...
 
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. More...
 
int AddEdge (const TEdgeI &EdgeI)
 Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph. More...
 
void DelEdge (const int &EId)
 Deletes an edge with edge ID EId from the graph. More...
 
void DelEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true)
 Deletes all edges between node IDs SrcNId and DstNId from the graph. More...
 
bool IsEdge (const int &EId) const
 Tests whether an edge with edge ID EId exists in the graph. More...
 
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. More...
 
bool IsEdge (const int &SrcNId, const int &DstNId, int &EId, const bool &IsDir=true) const
 Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. if an edge exists, return its edge ID in EId. More...
 
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. More...
 
TEdgeI BegEI () const
 Returns an iterator referring to the first edge in the graph. More...
 
TEdgeI EndEI () const
 Returns an iterator referring to the past-the-end edge in the graph. More...
 
TEdgeI GetEI (const int &EId) const
 Returns an iterator referring to edge with edge ID EId. More...
 
TEdgeI GetEI (const int &SrcNId, const int &DstNId) const
 Returns an iterator referring to edge (SrcNId, DstNId) in the graph. More...
 
int GetRndNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random node in the graph. More...
 
TNodeI GetRndNI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random node in the graph. More...
 
int GetRndEId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random edge in the graph. More...
 
TEdgeI GetRndEI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random edge in the graph. More...
 
void GetNIdV (TIntV &NIdV) const
 Gets a vector IDs of all nodes in the graph. More...
 
void GetEIdV (TIntV &EIdV) const
 Gets a vector IDs of all edges in the graph. More...
 
bool Empty () const
 Tests whether the graph is empty (has zero nodes). More...
 
void Clr ()
 Deletes all nodes and edges from the graph. More...
 
void Reserve (const int &Nodes, const int &Edges)
 Reserves memory for a graph of Nodes nodes and Edges edges. More...
 
void Defrag (const bool &OnlyNodeLinks=false)
 Defragments the graph. More...
 
bool IsOk (const bool &ThrowExcept=true) const
 Checks the graph data structure for internal consistency. More...
 
void Dump (FILE *OutF=stdout) const
 Print the graph in a human readable form to an output stream OutF. More...
 
int AddIntAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr)
 Attribute based add function for attr to Int value. More...
 
int AddIntAttrDatN (const int &NId, const TInt &value, const TStr &attr)
 
int AddStrAttrDatN (const TNodeI &NodeI, const TStr &value, const TStr &attr)
 Attribute based add function for attr to Str value. More...
 
int AddStrAttrDatN (const int &NId, const TStr &value, const TStr &attr)
 
int AddFltAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr)
 Attribute based add function for attr to Flt value. More...
 
int AddFltAttrDatN (const int &NId, const TFlt &value, const TStr &attr)
 
int AddIntVAttrDatN (const TNodeI &NodeI, const TIntV &value, const TStr &attr)
 Attribute based add function for attr to IntV value. More...
 
int AddIntVAttrDatN (const int &NId, const TIntV &value, const TStr &attr, TBool UseDense=true)
 
int AddFltVAttrDatN (const TNodeI &NodeI, const TFltV &value, const TStr &attr)
 Attribute based add function for attr to FltV value. More...
 
int AddFltVAttrDatN (const int &NId, const TFltV &value, const TStr &attr, TBool UseDense=true)
 
int AppendIntVAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr)
 Appends value onto the TIntV attribute for the given node. More...
 
int AppendIntVAttrDatN (const int &NId, const TInt &value, const TStr &attr, TBool UseDense=true)
 
int DelFromIntVAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr)
 Deletes value from the TIntV attribute for the given node. More...
 
int DelFromIntVAttrDatN (const int &NId, const TInt &value, const TStr &attr)
 
int AppendFltVAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr)
 Appends value onto the TFltV attribute for the given node. More...
 
int AppendFltVAttrDatN (const int &NId, const TFlt &value, const TStr &attr, TBool UseDense=true)
 
int DelFromFltVAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr)
 Deletes value from the TFltV attribute for the given node. More...
 
int DelFromFltVAttrDatN (const int &NId, const TFlt &value, const TStr &attr)
 
int AddIntAttrDatE (const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
 Attribute based add function for attr to Int value. More...
 
int AddIntAttrDatE (const int &EId, const TInt &value, const TStr &attr)
 
int AddStrAttrDatE (const TEdgeI &EdgeI, const TStr &value, const TStr &attr)
 Attribute based add function for attr to Str value. More...
 
int AddStrAttrDatE (const int &EId, const TStr &value, const TStr &attr)
 
int AddFltAttrDatE (const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
 Attribute based add function for attr to Flt value. More...
 
int AddFltAttrDatE (const int &EId, const TFlt &value, const TStr &attr)
 
int AddIntVAttrDatE (const TEdgeI &EdgeI, const TIntV &value, const TStr &attr)
 Attribute based add function for attr to IntV value. More...
 
int AddIntVAttrDatE (const int &EId, const TIntV &value, const TStr &attr, TBool UseDense=true)
 
int AppendIntVAttrDatE (const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
 Appends value onto the TIntV attribute for the given node. More...
 
int AppendIntVAttrDatE (const int &EId, const TInt &value, const TStr &attr, TBool UseDense=true)
 
int AddFltVAttrDatE (const TEdgeI &EdgeI, const TFltV &value, const TStr &attr)
 Attribute based add function for attr to TFltV value. More...
 
int AddFltVAttrDatE (const int &EId, const TFltV &value, const TStr &attr, TBool UseDense=true)
 
int AppendFltVAttrDatE (const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
 Appends value onto the TFltV attribute for the given node. More...
 
int AppendFltVAttrDatE (const int &EId, const TFlt &value, const TStr &attr, TBool UseDense=true)
 
TInt GetIntAttrDatN (const TNodeI &NodeI, const TStr &attr)
 Gets the value of int attr from the node attr value vector. More...
 
TInt GetIntAttrDatN (const int &NId, const TStr &attr)
 
TStr GetStrAttrDatN (const TNodeI &NodeI, const TStr &attr)
 Gets the value of str attr from the node attr value vector. More...
 
TStr GetStrAttrDatN (const int &NId, const TStr &attr)
 
TFlt GetFltAttrDatN (const TNodeI &NodeI, const TStr &attr)
 Gets the value of flt attr from the node attr value vector. More...
 
TFlt GetFltAttrDatN (const int &NId, const TStr &attr)
 
TIntV GetIntVAttrDatN (const TNodeI &NodeI, const TStr &attr) const
 Gets the value of the intv attr from the node attr value vector. More...
 
TIntV GetIntVAttrDatN (const int &NId, const TStr &attr) const
 
TFltV GetFltVAttrDatN (const TNodeI &NodeI, const TStr &attr) const
 Gets the value of the fltv attr from the node attr value vector. More...
 
TFltV GetFltVAttrDatN (const int &NId, const TStr &attr) const
 
int GetIntAttrIndN (const TStr &attr)
 Gets the index of the node attr value vector specified by attr (same as GetAttrIndN for compatibility reasons). More...
 
int GetAttrIndN (const TStr &attr)
 Gets the index of the node attr value vector specified by attr. More...
 
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. More...
 
TInt GetIntAttrIndDatN (const int &NId, const int &index)
 Gets the value of an int node attr specified by node ID NId and the attr index. More...
 
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. More...
 
TStr GetStrAttrIndDatN (const int &NId, const int &index)
 Gets the value of a string node attr specified by node ID NId and the attr index. More...
 
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. More...
 
TFlt GetFltAttrIndDatN (const int &NId, const int &index)
 Gets the value of a float node attr specified by node ID NId and the attr index. More...
 
TInt GetIntAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of int attr from the edge attr value vector. More...
 
TInt GetIntAttrDatE (const int &EId, const TStr &attr)
 
TStr GetStrAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of str attr from the edge attr value vector. More...
 
TStr GetStrAttrDatE (const int &EId, const TStr &attr)
 
TFlt GetFltAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of flt attr from the edge attr value vector. More...
 
TFlt GetFltAttrDatE (const int &EId, const TStr &attr)
 
TIntV GetIntVAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of the intv attr from the edge attr value vector. More...
 
TIntV GetIntVAttrDatE (const int &EId, const TStr &attr)
 
TFltV GetFltVAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of the fltv attr from the edge attr value vector. More...
 
TFltV GetFltVAttrDatE (const int &EId, const TStr &attr)
 
int GetIntAttrIndE (const TStr &attr)
 Gets the index of the edge attr value vector specified by attr (same as GetAttrIndE for compatibility reasons). More...
 
int GetAttrIndE (const TStr &attr)
 Gets the index of the edge attr value vector specified by attr. More...
 
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. More...
 
TInt GetIntAttrIndDatE (const int &EId, const int &index)
 Gets the value of an int edge attr specified by edge ID EId and the attr index. More...
 
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. More...
 
TFlt GetFltAttrIndDatE (const int &EId, const int &index)
 Gets the value of an int edge attr specified by edge ID EId and the attr index. More...
 
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. More...
 
TStr GetStrAttrIndDatE (const int &EId, const int &index)
 Gets the value of an int edge attr specified by edge ID EId and the attr index. More...
 
int DelAttrDatN (const TNodeI &NodeI, const TStr &attr)
 Deletes the node attribute for NodeI. More...
 
int DelAttrDatN (const int &NId, const TStr &attr)
 
int DelAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Deletes the edge attribute for NodeI. More...
 
int DelAttrDatE (const int &EId, const TStr &attr)
 
int AddIntAttrN (const TStr &attr, TInt defaultValue=TInt::Mn)
 Adds a new Int node attribute to the hashmap. More...
 
int AddStrAttrN (const TStr &attr, TStr defaultValue=TStr::GetNullStr())
 Adds a new Str node attribute to the hashmap. More...
 
int AddFltAttrN (const TStr &attr, TFlt defaultValue=TFlt::Mn)
 Adds a new Flt node attribute to the hashmap. More...
 
int AddIntVAttrN (const TStr &attr, TBool UseDense=true)
 Adds a new IntV node attribute to the hashmap. More...
 
int AddFltVAttrN (const TStr &attr, TBool UseDense=true)
 Adds a new FltV node attribute to the hashmap. More...
 
int AddIntAttrE (const TStr &attr, TInt defaultValue=TInt::Mn)
 Adds a new Int edge attribute to the hashmap. More...
 
int AddStrAttrE (const TStr &attr, TStr defaultValue=TStr::GetNullStr())
 Adds a new Str edge attribute to the hashmap. More...
 
int AddFltAttrE (const TStr &attr, TFlt defaultValue=TFlt::Mn)
 Adds a new Flt edge attribute to the hashmap. More...
 
int AddIntVAttrE (const TStr &attr, TBool UseDense=true)
 Adds a new IntV edge attribute to the hashmap. More...
 
int AddFltVAttrE (const TStr &attr, TBool UseDense=true)
 Adds a new FltV edge attribute to the hashmap. More...
 
int DelAttrN (const TStr &attr)
 Removes all the values for node attr. More...
 
int DelAttrE (const TStr &attr)
 Removes all the values for edge attr. More...
 
bool IsAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if attr exists for node NId and has default value. More...
 
bool IsIntAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Int attr exists for node NId and has default value. More...
 
bool IsIntVAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if IntV attr exists for node NId and is an empty vector. More...
 
bool IsFltVAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if FltV attr exists for node NId and is an empty vector. More...
 
bool IsStrAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Str attr exists for node NId and has default value. More...
 
bool IsFltAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Flt attr exists for node NId and has default value. More...
 
bool NodeAttrIsDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted for current node attr iterator. More...
 
bool NodeAttrIsIntDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int attr iterator. More...
 
bool NodeAttrIsIntVDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int vector attr iterator. More...
 
bool NodeAttrIsFltVDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int vector attr iterator. More...
 
bool NodeAttrIsStrDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node str attr iterator. More...
 
bool NodeAttrIsFltDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node flt attr iterator. More...
 
bool IsAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if attr exists for edge EId and has default value. More...
 
bool IsIntAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Int attr exists for edge EId and has default value. More...
 
bool IsIntVAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if IntV attr exists for edge EId and is an empty vector. More...
 
bool IsFltVAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if FltV attr exists for edge EId and is an empty vector. More...
 
bool IsStrAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Str attr exists for edge NId and has default value. More...
 
bool IsFltAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Flt attr exists for edge NId and has default value. More...
 
bool EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge attr iterator. More...
 
bool EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge int attr iterator. More...
 
bool EdgeAttrIsIntVDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge int vector attr iterator. More...
 
bool EdgeAttrIsFltVDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge flt vector attr iterator. More...
 
bool EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge str attr iterator. More...
 
bool EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge flt attr iterator. More...
 
TStr GetNodeAttrValue (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns node attribute value, converted to Str type. More...
 
TStr GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns edge attribute value, converted to Str type. More...
 
TFlt GetWeightOutEdges (const TNodeI &NI, const TStr &attr)
 Gets the sum of the weights of all the outgoing edges of the node. More...
 
bool IsFltAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
bool IsIntAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
bool IsStrAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
TVec< TFlt > & GetFltAttrVecE (const TStr &attr)
 Gets Vector for the Flt Attribute attr. More...
 
int GetFltKeyIdE (const int &EId)
 Gets keyid for edge with id EId. More...
 
void GetWeightOutEdgesV (TFltV &OutWeights, const TFltV &AttrVal)
 Fills OutWeights with the outgoing weight from each node. More...
 
void GetAttrNNames (TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const
 Fills each of the vectors with the names of node attributes of the given type. More...
 
void GetAttrENames (TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const
 Fills each of the vectors with the names of edge attributes of the given type. More...
 
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. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to NodeI. More...
 
int AddSAttrDatN (const TInt &NId, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to the given node with id NId. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to NodeI. More...
 
int AddSAttrDatN (const TInt &NId, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to the given node with id NId. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from NodeI. More...
 
int DelSAttrDatN (const TInt &NId, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from node with id NId. More...
 
int DelSAttrDatN (const TInt &NId, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from node with id NId. More...
 
int DelSAttrDatN (const TNodeI &NodeI, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from NodeI. More...
 
int DelSAttrDatN (const TNodeI &NodeI, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from NodeI. More...
 
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. More...
 
int GetSAttrVN (const TNodeI &NodeI, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for NodeI. More...
 
int GetIdVSAttrN (const TStr &AttrName, TIntV &IdV) const
 Gets a list of all nodes that have a sparse attribute with name AttrName. More...
 
int GetIdVSAttrN (const TInt &AttrId, TIntV &IdV) const
 Gets a list of all nodes that have a sparse attribute with id AttrId. More...
 
int AddSAttrN (const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
 Adds mapping for sparse attribute with name Name and type AttrType. More...
 
int GetSAttrIdN (const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
 Gets id and type for attribute with name Name. More...
 
int GetSAttrNameN (const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
 Gets name and type for attribute with id AttrId. More...
 
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. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to the given edge with id EId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to EdgeI. More...
 
int AddSAttrDatE (const TInt &EId, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to the given edge with id EId. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to the given edge with id EId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to EdgeI. More...
 
int AddSAttrDatE (const TInt &EId, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to the given edge with id EId. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to the given edge with id EId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to EdgeI. More...
 
int GetSAttrDatE (const TInt &EId, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from edge with id EId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from EdgeI. More...
 
int GetSAttrDatE (const TInt &EId, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from edge with id EId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from EdgeI. More...
 
int GetSAttrDatE (const TInt &EId, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from edge with id EId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from EdgeI. More...
 
int DelSAttrDatE (const TInt &EId, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from edge with id EId. More...
 
int DelSAttrDatE (const TInt &EId, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from edge with id EId. More...
 
int DelSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from EdgeI. More...
 
int DelSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from EdgeI. More...
 
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. More...
 
int GetSAttrVE (const TEdgeI &EdgeI, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for EdgeI. More...
 
int GetIdVSAttrE (const TStr &AttrName, TIntV &IdV) const
 Gets a list of all edges that have a sparse attribute with name AttrName. More...
 
int GetIdVSAttrE (const TInt &AttrId, TIntV &IdV) const
 Gets a list of all edges that have a sparse attribute with id AttrId. More...
 
int AddSAttrE (const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
 Adds mapping for sparse attribute with name Name and type AttrType. More...
 
int GetSAttrIdE (const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
 Gets id and type for attribute with name Name. More...
 
int GetSAttrNameE (const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
 Gets name and type for attribute with id AttrId. More...
 

Static Public Member Functions

static PNEANet New ()
 Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New(). More...
 
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 Edges edges. More...
 
static PNEANet Load (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. More...
 
static PNEANet Load_V1 (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible. More...
 
static PNEANet Load_V2 (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible without Sparse. More...
 
static PNEANet LoadShM (TShMIn &ShMIn)
 Static constructor that loads the network from memory. More...
 
static PNEANet GetSmallGraph ()
 Returns a small multigraph on 5 nodes and 6 edges. More...
 

Public Attributes

TCRef CRef
 

Protected Types

enum  {
  IntType, StrType, FltType, IntVType,
  FltVType
}
 

Protected Member Functions

TNodeGetNode (const int &NId)
 
const TNodeGetNode (const int &NId) const
 
TEdgeGetEdge (const int &EId)
 
const TEdgeGetEdge (const int &EId) const
 
int AddAttributes (const int NId)
 
TInt GetIntAttrDefaultN (const TStr &attribute) const
 Gets Int node attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultN (const TStr &attribute) const
 Gets Str node attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultN (const TStr &attribute) const
 Gets Flt node attribute val. If not a proper attr, return default. More...
 
TInt GetIntAttrDefaultE (const TStr &attribute) const
 Gets Int edge attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultE (const TStr &attribute) const
 Gets Str edge attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultE (const TStr &attribute) const
 Gets Flt edge attribute val. If not a proper attr, return default. More...
 
TInt CheckDenseOrSparseN (const TStr &attr) const
 Return 1 if in Dense, 0 if in Sparse, -1 if neither. More...
 
TInt CheckDenseOrSparseE (const TStr &attr) const
 
 TNEANet (const TNEANet &Graph, bool modeSubGraph)
 
 TNEANet (bool copyAll, const TNEANet &Graph)
 

Protected Attributes

TInt MxNId
 
TInt MxEId
 
THash< TInt, TNodeNodeH
 
THash< TInt, TEdgeEdgeH
 
TStrIntPrH KeyToIndexTypeN
 KeyToIndexType[N|E]: Key->(Type,Index). More...
 
TStrIntPrH KeyToIndexTypeE
 
THash< TStr, TBoolKeyToDenseN
 KeyToDense[N|E]: Key->(True if Vec, False if Hash) More...
 
THash< TStr, TBoolKeyToDenseE
 
THash< TStr, TIntIntDefaultsN
 
THash< TStr, TIntIntDefaultsE
 
THash< TStr, TStrStrDefaultsN
 
THash< TStr, TStrStrDefaultsE
 
THash< TStr, TFltFltDefaultsN
 
THash< TStr, TFltFltDefaultsE
 
TVec< TIntVVecOfIntVecsN
 
TVec< TIntVVecOfIntVecsE
 
TVec< TStrVVecOfStrVecsN
 
TVec< TStrVVecOfStrVecsE
 
TVec< TFltVVecOfFltVecsN
 
TVec< TFltVVecOfFltVecsE
 
TVec< TVec< TIntV > > VecOfIntVecVecsN
 
TVec< TVec< TIntV > > VecOfIntVecVecsE
 
TVec< TVec< TFltV > > VecOfFltVecVecsN
 
TVec< TVec< TFltV > > VecOfFltVecVecsE
 
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
 
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
 
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
 
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
 
TAttr SAttrN
 
TAttr SAttrE
 

Friends

class TPt< TNEANet >
 

Detailed Description

Directed multigraph with node edge attributes.

Node IDs can be arbitrary non-negative integers. Edges have IDs. There can be more than one directed edge from one source node to a destination node. Self loops (one per node) are allowed as well as multiple (parallel) edges. Nodes and edges can have attributes/data associated with them. The attributes can be added dynamically at runtime. The directed multigraph data structure is implemented using sorted adjacency lists. This means adding a node takes constant time, while adding an edge takes linear time (since adjacency list is kept sorted) in the node degree. Accessing arbitrary node takes constant time and accessing any edge takes logarithmic time in the node degree. The attributes are organized in a columnar store, where each attribute column is defined for all the nodes or edges in the network.

Definition at line 1741 of file network.h.

Member Typedef Documentation

Definition at line 1744 of file network.h.

Definition at line 1743 of file network.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
IntType 
StrType 
FltType 
IntVType 
FltVType 

Definition at line 2070 of file network.h.

Constructor & Destructor Documentation

TNEANet::TNEANet ( )
inline

Definition at line 2124 of file network.h.

2124  : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
2132  SAttrN(), SAttrE(){ }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TCRef CRef
Definition: network.h:2050
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
TNEANet::TNEANet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

Constructor that reserves enough memory for a graph of nodes and edges.

Definition at line 2134 of file network.h.

2134  : CRef(),
2142  SAttrN(), SAttrE()
2143  { Reserve(Nodes, Edges); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: network.h:2844
TCRef CRef
Definition: network.h:2050
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
TNEANet::TNEANet ( const TNEANet Graph)
inline

Definition at line 2144 of file network.h.

2144  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
2152  SAttrN(), SAttrE() { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
TNEANet::TNEANet ( TSIn SIn)
inline

Constructor for loading the graph from a (binary) stream SIn.

Definition at line 2154 of file network.h.

2154  : MxNId(SIn), MxEId(SIn), NodeH(SIn), EdgeH(SIn),
2156  StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
2159  VecOfFltVecVecsN(SIn), VecOfFltVecVecsE(SIn),
2162  SAttrN(SIn), SAttrE(SIn) { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
TNEANet::TNEANet ( const TNEANet Graph,
bool  modeSubGraph 
)
inlineprotected

Definition at line 2164 of file network.h.

2164  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
2173  { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
TNEANet::TNEANet ( bool  copyAll,
const TNEANet Graph 
)
inlineprotected

Definition at line 2174 of file network.h.

2174  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
2183  SAttrN(Graph.SAttrN), SAttrE(Graph.SAttrE) { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058

Member Function Documentation

int TNEANet::AddAttributes ( const int  NId)
protected

Definition at line 559 of file network.cpp.

559  {
560  int i;
561  // update attribute columns
562  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
563  TVec<TInt>& IntVec = VecOfIntVecsN[i];
564  int KeyId = NodeH.GetKeyId(NId);
565  if (IntVec.Len() > KeyId) {
566  IntVec[KeyId] = TInt::Mn;
567  } else {
568  IntVec.Ins(KeyId, TInt::Mn);
569  }
570  }
571  TVec<TStr> DefIntVec = TVec<TStr>();
572  IntDefaultsN.GetKeyV(DefIntVec);
573  for (i = 0; i < DefIntVec.Len(); i++) {
574  TStr attr = DefIntVec[i];
575  TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
576  IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
577  }
578  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
579  TVec<TStr>& StrVec = VecOfStrVecsN[i];
580  int KeyId = NodeH.GetKeyId(NId);
581  if (StrVec.Len() > KeyId) {
582  StrVec[KeyId] = TStr::GetNullStr();
583  } else {
584  StrVec.Ins(KeyId, TStr::GetNullStr());
585  }
586  }
587  TVec<TStr> DefStrVec = TVec<TStr>();
588  StrDefaultsN.GetKeyV(DefStrVec);
589  for (i = 0; i < DefStrVec.Len(); i++) {
590  TStr attr = DefStrVec[i];
591  TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
592  StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
593  }
594  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
595  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
596  int KeyId = NodeH.GetKeyId(NId);
597  if (FltVec.Len() > KeyId) {
598  FltVec[KeyId] = TFlt::Mn;
599  } else {
600  FltVec.Ins(KeyId, TFlt::Mn);
601  }
602  }
603  TVec<TStr> DefFltVec = TVec<TStr>();
604  FltDefaultsN.GetKeyV(DefFltVec);
605  for (i = 0; i < DefFltVec.Len(); i++) {
606  TStr attr = DefFltVec[i];
607  TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
608  FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
609  }
610  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
611  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
612  int KeyId = NodeH.GetKeyId(NId);
613  if (IntVecV.Len() > KeyId) {
614  IntVecV[KeyId] = TIntV();
615  } else {
616  IntVecV.Ins(KeyId, TIntV());
617  }
618  }
619  for (i = 0; i < VecOfFltVecVecsN.Len(); i++) {
620  TVec<TFltV>& FltVecV = VecOfFltVecVecsN[i];
621  int KeyId = NodeH.GetKeyId(NId);
622  if (FltVecV.Len() > KeyId) {
623  FltVecV[KeyId] = TFltV();
624  } else {
625  FltVecV.Ins(KeyId, TFltV());
626  }
627  }
628  return NId;
629 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
static const int Mn
Definition: dt.h:1141
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2040
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFlt > TFltV
Definition: ds.h:1596
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
Definition: dt.h:412
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2042
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2038
static const double Mn
Definition: dt.h:1390
int TNEANet::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.

Returns the ID of the edge being added. If EId is -1, edge ID is automatically assigned. Aborts, if an edge with ID EId already exists. Aborts, if SrcNId or DstNId are not nodes in the graph.

Definition at line 753 of file network.cpp.

753  {
754  int i;
755 
756  if (EId == -1) { EId = MxEId; MxEId++; }
757  else { MxEId = TMath::Mx(EId+1, MxEId()); }
758  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
759  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
760  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
761  GetNode(SrcNId).OutEIdV.AddSorted(EId);
762  GetNode(DstNId).InEIdV.AddSorted(EId);
763 
764  // update attribute columns
765  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
766  TVec<TInt>& IntVec = VecOfIntVecsE[i];
767  int KeyId = EdgeH.GetKeyId(EId);
768  if (IntVec.Len() > KeyId) {
769  IntVec[KeyId] = TInt::Mn;
770  } else {
771  IntVec.Ins(KeyId, TInt::Mn);
772  }
773  }
774  TVec<TStr> DefIntVec = TVec<TStr>();
775  IntDefaultsE.GetKeyV(DefIntVec);
776  for (i = 0; i < DefIntVec.Len(); i++) {
777  TStr attr = DefIntVec[i];
778  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
779  IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
780  }
781 
782  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
783  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
784  IntVecV.Ins(EdgeH.GetKeyId(EId), TIntV());
785  }
786 
787  for (i = 0; i < VecOfFltVecVecsE.Len(); i++) {
788  TVec<TFltV>& FltVecV = VecOfFltVecVecsE[i];
789  FltVecV.Ins(EdgeH.GetKeyId(EId), TFltV());
790  }
791 
792  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
793  TVec<TStr>& StrVec = VecOfStrVecsE[i];
794  int KeyId = EdgeH.GetKeyId(EId);
795  if (StrVec.Len() > KeyId) {
796  StrVec[KeyId] = TStr::GetNullStr();
797  } else {
798  StrVec.Ins(KeyId, TStr::GetNullStr());
799  }
800  }
801  TVec<TStr> DefStrVec = TVec<TStr>();
802  StrDefaultsE.GetKeyV(DefStrVec);
803  for (i = 0; i < DefStrVec.Len(); i++) {
804  TStr attr = DefStrVec[i];
805  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
806  StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
807  }
808 
809  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
810  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
811  int KeyId = EdgeH.GetKeyId(EId);
812  if (FltVec.Len() > KeyId) {
813  FltVec[KeyId] = TFlt::Mn;
814  } else {
815  FltVec.Ins(KeyId, TFlt::Mn);
816  }
817  }
818  TVec<TStr> DefFltVec = TVec<TStr>();
819  FltDefaultsE.GetKeyV(DefFltVec);
820  for (i = 0; i < DefFltVec.Len(); i++) {
821  TStr attr = DefFltVec[i];
822  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
823  FltVec[EdgeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
824  }
825  return EId;
826 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TNode & GetNode(const int &NId)
Definition: network.h:2030
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2044
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TIntV OutEIdV
Definition: network.h:1749
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1117
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
static const int Mn
Definition: dt.h:1141
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2046
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
static TStr GetNullStr()
Definition: dt.cpp:1626
TInt MxEId
Definition: network.h:2052
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFlt > TFltV
Definition: ds.h:1596
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:2048
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
TIntV InEIdV
Definition: network.h:1749
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
static const double Mn
Definition: dt.h:1390
int TNEANet::AddEdge ( const TEdgeI EdgeI)
inline

Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph.

Definition at line 2794 of file network.h.

2794 { return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), EdgeI.GetId()); }
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.
Definition: network.cpp:753
int TNEANet::AddFltAttrDatE ( const TEdgeI EdgeI,
const TFlt value,
const TStr attr 
)
inline

Attribute based add function for attr to Flt value.

Adds the key flt value pair to the corresponding edge attribute value vector.

Definition at line 2908 of file network.h.

2908 { return AddFltAttrDatE(EdgeI.GetId(), value, attr); }
int AddFltAttrDatE(const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
Definition: network.h:2908
int TNEANet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 1379 of file network.cpp.

1379  {
1380  int i;
1381  TInt CurrLen;
1382 
1383  if (!IsEdge(EId)) {
1384  //AddEdge(EId);
1385  return -1;
1386  }
1387  if (KeyToIndexTypeE.IsKey(attr)) {
1389  NewVec[EdgeH.GetKeyId(EId)] = value;
1390  } else {
1391  CurrLen = VecOfFltVecsE.Len();
1392  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1393  TVec<TFlt> NewVec = TVec<TFlt>();
1394  for (i = 0; i < MxEId; i++) {
1395  NewVec.Ins(i, GetFltAttrDefaultE(attr));
1396  }
1397  NewVec[EdgeH.GetKeyId(EId)] = value;
1398  VecOfFltVecsE.Add(NewVec);
1399  }
1400  return 0;
1401 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:2048
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltAttrDatN ( const TNodeI NodeI,
const TFlt value,
const TStr attr 
)
inline

Attribute based add function for attr to Flt value.

Definition at line 2868 of file network.h.

2868 { return AddFltAttrDatN(NodeI.GetId(), value, attr); }
int AddFltAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
Definition: network.h:2868
int TNEANet::AddFltAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 1224 of file network.cpp.

1224  {
1225  int i;
1226  TInt CurrLen;
1227 
1228  if (!IsNode(NId)) {
1229  // AddNode(NId);
1230  return -1;
1231  }
1232  if (KeyToIndexTypeN.IsKey(attr)) {
1234  NewVec[NodeH.GetKeyId(NId)] = value;
1235  } else {
1236  CurrLen = VecOfFltVecsN.Len();
1237  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
1238  TVec<TFlt> NewVec = TVec<TFlt>();
1239  for (i = 0; i < MxNId; i++) {
1240  NewVec.Ins(i, GetFltAttrDefaultN(attr));
1241  }
1242  NewVec[NodeH.GetKeyId(NId)] = value;
1243  VecOfFltVecsN.Add(NewVec);
1244  }
1245  return 0;
1246 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: network.h:2052
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2042
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 1716 of file network.cpp.

1716  {
1717  int i;
1718  TInt CurrLen;
1719  TVec<TFlt> NewVec;
1720  CurrLen = VecOfFltVecsE.Len();
1721  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1722  NewVec = TVec<TFlt>();
1723  for (i = 0; i < MxEId; i++) {
1724  NewVec.Ins(i, defaultValue);
1725  }
1726  VecOfFltVecsE.Add(NewVec);
1727  if (!FltDefaultsE.IsKey(attr)) {
1728  FltDefaultsE.AddDat(attr, defaultValue);
1729  } else {
1730  return -1;
1731  }
1732  return 0;
1733 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 1621 of file network.cpp.

1621  {
1622  // TODO(nkhadke): add error checking
1623  int i;
1624  TInt CurrLen;
1625  TVec<TFlt> NewVec;
1626  CurrLen = VecOfFltVecsN.Len();
1627  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
1628  NewVec = TVec<TFlt>();
1629  for (i = 0; i < MxNId; i++) {
1630  NewVec.Ins(i, defaultValue);
1631  }
1632  VecOfFltVecsN.Add(NewVec);
1633  if (!FltDefaultsN.IsKey(attr)) {
1634  FltDefaultsN.AddDat(attr, defaultValue);
1635  } else {
1636  return -1;
1637  }
1638  return 0;
1639 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltVAttrDatE ( const TEdgeI EdgeI,
const TFltV value,
const TStr attr 
)
inline

Attribute based add function for attr to TFltV value.

Adds the key float vector value pair to the corresponding edge attribute value vector.

Definition at line 2924 of file network.h.

2924 { return AddFltVAttrDatE(EdgeI.GetId(), value, attr); }
int AddFltVAttrDatE(const TEdgeI &EdgeI, const TFltV &value, const TStr &attr)
Attribute based add function for attr to TFltV value.
Definition: network.h:2924
int TNEANet::AddFltVAttrDatE ( const int &  EId,
const TFltV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1294 of file network.cpp.

1294  {
1295  if (!IsEdge(EId)) {
1296  // AddNode(NId);
1297  return -1;
1298  }
1299  TInt location = CheckDenseOrSparseE(attr);
1300 
1301  if (location==-1) {
1302  AddFltVAttrE(attr, UseDense);
1303  location = CheckDenseOrSparseE(attr);
1304  }
1305  if (UseDense) {
1306  IAssertR(location != 0, TStr::Fmt("EdgeID %d exists for %s in sparse representation", EId, attr.CStr()));
1308  NewVec[EdgeH.GetKeyId(EId)] = value;
1309  } else {
1310  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", EId, attr.CStr()));
1312  NewHash.AddDat(EdgeH.GetKeyId(EId), value);
1313  }
1314  return 0;
1315 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
char * CStr()
Definition: dt.h:479
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int AddFltVAttrE(const TStr &attr, TBool UseDense=true)
Adds a new FltV edge attribute to the hashmap.
Definition: network.cpp:1679
int TNEANet::AddFltVAttrDatN ( const TNodeI NodeI,
const TFltV value,
const TStr attr 
)
inline

Attribute based add function for attr to FltV value.

Definition at line 2874 of file network.h.

2874 { return AddFltVAttrDatN(NodeI.GetId(), value, attr); }
int AddFltVAttrDatN(const TNodeI &NodeI, const TFltV &value, const TStr &attr)
Attribute based add function for attr to FltV value.
Definition: network.h:2874
int TNEANet::AddFltVAttrDatN ( const int &  NId,
const TFltV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1077 of file network.cpp.

1077  {
1078  if (!IsNode(NId)) {
1079  // AddNode(NId);
1080  return -1;
1081  }
1082 
1083  TInt location = CheckDenseOrSparseN(attr);
1084  if (location==-1) {
1085  AddFltVAttrN(attr, UseDense);
1086  location = CheckDenseOrSparseN(attr);
1087  }
1088 
1089  if (UseDense) {
1090  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
1092  NewVec[NodeH.GetKeyId(NId)] = value;
1093  } else {
1094  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
1096  NewHash.AddDat(NodeH.GetKeyId(NId), value);
1097  }
1098 
1099  return 0;
1100 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
int AddFltVAttrN(const TStr &attr, TBool UseDense=true)
Adds a new FltV node attribute to the hashmap.
Definition: network.cpp:1584
char * CStr()
Definition: dt.h:479
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltVAttrE ( const TStr attr,
TBool  UseDense = true 
)

Adds a new FltV edge attribute to the hashmap.

Definition at line 1679 of file network.cpp.

1679  {
1680  TInt CurrLen;
1681  if (UseDense) {
1682  CurrLen = VecOfFltVecVecsE.Len();
1683  KeyToIndexTypeE.AddDat(attr, TIntPr(FltVType, CurrLen));
1684  KeyToDenseE.AddDat(attr, true);
1685  TVec<TFltV> NewVec = TVec<TFltV>(MxEId);
1686  VecOfFltVecVecsE.Add(NewVec);
1687  } else {
1688  CurrLen = VecOfFltHashVecsE.Len();
1689  KeyToIndexTypeE.AddDat(attr, TIntPr(FltVType, CurrLen));
1690  KeyToDenseE.AddDat(attr, false);
1691  THash<TInt, TFltV> NewHash;
1692  VecOfFltHashVecsE.Add(NewHash);
1693  }
1694  return 0;
1695 }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddFltVAttrN ( const TStr attr,
TBool  UseDense = true 
)

Adds a new FltV node attribute to the hashmap.

Definition at line 1584 of file network.cpp.

1584  {
1585  TInt CurrLen;
1586  if (UseDense) {
1587  CurrLen = VecOfFltVecVecsN.Len();
1588  KeyToIndexTypeN.AddDat(attr, TIntPr(FltVType, CurrLen));
1589  KeyToDenseN.AddDat(attr, true);
1590  TVec<TFltV> NewVec = TVec<TFltV>(MxNId);
1591  VecOfFltVecVecsN.Add(NewVec);
1592  } else {
1593  CurrLen = VecOfFltHashVecsN.Len();
1594  KeyToIndexTypeN.AddDat(attr, TIntPr(FltVType, CurrLen));
1595  KeyToDenseN.AddDat(attr, false);
1596  THash<TInt, TFltV> NewHash;
1597  VecOfFltHashVecsN.Add(NewHash);
1598  }
1599  return 0;
1600 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TInt MxNId
Definition: network.h:2052
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
int TNEANet::AddIntAttrDatE ( const TEdgeI EdgeI,
const TInt value,
const TStr attr 
)
inline

Attribute based add function for attr to Int value.

Adds the key int value pair to the corresponding edge attribute value vector.

Definition at line 2898 of file network.h.

2898 { return AddIntAttrDatE(EdgeI.GetId(), value, attr); }
int AddIntAttrDatE(const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
Definition: network.h:2898
int TNEANet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 1248 of file network.cpp.

1248  {
1249  int i;
1250  TInt CurrLen;
1251  if (!IsEdge(EId)) {
1252  //AddEdge(EId);
1253  return -1;
1254  }
1255  if (KeyToIndexTypeE.IsKey(attr)) {
1257  NewVec[EdgeH.GetKeyId(EId)] = value;
1258  } else {
1259  CurrLen = VecOfIntVecsE.Len();
1260  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
1261  TVec<TInt> NewVec = TVec<TInt>();
1262  for (i = 0; i < MxEId; i++) {
1263  NewVec.Ins(i, GetIntAttrDefaultE(attr));
1264  }
1265  NewVec[EdgeH.GetKeyId(EId)] = value;
1266  VecOfIntVecsE.Add(NewVec);
1267  }
1268  return 0;
1269 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2044
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntAttrDatN ( const TNodeI NodeI,
const TInt value,
const TStr attr 
)
inline

Attribute based add function for attr to Int value.

Definition at line 2862 of file network.h.

2862 { return AddIntAttrDatN(NodeI.GetId(), value, attr); }
int AddIntAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
Definition: network.h:2862
int TNEANet::AddIntAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 1031 of file network.cpp.

1031  {
1032  int i;
1033  TInt CurrLen;
1034  if (!IsNode(NId)) {
1035  // AddNode(NId);
1036  return -1;
1037  }
1038  if (KeyToIndexTypeN.IsKey(attr)) {
1040  NewVec[NodeH.GetKeyId(NId)] = value;
1041  } else {
1042  CurrLen = VecOfIntVecsN.Len();
1043  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
1044  TVec<TInt> NewVec = TVec<TInt>();
1045  for (i = 0; i < MxNId; i++) {
1046  NewVec.Ins(i, GetIntAttrDefaultN(attr));
1047  }
1048  NewVec[NodeH.GetKeyId(NId)] = value;
1049  VecOfIntVecsN.Add(NewVec);
1050  }
1051  return 0;
1052 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: network.h:2052
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2038
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 1641 of file network.cpp.

1641  {
1642  // TODO(nkhadke): add error checking
1643  int i;
1644  TInt CurrLen;
1645  TVec<TInt> NewVec;
1646  CurrLen = VecOfIntVecsE.Len();
1647  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
1648  NewVec = TVec<TInt>();
1649  for (i = 0; i < MxEId; i++) {
1650  NewVec.Ins(i, defaultValue);
1651  }
1652  VecOfIntVecsE.Add(NewVec);
1653  if (!IntDefaultsE.IsKey(attr)) {
1654  IntDefaultsE.AddDat(attr, defaultValue);
1655  } else {
1656  return -1;
1657  }
1658  return 0;
1659 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntAttrN ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int node attribute to the hashmap.

Definition at line 1547 of file network.cpp.

1547  {
1548  int i;
1549  TInt CurrLen;
1550  TVec<TInt> NewVec;
1551  CurrLen = VecOfIntVecsN.Len();
1552  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
1553  NewVec = TVec<TInt>();
1554  for (i = 0; i < MxNId; i++) {
1555  NewVec.Ins(i, defaultValue);
1556  }
1557  VecOfIntVecsN.Add(NewVec);
1558  if (!IntDefaultsN.IsKey(attr)) {
1559  IntDefaultsN.AddDat(attr, defaultValue);
1560  } else {
1561  return -1;
1562  }
1563  return 0;
1564 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: network.h:2052
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntVAttrDatE ( const TEdgeI EdgeI,
const TIntV value,
const TStr attr 
)
inline

Attribute based add function for attr to IntV value.

Adds the key integer vector value pair to the corresponding edge attribute value vector.

Definition at line 2915 of file network.h.

2915 { return AddIntVAttrDatE(EdgeI.GetId(), value, attr); }
int AddIntVAttrDatE(const TEdgeI &EdgeI, const TIntV &value, const TStr &attr)
Attribute based add function for attr to IntV value.
Definition: network.h:2915
int TNEANet::AddIntVAttrDatE ( const int &  EId,
const TIntV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1271 of file network.cpp.

1271  {
1272  if (!IsEdge(EId)) {
1273  // AddNode(NId);
1274  return -1;
1275  }
1276  TInt location = CheckDenseOrSparseE(attr);
1277  if (location==-1) {
1278  AddIntVAttrE(attr, UseDense);
1279  location = CheckDenseOrSparseE(attr);
1280  }
1281  if (UseDense) {
1282  IAssertR(location != 0, TStr::Fmt("EdgeID %d exists for %s in sparse representation", EId, attr.CStr()));
1284  NewVec[EdgeH.GetKeyId(EId)] = value;
1285  } else {
1286  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", EId, attr.CStr()));
1288  NewHash.AddDat(EdgeH.GetKeyId(EId), value);
1289  }
1290  return 0;
1291 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
int AddIntVAttrE(const TStr &attr, TBool UseDense=true)
Adds a new IntV edge attribute to the hashmap.
Definition: network.cpp:1661
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
char * CStr()
Definition: dt.h:479
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntVAttrDatN ( const TNodeI NodeI,
const TIntV value,
const TStr attr 
)
inline

Attribute based add function for attr to IntV value.

Definition at line 2871 of file network.h.

2871 { return AddIntVAttrDatN(NodeI.GetId(), value, attr); }
int AddIntVAttrDatN(const TNodeI &NodeI, const TIntV &value, const TStr &attr)
Attribute based add function for attr to IntV value.
Definition: network.h:2871
int TNEANet::AddIntVAttrDatN ( const int &  NId,
const TIntV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1054 of file network.cpp.

1054  {
1055  if (!IsNode(NId)) {
1056  // AddNode(NId);
1057  return -1;
1058  }
1059  TInt location = CheckDenseOrSparseN(attr);
1060  if (location==-1) {
1061  AddIntVAttrN(attr, UseDense);
1062  location = CheckDenseOrSparseN(attr);
1063  }
1064  if (UseDense) {
1065  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
1067  NewVec[NodeH.GetKeyId(NId)] = value;
1068  } else {
1069  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
1071  NewHash.AddDat(NodeH.GetKeyId(NId), value);
1072  }
1073 
1074  return 0;
1075 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
int AddIntVAttrN(const TStr &attr, TBool UseDense=true)
Adds a new IntV node attribute to the hashmap.
Definition: network.cpp:1566
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
char * CStr()
Definition: dt.h:479
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntVAttrE ( const TStr attr,
TBool  UseDense = true 
)

Adds a new IntV edge attribute to the hashmap.

Definition at line 1661 of file network.cpp.

1661  {
1662  TInt CurrLen;
1663  if (UseDense) {
1664  CurrLen = VecOfIntVecVecsE.Len();
1665  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
1666  KeyToDenseE.AddDat(attr, true);
1667  TVec<TIntV> NewVec = TVec<TIntV>(MxEId);
1668  VecOfIntVecVecsE.Add(NewVec);
1669  } else {
1670  CurrLen = VecOfIntHashVecsE.Len();
1671  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
1672  KeyToDenseE.AddDat(attr, false);
1673  THash<TInt, TIntV> NewHash;
1674  VecOfIntHashVecsE.Add(NewHash);
1675  }
1676  return 0;
1677 }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddIntVAttrN ( const TStr attr,
TBool  UseDense = true 
)

Adds a new IntV node attribute to the hashmap.

Definition at line 1566 of file network.cpp.

1566  {
1567  TInt CurrLen;
1568  if (UseDense) {
1569  CurrLen = VecOfIntVecVecsN.Len();
1570  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
1571  KeyToDenseN.AddDat(attr, true);
1572  TVec<TIntV> NewVec = TVec<TIntV>(MxNId);
1573  VecOfIntVecVecsN.Add(NewVec);
1574  } else {
1575  CurrLen = VecOfIntHashVecsN.Len();
1576  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
1577  KeyToDenseN.AddDat(attr, false);
1578  THash<TInt, TIntV> NewHash;
1579  VecOfIntHashVecsN.Add(NewHash);
1580  }
1581  return 0;
1582 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: network.h:2052
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
int TNEANet::AddNode ( int  NId = -1)

Adds a node of ID NId to the network.

Returns the ID of the node being added. If NId is -1, node ID is automatically assigned. Aborts, if a node with ID NId already exists.

Definition at line 535 of file network.cpp.

535  {
536  if (NId == -1) {
537  NId = MxNId; MxNId++;
538  } else {
539  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
540  MxNId = TMath::Mx(NId+1, MxNId());
541  }
542  NodeH.AddDat(NId, TNode(NId));
543  AddAttributes(NId);
544  return NId;
545 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt MxNId
Definition: network.h:2052
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
int AddAttributes(const int NId)
Definition: network.cpp:559
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddNode ( const TNodeI NodeI)
inline

Adds a node of ID NodeI.GetId() to the graph.

Definition at line 2377 of file network.h.

2377 { return AddNode(NodeI.GetId()); }
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
Definition: network.cpp:535
int TNEANet::AddNodeUnchecked ( int  NId = -1)

Adds a node of ID NId to the network, noop if the node already exists.

Returns -1, if the node NId already exists. Otherwise, it returns the ID of the node being added. If NId is -1, node ID is automatically assigned.

Definition at line 547 of file network.cpp.

547  {
548  if (NId == -1) {
549  NId = MxNId; MxNId++;
550  } else {
551  if (IsNode(NId)) { return -1;}
552  MxNId = TMath::Mx(NId+1, MxNId());
553  }
554  NodeH.AddDat(NId, TNode(NId));
555  AddAttributes(NId);
556  return NId;
557 }
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt MxNId
Definition: network.h:2052
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
int AddAttributes(const int NId)
Definition: network.cpp:559
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddSAttrDatE ( const TInt EId,
const TStr AttrName,
const TInt Val 
)

Adds Int sparse attribute with name AttrName to the given edge with id EId.

Definition at line 1991 of file network.cpp.

1991  {
1992  if (!IsEdge(EId)) {
1993  return -1;
1994  }
1995  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1996 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TInt EId,
const TInt AttrId,
const TInt Val 
)

Adds Int sparse attribute with id AttrId to the given edge with id EId.

Definition at line 1998 of file network.cpp.

1998  {
1999  if (!IsEdge(EId)) {
2000  return -1;
2001  }
2002  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2003 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TInt Val 
)
inline

Adds Int sparse attribute with name AttrName to EdgeI.

Definition at line 3243 of file network.h.

3243  {
3244  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
3245  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TInt Val 
)
inline

Adds Int sparse attribute with id AttrId to EdgeI.

Definition at line 3247 of file network.h.

3247  {
3248  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
3249  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatE ( const TInt EId,
const TStr AttrName,
const TFlt Val 
)

Adds Flt sparse attribute with name AttrName to the given edge with id EId.

Definition at line 2005 of file network.cpp.

2005  {
2006  if (!IsEdge(EId)) {
2007  return -1;
2008  }
2009  return SAttrE.AddSAttrDat(EId, AttrName, Val);
2010 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TInt EId,
const TInt AttrId,
const TFlt Val 
)

Adds Flt sparse attribute with id AttrId to the given edge with id EId.

Definition at line 2012 of file network.cpp.

2012  {
2013  if (!IsEdge(EId)) {
2014  return -1;
2015  }
2016  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2017 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TFlt Val 
)
inline

Adds Flt sparse attribute with name AttrName to EdgeI.

Definition at line 3257 of file network.h.

3257  {
3258  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
3259  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TFlt Val 
)
inline

Adds Flt sparse attribute with id AttrId to EdgeI.

Definition at line 3261 of file network.h.

3261  {
3262  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
3263  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatE ( const TInt EId,
const TStr AttrName,
const TStr Val 
)

Adds Str sparse attribute with name AttrName to the given edge with id EId.

Definition at line 2019 of file network.cpp.

2019  {
2020  if (!IsEdge(EId)) {
2021  return -1;
2022  }
2023  return SAttrE.AddSAttrDat(EId, AttrName, Val);
2024 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TInt EId,
const TInt AttrId,
const TStr Val 
)

Adds Str sparse attribute with id AttrId to the given edge with id EId.

Definition at line 2026 of file network.cpp.

2026  {
2027  if (!IsEdge(EId)) {
2028  return -1;
2029  }
2030  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2031 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TStr Val 
)
inline

Adds Str sparse attribute with name AttrName to EdgeI.

Definition at line 3271 of file network.h.

3271  {
3272  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
3273  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TStr Val 
)
inline

Adds Str sparse attribute with id AttrId to EdgeI.

Definition at line 3275 of file network.h.

3275  {
3276  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
3277  }
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.
Definition: network.cpp:1991
int TNEANet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TInt Val 
)

Adds Int sparse attribute with name AttrName to the given node with id NId.

Definition at line 1865 of file network.cpp.

1865  {
1866  if (!IsNode(NId)) {
1867  return -1;
1868  }
1869  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1870 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TInt Val 
)

Adds Int sparse attribute with id AttrId to the given node with id NId.

Definition at line 1872 of file network.cpp.

1872  {
1873  if (!IsNode(NId)) {
1874  return -1;
1875  }
1876  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1877 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TInt Val 
)
inline

Adds Int sparse attribute with name AttrName to NodeI.

Definition at line 3125 of file network.h.

3125  {
3126  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3127  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TInt Val 
)
inline

Adds Int sparse attribute with id AttrId to NodeI.

Definition at line 3129 of file network.h.

3129  {
3130  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3131  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TFlt Val 
)

Adds Flt sparse attribute with name AttrName to the given node with id NId.

Definition at line 1879 of file network.cpp.

1879  {
1880  if (!IsNode(NId)) {
1881  return -1;
1882  }
1883  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1884 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TFlt Val 
)

Adds Flt sparse attribute with id AttrId to the given node with id NId.

Definition at line 1886 of file network.cpp.

1886  {
1887  if (!IsNode(NId)) {
1888  return -1;
1889  }
1890  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1891 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TFlt Val 
)
inline

Adds Flt sparse attribute with name AttrName to NodeI.

Definition at line 3139 of file network.h.

3139  {
3140  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3141  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TFlt Val 
)
inline

Adds Flt sparse attribute with id AttrId to NodeI.

Definition at line 3143 of file network.h.

3143  {
3144  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3145  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TStr Val 
)

Adds Str sparse attribute with name AttrName to the given node with id NId.

Definition at line 1893 of file network.cpp.

1893  {
1894  if (!IsNode(NId)) {
1895  return -1;
1896  }
1897  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1898 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TStr Val 
)

Adds Str sparse attribute with id AttrId to the given node with id NId.

Definition at line 1900 of file network.cpp.

1900  {
1901  if (!IsNode(NId)) {
1902  return -1;
1903  }
1904  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1905 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TStr Val 
)
inline

Adds Str sparse attribute with name AttrName to NodeI.

Definition at line 3153 of file network.h.

3153  {
3154  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3155  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TStr Val 
)
inline

Adds Str sparse attribute with id AttrId to NodeI.

Definition at line 3157 of file network.h.

3157  {
3158  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3159  }
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.
Definition: network.cpp:1865
int TNEANet::AddSAttrE ( const TStr Name,
const TAttrType AttrType,
TInt AttrId 
)

Adds mapping for sparse attribute with name Name and type AttrType.

Definition at line 2105 of file network.cpp.

2105  {
2106  return SAttrE.AddSAttr(Name, AttrType, AttrId);
2107 }
TAttr SAttrE
Definition: network.h:2073
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:210
int TNEANet::AddSAttrN ( const TStr Name,
const TAttrType AttrType,
TInt AttrId 
)

Adds mapping for sparse attribute with name Name and type AttrType.

Definition at line 1979 of file network.cpp.

1979  {
1980  return SAttrN.AddSAttr(Name, AttrType, AttrId);
1981 }
TAttr SAttrN
Definition: network.h:2072
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:210
int TNEANet::AddStrAttrDatE ( const TEdgeI EdgeI,
const TStr value,
const TStr attr 
)
inline

Attribute based add function for attr to Str value.

Adds the key str value pair to the corresponding edge attribute value vector.

Definition at line 2903 of file network.h.

2903 { return AddStrAttrDatE(EdgeI.GetId(), value, attr); }
int AddStrAttrDatE(const TEdgeI &EdgeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
Definition: network.h:2903
int TNEANet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 1356 of file network.cpp.

1356  {
1357  int i;
1358  TInt CurrLen;
1359  if (!IsEdge(EId)) {
1360  //AddEdge(EId);
1361  return -1;
1362  }
1363  if (KeyToIndexTypeE.IsKey(attr)) {
1365  NewVec[EdgeH.GetKeyId(EId)] = value;
1366  } else {
1367  CurrLen = VecOfStrVecsE.Len();
1368  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
1369  TVec<TStr> NewVec = TVec<TStr>();
1370  for (i = 0; i < MxEId; i++) {
1371  NewVec.Ins(i, GetStrAttrDefaultE(attr));
1372  }
1373  NewVec[EdgeH.GetKeyId(EId)] = value;
1374  VecOfStrVecsE.Add(NewVec);
1375  }
1376  return 0;
1377 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2046
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddStrAttrDatN ( const TNodeI NodeI,
const TStr value,
const TStr attr 
)
inline

Attribute based add function for attr to Str value.

Definition at line 2865 of file network.h.

2865 { return AddStrAttrDatN(NodeI.GetId(), value, attr); }
int AddStrAttrDatN(const TNodeI &NodeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
Definition: network.h:2865
int TNEANet::AddStrAttrDatN ( const int &  NId,
const TStr value,
const TStr attr 
)

Definition at line 1201 of file network.cpp.

1201  {
1202  int i;
1203  TInt CurrLen;
1204  if (!IsNode(NId)) {
1205  // AddNode(NId);
1206  return -1;
1207  }
1208  if (KeyToIndexTypeN.IsKey(attr)) {
1210  NewVec[NodeH.GetKeyId(NId)] = value;
1211  } else {
1212  CurrLen = VecOfStrVecsN.Len();
1213  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
1214  TVec<TStr> NewVec = TVec<TStr>();
1215  for (i = 0; i < MxNId; i++) {
1216  NewVec.Ins(i, GetStrAttrDefaultN(attr));
1217  }
1218  NewVec[NodeH.GetKeyId(NId)] = value;
1219  VecOfStrVecsN.Add(NewVec);
1220  }
1221  return 0;
1222 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:2052
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2040
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 1697 of file network.cpp.

1697  {
1698  int i;
1699  TInt CurrLen;
1700  TVec<TStr> NewVec;
1701  CurrLen = VecOfStrVecsE.Len();
1702  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
1703  NewVec = TVec<TStr>();
1704  for (i = 0; i < MxEId; i++) {
1705  NewVec.Ins(i, defaultValue);
1706  }
1707  VecOfStrVecsE.Add(NewVec);
1708  if (!StrDefaultsE.IsKey(attr)) {
1709  StrDefaultsE.AddDat(attr, defaultValue);
1710  } else {
1711  return -1;
1712  }
1713  return 0;
1714 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AddStrAttrN ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str node attribute to the hashmap.

Definition at line 1602 of file network.cpp.

1602  {
1603  int i;
1604  TInt CurrLen;
1605  TVec<TStr> NewVec;
1606  CurrLen = VecOfStrVecsN.Len();
1607  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
1608  NewVec = TVec<TStr>();
1609  for (i = 0; i < MxNId; i++) {
1610  NewVec.Ins(i, defaultValue);
1611  }
1612  VecOfStrVecsN.Add(NewVec);
1613  if (!StrDefaultsN.IsKey(attr)) {
1614  StrDefaultsN.AddDat(attr, defaultValue);
1615  } else {
1616  return -1;
1617  }
1618  return 0;
1619 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:2052
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANet::AppendFltVAttrDatE ( const TEdgeI EdgeI,
const TFlt value,
const TStr attr 
)
inline

Appends value onto the TFltV attribute for the given node.

Definition at line 2927 of file network.h.

2927 { return AppendFltVAttrDatE(EdgeI.GetId(), value, attr); }
int AppendFltVAttrDatE(const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Appends value onto the TFltV attribute for the given node.
Definition: network.h:2927
int TNEANet::AppendFltVAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1337 of file network.cpp.

1337  {
1338  if (!IsEdge(EId)) {
1339  // AddNode(NId);
1340  return -1;
1341  }
1342  TInt location = CheckDenseOrSparseE(attr);
1343  if (location==-1) return -1;
1344  if (UseDense) {
1345  IAssertR(location != 0, TStr::Fmt("Edge %d exists for %s in sparse representation", EId, attr.CStr()));
1347  NewVec[EdgeH.GetKeyId(EId)].Add(value);
1348  } else {
1349  IAssertR(location != 1, TStr::Fmt("Edge %d exists for %s in dense representation", EId, attr.CStr()));
1351  NewHash[EdgeH.GetKeyId(EId)].Add(value);
1352  }
1353  return 0;
1354 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
char * CStr()
Definition: dt.h:479
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int TNEANet::AppendFltVAttrDatN ( const TNodeI NodeI,
const TFlt value,
const TStr attr 
)
inline

Appends value onto the TFltV attribute for the given node.

Definition at line 2887 of file network.h.

2887 { return AppendFltVAttrDatN(NodeI.GetId(), value, attr); }
int AppendFltVAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Appends value onto the TFltV attribute for the given node.
Definition: network.h:2887
int TNEANet::AppendFltVAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1125 of file network.cpp.

1125  {
1126  if (!IsNode(NId)) {
1127  // AddNode(NId);
1128  return -1;
1129  }
1130 
1131  TInt location = CheckDenseOrSparseN(attr);
1132 
1133 
1134  if (location==-1) {
1135  AddFltVAttrN(attr, UseDense);
1136  location = CheckDenseOrSparseN(attr);
1137  }
1138  if (UseDense) {
1139  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
1141  NewVec[NodeH.GetKeyId(NId)].Add(value);
1142  } else {
1143  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
1145  NewHash[NodeH.GetKeyId(NId)].Add(value);
1146  }
1147  return 0;
1148 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
int AddFltVAttrN(const TStr &attr, TBool UseDense=true)
Adds a new FltV node attribute to the hashmap.
Definition: network.cpp:1584
char * CStr()
Definition: dt.h:479
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int TNEANet::AppendIntVAttrDatE ( const TEdgeI EdgeI,
const TInt value,
const TStr attr 
)
inline

Appends value onto the TIntV attribute for the given node.

Definition at line 2918 of file network.h.

2918 { return AppendIntVAttrDatE(EdgeI.GetId(), value, attr); }
int AppendIntVAttrDatE(const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
Definition: network.h:2918
int TNEANet::AppendIntVAttrDatE ( const int &  EId,
const TInt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1317 of file network.cpp.

1317  {
1318  if (!IsEdge(EId)) {
1319  // AddNode(NId);
1320  return -1;
1321  }
1322  TInt location = CheckDenseOrSparseE(attr);
1323  if (location==-1) return -1;
1324  if (UseDense) {
1325  IAssertR(location != 0, TStr::Fmt("Edge %d exists for %s in sparse representation", EId, attr.CStr()));
1327  NewVec[EdgeH.GetKeyId(EId)].Add(value);
1328  } else {
1329  IAssertR(location != 1, TStr::Fmt("Edge %d exists for %s in dense representation", EId, attr.CStr()));
1331  NewHash[EdgeH.GetKeyId(EId)].Add(value);
1332  }
1333  return 0;
1334 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
char * CStr()
Definition: dt.h:479
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int TNEANet::AppendIntVAttrDatN ( const TNodeI NodeI,
const TInt value,
const TStr attr 
)
inline

Appends value onto the TIntV attribute for the given node.

Definition at line 2880 of file network.h.

2880 { return AppendIntVAttrDatN(NodeI.GetId(), value, attr); }
int AppendIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
Definition: network.h:2880
int TNEANet::AppendIntVAttrDatN ( const int &  NId,
const TInt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1102 of file network.cpp.

1102  {
1103  if (!IsNode(NId)) {
1104  // AddNode(NId);
1105  return -1;
1106  }
1107  TInt location = CheckDenseOrSparseN(attr);
1108  if (location==-1) {
1109  AddIntVAttrN(attr, UseDense);
1110  location = CheckDenseOrSparseN(attr);
1111  }
1112  if (UseDense) {
1113  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
1115  NewVec[NodeH.GetKeyId(NId)].Add(value);
1116  } else {
1117  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
1119  NewHash[NodeH.GetKeyId(NId)].Add(value);
1120  }
1121  return 0;
1122 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
int AddIntVAttrN(const TStr &attr, TBool UseDense=true)
Adds a new IntV node attribute to the hashmap.
Definition: network.cpp:1566
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
char * CStr()
Definition: dt.h:479
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 2586 of file network.h.

2586  {
2587  AttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
void AttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of attr names for edge EId.
Definition: network.h:2586
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void TNEANet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 308 of file network.cpp.

308  {
309  Names = TVec<TStr>();
310  while (!EdgeHI.IsEnd()) {
311  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
312  Names.Add(EdgeHI.GetKey());
313  }
314  EdgeHI++;
315  }
316 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:482
const TKey & GetKey() const
Definition: hash.h:80
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::AttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of attr names for node NId.

Definition at line 2531 of file network.h.

2531  {
2532  AttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void AttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of attr names for node NId.
Definition: network.h:2531
void TNEANet::AttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 72 of file network.cpp.

72  {
73  Names = TVec<TStr>();
74  while (!NodeHI.IsEnd()) {
75  if (!NodeAttrIsDeleted(NId, NodeHI)) {
76  Names.Add(NodeHI.GetKey());
77  }
78  NodeHI++;
79  }
80 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:246
const TKey & GetKey() const
Definition: hash.h:80
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2590 of file network.h.

2590  {
2591  AttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void AttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2590
void TNEANet::AttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 318 of file network.cpp.

318  {
319  Values = TVec<TStr>();
320  while (!EdgeHI.IsEnd()) {
321  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
322  Values.Add(GetEdgeAttrValue(EId, EdgeHI));
323  }
324  EdgeHI++;
325  }
326 }
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns edge attribute value, converted to Str type.
Definition: network.cpp:521
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:482
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::AttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2535 of file network.h.

2535  {
2536  AttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
void AttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2535
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::AttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 82 of file network.cpp.

82  {
83  Values = TVec<TStr>();
84  while (!NodeHI.IsEnd()) {
85  if (!NodeAttrIsDeleted(NId, NodeHI)) {
86  Values.Add(GetNodeAttrValue(NId, NodeHI));
87  }
88  NodeHI++;
89  }
90 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:246
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TStr GetNodeAttrValue(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns node attribute value, converted to Str type.
Definition: network.cpp:294
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TAFltI TNEANet::BegEAFltI ( const TStr attr) const
inline

Returns an iterator referring to the first edge's flt attribute.

Definition at line 2768 of file network.h.

2768  {
2769  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2770  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAFltVI TNEANet::BegEAFltVI ( const TStr attr) const
inline

Returns an iterator referring to the first edge's int attribute.

Definition at line 2705 of file network.h.

2705  {
2706  TVec<TFltV>::TIter HI = NULL;
2708  TInt location = CheckDenseOrSparseE(attr);
2709  TBool IsDense = true;
2710  if (location != -1) {
2711  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2712  if (location == 1) {
2713  HI = VecOfFltVecVecsE[index].BegI();
2714  } else {
2715  IsDense = false;
2716  HHI = VecOfFltHashVecsE[index].BegI();
2717  }
2718  }
2719  return TAFltVI(HI, HHI, attr, true, this, IsDense);
2720  }
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::BegEAIntI ( const TStr attr) const
inline

Returns an iterator referring to the first edge's int attribute.

Definition at line 2640 of file network.h.

2640  {
2641  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2642  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAIntVI TNEANet::BegEAIntVI ( const TStr attr) const
inline

Returns an iterator referring to the first edge's int attribute.

Definition at line 2653 of file network.h.

2653  {
2654  TVec<TIntV>::TIter HI = NULL;
2656  TInt location = CheckDenseOrSparseE(attr);
2657  TBool IsDense = true;
2658  if (location != -1) {
2659  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2660  if (location == 1) {
2661  HI = VecOfIntVecVecsE[index].BegI();
2662  } else {
2663  IsDense = false;
2664  HHI = VecOfIntHashVecsE[index].BegI();
2665  }
2666  }
2667  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2668  }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::BegEAStrI ( const TStr attr) const
inline

Returns an iterator referring to the first edge's str attribute.

Definition at line 2757 of file network.h.

2757  {
2758  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this); }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TEdgeI TNEANet::BegEI ( ) const
inline

Returns an iterator referring to the first edge in the graph.

Definition at line 2812 of file network.h.

2812 { return TEdgeI(EdgeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:213
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAFltI TNEANet::BegNAFltI ( const TStr attr) const
inline

Returns an iterator referring to the first node's flt attribute.

Definition at line 2521 of file network.h.

2521  {
2522  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
TAFltVI TNEANet::BegNAFltVI ( const TStr attr) const
inline

Returns an iterator referring to the first node's flt attribute.

Definition at line 2457 of file network.h.

2457  {
2458  TVec<TFltV>::TIter HI = NULL;
2460  TInt location = CheckDenseOrSparseN(attr);
2461  TBool IsDense = true;
2462  if (location != -1) {
2463  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2464  if (location == 1) {
2465  HI = VecOfFltVecVecsN[index].BegI();
2466  } else {
2467  IsDense = false;
2468  HHI = VecOfFltHashVecsN[index].BegI();
2469  }
2470  }
2471  return TAFltVI(HI, HHI, attr, false, this, IsDense);
2472  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::BegNAIntI ( const TStr attr) const
inline

Returns an iterator referring to the first node's int attribute.

Definition at line 2393 of file network.h.

2393  {
2394  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAIntVI TNEANet::BegNAIntVI ( const TStr attr) const
inline

Returns an iterator referring to the first node's int attribute.

Definition at line 2403 of file network.h.

2403  {
2404  TVec<TIntV>::TIter HI = NULL;
2406  TInt location = CheckDenseOrSparseN(attr);
2407  TBool IsDense = true;
2408  if (location != -1) {
2409  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2410  if (location == 1) {
2411  HI = VecOfIntVecVecsN[index].BegI();
2412  } else {
2413  IsDense = false;
2414  HHI = VecOfIntHashVecsN[index].BegI();
2415  }
2416  }
2417  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2418  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::BegNAStrI ( const TStr attr) const
inline

Returns an iterator referring to the first node's str attribute.

Definition at line 2511 of file network.h.

2511  {
2512 
2513  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal2 Val2
Definition: ds.h:35
TNodeI TNEANet::BegNI ( ) const
inline

Returns an iterator referring to the first node in the graph.

Definition at line 2387 of file network.h.

2387 { return TNodeI(NodeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:213
THash< TInt, TNode > NodeH
Definition: network.h:2053
TInt TNEANet::CheckDenseOrSparseE ( const TStr attr) const
inlineprotected

Definition at line 2116 of file network.h.

2116  {
2117  if (!KeyToDenseE.IsKey(attr)) return -1;
2118  if (KeyToDenseE.GetDat(attr)) return 1;
2119  return 0;
2120  }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TInt TNEANet::CheckDenseOrSparseN ( const TStr attr) const
inlineprotected

Return 1 if in Dense, 0 if in Sparse, -1 if neither.

Definition at line 2110 of file network.h.

2110  {
2111  if (!KeyToDenseN.IsKey(attr)) return -1;
2112  if (KeyToDenseN.GetDat(attr)) return 1;
2113  return 0;
2114  }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
bool IsKey(const TKey &Key) const
Definition: hash.h:258
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
void TNEANet::Clr ( )
inline

Deletes all nodes and edges from the graph.

Definition at line 2836 of file network.h.

2836  { MxNId=0; MxEId=0; NodeH.Clr(); EdgeH.Clr();
2841  VecOfFltVecVecsN.Clr(); VecOfFltVecVecsE.Clr();
2842  SAttrN.Clr(); SAttrE.Clr();}
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
void Clr()
Clears the contents of the attribute map.
Definition: attr.h:37
void TNEANet::ConvertToSparse ( )
inline

Definition at line 2279 of file network.h.

2279  {
2280  TInt VecLength = VecOfIntVecVecsN.Len();
2282  if (VecLength != 0) {
2284  for (iter = KeyToIndexTypeN.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2285  if (iter.GetDat().Val1 == IntVType) {
2286  TStr attribute = iter.GetKey();
2287  TInt index = iter.GetDat().Val2();
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]);
2291  }
2292  }
2293  KeyToDenseN.AddDat(attribute, TBool(false));
2294  }
2295  }
2296  }
2297  VecOfIntVecVecsN.Clr();
2298 
2299  VecLength = VecOfIntVecVecsE.Len();
2300  if (VecLength != 0) {
2302  for (iter = KeyToIndexTypeE.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2303  if (iter.GetDat().Val1 == IntVType) {
2304  TStr attribute = iter.GetKey();
2305  TInt index = iter.GetDat().Val2();
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]);
2309  }
2310  }
2311  KeyToDenseE.AddDat(attribute, TBool(false));
2312  }
2313  }
2314  }
2315  VecOfIntVecVecsE.Clr();
2316 
2317  VecLength = VecOfFltVecVecsN.Len();
2318  if (VecLength != 0) {
2320  for (iter = KeyToIndexTypeN.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2321  if (iter.GetDat().Val1 == FltVType) {
2322  TStr attribute = iter.GetKey();
2323  TInt index = iter.GetDat().Val2();
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]);
2327  }
2328  }
2329  KeyToDenseN.AddDat(attribute, TBool(false));
2330  }
2331  }
2332  }
2333  VecOfFltVecVecsN.Clr();
2334 
2335  VecLength = VecOfFltVecVecsE.Len();
2336  if (VecLength != 0) {
2338  for (iter = KeyToIndexTypeE.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2339  if (iter.GetDat().Val1 == FltVType) {
2340  TStr attribute = iter.GetKey();
2341  TInt index = iter.GetDat().Val2();
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]);
2345  }
2346  }
2347  KeyToDenseE.AddDat(attribute, TBool(false));
2348  }
2349  }
2350  }
2351  VecOfFltVecVecsE.Clr();
2352  }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
Definition: dt.h:412
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal1 Val1
Definition: ds.h:34
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
Definition: dt.h:974
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
void TNEANet::Defrag ( const bool &  OnlyNodeLinks = false)

Defragments the graph.

After performing many node and edge insertions and deletions to a graph, the graph data structure will be fragmented in memory. This function compacts down the graph data structure and frees unneeded memory.

Definition at line 901 of file network.cpp.

901  {
902  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
903  TNode& Node = NodeH[kid];
904  Node.InEIdV.Pack(); Node.OutEIdV.Pack();
905  }
906  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
907  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
908 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
void Defrag()
Definition: hash.h:555
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
THash< TInt, TNode > NodeH
Definition: network.h:2053
void Pack()
Definition: hash.h:289
int TNEANet::DelAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Deletes the edge attribute for NodeI.

Definition at line 3009 of file network.h.

3009 { return DelAttrDatE(EdgeI.GetId(), attr); }
int DelAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Deletes the edge attribute for NodeI.
Definition: network.h:3009
int TNEANet::DelAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1524 of file network.cpp.

1524  {
1525  // TODO(nkhadke): add error checking
1526  TInt vecType = KeyToIndexTypeE(attr).Val1;
1527  if (vecType == IntType) {
1529  } else if (vecType == StrType) {
1531  } else if (vecType == FltType) {
1533  } else if (vecType == IntVType) {
1534  TInt location = CheckDenseOrSparseE(attr);
1535  if (location == 0) VecOfIntHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)] = TIntV();
1537  } else if (vecType == FltVType) {
1538  TInt location = CheckDenseOrSparseE(attr);
1539  if (location == 0) VecOfFltHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)] = TFltV();
1541  } else {
1542  return -1;
1543  }
1544  return 0;
1545 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2044
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2046
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
TVec< TFlt > TFltV
Definition: ds.h:1596
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:2048
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
int TNEANet::DelAttrDatN ( const TNodeI NodeI,
const TStr attr 
)
inline

Deletes the node attribute for NodeI.

Definition at line 3006 of file network.h.

3006 { return DelAttrDatN(NodeI.GetId(), attr); }
int DelAttrDatN(const TNodeI &NodeI, const TStr &attr)
Deletes the node attribute for NodeI.
Definition: network.h:3006
int TNEANet::DelAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1502 of file network.cpp.

1502  {
1503  TInt vecType = KeyToIndexTypeN(attr).Val1;
1504  if (vecType == IntType) {
1506  } else if (vecType == StrType) {
1508  } else if (vecType == FltType) {
1510  } else if (vecType ==IntVType) {
1511  TInt location = CheckDenseOrSparseN(attr);
1512  if (location == 0) VecOfIntHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)] = TIntV();
1514  } else if (vecType == FltVType) { // added by Avery
1515  TInt location = CheckDenseOrSparseN(attr);
1516  if (location == 0) VecOfFltHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)] = TFltV();
1518  } else {
1519  return -1;
1520  }
1521  return 0;
1522 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2040
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFlt > TFltV
Definition: ds.h:1596
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2042
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2038
int TNEANet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 1769 of file network.cpp.

1769  {
1770  TInt vecType = KeyToIndexTypeE(attr).Val1;
1771  if (vecType == IntType) {
1773  if (IntDefaultsE.IsKey(attr)) {
1774  IntDefaultsE.DelKey(attr);
1775  }
1776  } else if (vecType == StrType) {
1778  if (StrDefaultsE.IsKey(attr)) {
1779  StrDefaultsE.DelKey(attr);
1780  }
1781  } else if (vecType == FltType) {
1783  if (FltDefaultsE.IsKey(attr)) {
1784  FltDefaultsE.DelKey(attr);
1785  }
1786  } else {
1787  return -1;
1788  }
1789  KeyToIndexTypeE.DelKey(attr);
1790  return 0;
1791 }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
void DelKey(const TKey &Key)
Definition: hash.h:404
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
Definition: dt.h:1137
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int TNEANet::DelAttrN ( const TStr attr)

Removes all the values for node attr.

Definition at line 1735 of file network.cpp.

1735  {
1736  TInt vecType = KeyToIndexTypeN(attr).Val1;
1737  if (vecType == IntType) {
1739  if (IntDefaultsN.IsKey(attr)) {
1740  IntDefaultsN.DelKey(attr);
1741  }
1742  } else if (vecType == StrType) {
1744  if (StrDefaultsN.IsKey(attr)) {
1745  StrDefaultsN.DelKey(attr);
1746  }
1747  } else if (vecType == FltType) {
1749  if (FltDefaultsN.IsKey(attr)) {
1750  FltDefaultsN.DelKey(attr);
1751  }
1752  } else if (vecType == IntVType) {
1753  TInt location = CheckDenseOrSparseN(attr);
1754  if (location == 1) VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TIntV>();
1756  KeyToDenseN.DelKey(attr);
1757  } else if (vecType == FltVType) {
1758  TInt location = CheckDenseOrSparseN(attr);
1759  if (location == 1) VecOfFltVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TFltV>();
1761  KeyToDenseN.DelKey(attr);
1762  } else {
1763  return -1;
1764  }
1765  KeyToIndexTypeN.DelKey(attr);
1766  return 0;
1767 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
void DelKey(const TKey &Key)
Definition: hash.h:404
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
Definition: dt.h:1137
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
bool IsKey(const TKey &Key) const
Definition: hash.h:258
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
void TNEANet::DelEdge ( const int &  EId)

Deletes an edge with edge ID EId from the graph.

Definition at line 828 of file network.cpp.

828  {
829  int i;
830 
831  IAssert(IsEdge(EId));
832  const int SrcNId = GetEdge(EId).GetSrcNId();
833  const int DstNId = GetEdge(EId).GetDstNId();
834  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
835  GetNode(DstNId).InEIdV.DelIfIn(EId);
836  TInt Id(EId);
837  SAttrE.DelSAttrId(Id);
838 
839  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
840  TVec<TInt>& IntVec = VecOfIntVecsE[i];
841  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
842  }
843  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
844  TVec<TStr>& StrVec = VecOfStrVecsE[i];
845  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
846  }
847  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
848  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
849  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
850  }
851 
852  EdgeH.DelKey(EId);
853 }
#define IAssert(Cond)
Definition: bd.h:262
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1212
int GetSrcNId() const
Definition: network.h:1782
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TNode & GetNode(const int &NId)
Definition: network.h:2030
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TIntV OutEIdV
Definition: network.h:1749
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
void DelKey(const TKey &Key)
Definition: hash.h:404
TAttr SAttrE
Definition: network.h:2073
static const int Mn
Definition: dt.h:1141
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
int GetDstNId() const
Definition: network.h:1783
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1137
TEdge & GetEdge(const int &EId)
Definition: network.h:2032
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TIntV InEIdV
Definition: network.h:1749
static const double Mn
Definition: dt.h:1390
void TNEANet::DelEdge ( const int &  SrcNId,
const int &  DstNId,
const bool &  IsDir = true 
)

Deletes all edges between node IDs SrcNId and DstNId from the graph.

If the edge (SrcNId, DstNId) does not exist in the graph function still completes. But the function aborts if SrcNId or DstNId are not nodes in the graph.

Definition at line 856 of file network.cpp.

856  {
857  int EId = 0;
858  bool Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
859  IAssert(Edge); // there is at least one edge
860  while (Edge) {
861  DelEdge(EId);
862  Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
863  }
864 }
#define IAssert(Cond)
Definition: bd.h:262
void DelEdge(const int &EId)
Deletes an edge with edge ID EId from the graph.
Definition: network.cpp:828
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
int TNEANet::DelFromFltVAttrDatN ( const TNodeI NodeI,
const TFlt value,
const TStr attr 
)
inline

Deletes value from the TFltV attribute for the given node.

Definition at line 2890 of file network.h.

2890 { return DelFromFltVAttrDatN(NodeI.GetId(), value, attr); }
int DelFromFltVAttrDatN(const TNodeI &NodeI, const TFlt &value, const TStr &attr)
Deletes value from the TFltV attribute for the given node.
Definition: network.h:2890
int TNEANet::DelFromFltVAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 1176 of file network.cpp.

1176  {
1177  TInt CurrLen;
1178  if (!IsNode(NId)) {
1179  // AddNode(NId);
1180  return -1;
1181  }
1182  TInt location = CheckDenseOrSparseN(attr);
1183  if (location != -1) {
1184  if (location == 1) {
1186  if (!NewVec[NodeH.GetKeyId(NId)].DelIfIn(value)) {
1187  return -1;
1188  }
1189  } else {
1191  if (!NewHash[NodeH.GetKeyId(NId)].DelIfIn(value)) {
1192  return -1;
1193  }
1194  }
1195  } else {
1196  return -1;
1197  }
1198  return 0;
1199 }
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1212
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
int TNEANet::DelFromIntVAttrDatN ( const TNodeI NodeI,
const TInt value,
const TStr attr 
)
inline

Deletes value from the TIntV attribute for the given node.

Definition at line 2883 of file network.h.

2883 { return DelFromIntVAttrDatN(NodeI.GetId(), value, attr); }
int DelFromIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Deletes value from the TIntV attribute for the given node.
Definition: network.h:2883
int TNEANet::DelFromIntVAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 1150 of file network.cpp.

1150  {
1151  TInt CurrLen;
1152  if (!IsNode(NId)) {
1153  // AddNode(NId);
1154  return -1;
1155  }
1156  TInt location = CheckDenseOrSparseN(attr);
1157  if (location != -1) {
1158  if (location == 1) {
1160  if (!NewVec[NodeH.GetKeyId(NId)].DelIfIn(value)) {
1161  return -1;
1162  }
1163  } else {
1165  if (!NewHash[NodeH.GetKeyId(NId)].DelIfIn(value)) {
1166  return -1;
1167  }
1168  }
1169  } else {
1170  return -1;
1171  }
1172  return 0;
1173 }
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1212
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
void TNEANet::DelNode ( const int &  NId)
virtual

Deletes node of ID NId from the graph.

If the node of ID NId does not exist the function aborts.

Reimplemented in TModeNet.

Definition at line 631 of file network.cpp.

631  {
632  int i;
633  TInt Id(NId);
634  SAttrN.DelSAttrId(Id);
635  const TNode& Node = GetNode(NId);
636  for (int out = 0; out < Node.GetOutDeg(); out++) {
637  const int EId = Node.GetOutEId(out);
638  const TEdge& Edge = GetEdge(EId);
639  IAssert(Edge.GetSrcNId() == NId);
640  GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
641  // Delete from Edge Attributes
642  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
643  TVec<TInt>& IntVec = VecOfIntVecsE[i];
644  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
645  }
646  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
647  TVec<TStr>& StrVec = VecOfStrVecsE[i];
648  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
649  }
650  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
651  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
652  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
653  }
654  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
655  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
656  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
657  }
658  for (i = 0; i < VecOfFltVecVecsE.Len(); i++) {
659  TVec<TFltV>& FltVecV = VecOfFltVecVecsE[i];
660  FltVecV[EdgeH.GetKeyId(EId)] = TFltV();
661  }
662  for (i = 0; i < VecOfIntHashVecsE.Len(); i++) {
663  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsE[i];
664  if (IntHashV.IsKey(EdgeH.GetKeyId(EId))) {
665  IntHashV.DelKey(EdgeH.GetKeyId(EId));
666  }
667  }
668  for (i = 0; i < VecOfFltHashVecsE.Len(); i++) {
669  THash<TInt, TFltV>& FltHashV = VecOfFltHashVecsE[i];
670  if (FltHashV.IsKey(EdgeH.GetKeyId(EId))) {
671  FltHashV.DelKey(EdgeH.GetKeyId(EId));
672  }
673  }
674  EdgeH.DelKey(EId);
675 
676  }
677  for (int in = 0; in < Node.GetInDeg(); in++) {
678  const int EId = Node.GetInEId(in);
679  const TEdge& Edge = GetEdge(EId);
680  IAssert(Edge.GetDstNId() == NId);
681  GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
682  // Delete from Edge Attributes
683  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
684  TVec<TInt>& IntVec = VecOfIntVecsE[i];
685  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
686  }
687  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
688  TVec<TStr>& StrVec = VecOfStrVecsE[i];
689  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
690  }
691  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
692  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
693  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
694  }
695  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
696  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
697  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
698  }
699  for (i = 0; i < VecOfFltVecVecsE.Len(); i++) {
700  TVec<TFltV>& FltVecV = VecOfFltVecVecsE[i];
701  FltVecV[EdgeH.GetKeyId(EId)] = TFltV();
702  }
703  for (i = 0; i < VecOfIntHashVecsE.Len(); i++) {
704  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsE[i];
705  if (IntHashV.IsKey(EdgeH.GetKeyId(EId))) {
706  IntHashV.DelKey(EdgeH.GetKeyId(EId));
707  }
708  }
709  for (i = 0; i < VecOfFltHashVecsE.Len(); i++) {
710  THash<TInt, TFltV>& FltHashV = VecOfFltHashVecsE[i];
711  if (FltHashV.IsKey(EdgeH.GetKeyId(EId))) {
712  FltHashV.DelKey(EdgeH.GetKeyId(EId));
713  }
714  }
715  EdgeH.DelKey(EId);
716  }
717 
718  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
719  TVec<TInt>& IntVec = VecOfIntVecsN[i];
720  IntVec[NodeH.GetKeyId(NId)] = TInt::Mn;
721  }
722  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
723  TVec<TStr>& StrVec = VecOfStrVecsN[i];
724  StrVec[NodeH.GetKeyId(NId)] = TStr::GetNullStr();
725  }
726  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
727  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
728  FltVec[NodeH.GetKeyId(NId)] = TFlt::Mn;
729  }
730  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
731  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
732  IntVecV[NodeH.GetKeyId(NId)] = TIntV();
733  }
734  for (i = 0; i < VecOfFltVecVecsN.Len(); i++) {
735  TVec<TFltV>& FltVecV = VecOfFltVecVecsN[i];
736  FltVecV[NodeH.GetKeyId(NId)] = TFltV();
737  }
738  for (i = 0; i < VecOfIntHashVecsN.Len(); i++) {
739  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsN[i];
740  if (IntHashV.IsKey(NodeH.GetKeyId(NId))) {
741  IntHashV.DelKey(NodeH.GetKeyId(NId));
742  }
743  }
744  for (i = 0; i < VecOfFltHashVecsN.Len(); i++) {
745  THash<TInt, TFltV>& FltHashV = VecOfFltHashVecsN[i];
746  if (FltHashV.IsKey(NodeH.GetKeyId(NId))) {
747  FltHashV.DelKey(NodeH.GetKeyId(NId));
748  }
749  }
750  NodeH.DelKey(NId);
751 }
#define IAssert(Cond)
Definition: bd.h:262
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TNode & GetNode(const int &NId)
Definition: network.h:2030
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TAttr SAttrN
Definition: network.h:2072
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
void DelKey(const TKey &Key)
Definition: hash.h:404
static const int Mn
Definition: dt.h:1141
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1137
TEdge & GetEdge(const int &EId)
Definition: network.h:2032
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
TVec< TFlt > TFltV
Definition: ds.h:1596
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVec< TInt > TIntV
Definition: ds.h:1594
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1390
void TNEANet::DelNode ( const TNode NodeI)
inline

Deletes node of ID NodeI.GetId() from the graph.

Definition at line 2383 of file network.h.

2383 { DelNode(NodeI.GetId()); }
virtual void DelNode(const int &NId)
Deletes node of ID NId from the graph.
Definition: network.cpp:631
int TNEANet::DelSAttrDatE ( const TInt EId,
const TStr AttrName 
)

Deletes sparse attribute with name AttrName from edge with id EId.

Definition at line 2075 of file network.cpp.

2075  {
2076  if (!IsEdge(EId)) {
2077  return -1;
2078  }
2079  return SAttrE.DelSAttrDat(EId, AttrName);
2080 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::DelSAttrDatE ( const TInt EId,
const TInt AttrId 
)

Deletes sparse attribute with id AttrId from edge with id EId.

Definition at line 2082 of file network.cpp.

2082  {
2083  if (!IsEdge(EId)) {
2084  return -1;
2085  }
2086  return SAttrE.DelSAttrDat(EId, AttrId);
2087 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int TNEANet::DelSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from EdgeI.

Definition at line 3327 of file network.h.

3327  {
3328  return DelSAttrDatE(EdgeI.GetId(), AttrName);
3329  }
int DelSAttrDatE(const TInt &EId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2075
int TNEANet::DelSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId 
)
inline

Deletes sparse attribute with id AttrId from EdgeI.

Definition at line 3331 of file network.h.

3331  {
3332  return DelSAttrDatE(EdgeI.GetId(), AttrId);
3333  }
int DelSAttrDatE(const TInt &EId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2075
int TNEANet::DelSAttrDatN ( const TInt NId,
const TStr AttrName 
)

Deletes sparse attribute with name AttrName from node with id NId.

Definition at line 1949 of file network.cpp.

1949  {
1950  if (!IsNode(NId)) {
1951  return -1;
1952  }
1953  return SAttrN.DelSAttrDat(NId, AttrName);
1954 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::DelSAttrDatN ( const TInt NId,
const TInt AttrId 
)

Deletes sparse attribute with id AttrId from node with id NId.

Definition at line 1956 of file network.cpp.

1956  {
1957  if (!IsNode(NId)) {
1958  return -1;
1959  }
1960  return SAttrN.DelSAttrDat(NId, AttrId);
1961 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
TAttr SAttrN
Definition: network.h:2072
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::DelSAttrDatN ( const TNodeI NodeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from NodeI.

Definition at line 3209 of file network.h.

3209  {
3210  return DelSAttrDatN(NodeI.GetId(), AttrName);
3211  }
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1949
int TNEANet::DelSAttrDatN ( const TNodeI NodeI,
const TInt AttrId 
)
inline

Deletes sparse attribute with id AttrId from NodeI.

Definition at line 3213 of file network.h.

3213  {
3214  return DelSAttrDatN(NodeI.GetId(), AttrId);
3215  }
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1949
void TNEANet::Dump ( FILE *  OutF = stdout) const

Print the graph in a human readable form to an output stream OutF.

Definition at line 963 of file network.cpp.

963  {
964  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
965  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
966  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network with Attributes: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
967  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
968  fprintf(OutF, " %*d:", NodePlaces, NodeI.GetId());
969  fprintf(OutF, " in[%d]", NodeI.GetInDeg());
970  for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
971  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
972  //fprintf(OutF, "\n");
973  fprintf(OutF, " out[%d]", NodeI.GetOutDeg());
974  for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
975  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
976  //fprintf(OutF, "\n");
977 
978  // load node attributes
979  TIntV IntAttrN;
980  IntAttrValueNI(NodeI.GetId(), IntAttrN);
981  fprintf(OutF, " nai[%d]", IntAttrN.Len());
982  for (int i = 0; i < IntAttrN.Len(); i++) {
983  fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
984  //fprintf(OutF, "\n");
985 
986  TStrV StrAttrN;
987  StrAttrValueNI(NodeI.GetId(), StrAttrN);
988  fprintf(OutF, " nas[%d]", StrAttrN.Len());
989  for (int i = 0; i < StrAttrN.Len(); i++) {
990  fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
991  //fprintf(OutF, "\n");
992 
993  TFltV FltAttrN;
994  FltAttrValueNI(NodeI.GetId(), FltAttrN);
995  fprintf(OutF, " naf[%d]", FltAttrN.Len());
996  for (int i = 0; i < FltAttrN.Len(); i++) {
997  fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }
998  //fprintf(OutF, "\n");
999  fprintf(OutF, "\n");
1000  }
1001  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
1002  fprintf(OutF, " %*d: %*d -> %*d", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
1003 
1004  // load edge attributes
1005  TIntV IntAttrE;
1006  IntAttrValueEI(EdgeI.GetId(), IntAttrE);
1007  fprintf(OutF, " eai[%d]", IntAttrE.Len());
1008  for (int i = 0; i < IntAttrE.Len(); i++) {
1009  fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]());
1010  }
1011 
1012  TStrV StrAttrE;
1013  StrAttrValueEI(EdgeI.GetId(), StrAttrE);
1014  fprintf(OutF, " eas[%d]", StrAttrE.Len());
1015  for (int i = 0; i < StrAttrE.Len(); i++) {
1016  fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]());
1017  }
1018  TFltV FltAttrE;
1019  FltAttrValueEI(EdgeI.GetId(), FltAttrE);
1020  fprintf(OutF, " eaf[%d]", FltAttrE.Len());
1021  for (int i = 0; i < FltAttrE.Len(); i++) {
1022  fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]());
1023  }
1024  fprintf(OutF, "\n");
1025  }
1026  //fprintf(OutF, "\n");
1027 }
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:2363
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2573
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2598
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2627
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2635
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2812
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2814
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2581
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2544
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: network.h:2389
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2785
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: network.h:2387
bool TNEANet::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge attr iterator.

Definition at line 482 of file network.cpp.

482  {
483  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
484  bool IntVDel = EdgeAttrIsIntVDeleted(EId, EdgeHI);
485  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
486  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
487  bool FltVDel = EdgeAttrIsFltVDeleted(EId, EdgeHI);
488  return IntDel || StrDel || FltDel || IntVDel || FltVDel;
489 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt attr iterator.
Definition: network.cpp:515
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int attr iterator.
Definition: network.cpp:491
bool EdgeAttrIsFltVDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt vector attr iterator.
Definition: network.cpp:503
bool EdgeAttrIsIntVDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int vector attr iterator.
Definition: network.cpp:497
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge str attr iterator.
Definition: network.cpp:509
bool TNEANet::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge flt attr iterator.

Definition at line 515 of file network.cpp.

515  {
516  return (EdgeHI.GetDat().Val1 == FltType &&
517  GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
518  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
519 }
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:2048
bool TNEANet::EdgeAttrIsFltVDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge flt vector attr iterator.

Definition at line 503 of file network.cpp.

503  {
504  return (EdgeHI.GetDat().Val1 == FltVType &&
505  TFltV() == this->VecOfFltVecVecsE.GetVal(
506  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
507 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TDat & GetDat() const
Definition: hash.h:81
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFlt > TFltV
Definition: ds.h:1596
bool TNEANet::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge int attr iterator.

Definition at line 491 of file network.cpp.

491  {
492  return (EdgeHI.GetDat().Val1 == IntType &&
493  GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
494  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
495 }
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2044
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
bool TNEANet::EdgeAttrIsIntVDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge int vector attr iterator.

Definition at line 497 of file network.cpp.

497  {
498  return (EdgeHI.GetDat().Val1 == IntVType &&
499  TIntV() == this->VecOfIntVecVecsE.GetVal(
500  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
501 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TDat & GetDat() const
Definition: hash.h:81
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TInt > TIntV
Definition: ds.h:1594
bool TNEANet::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns true if EId attr deleted for current edge str attr iterator.

Definition at line 509 of file network.cpp.

509  {
510  return (EdgeHI.GetDat().Val1 == StrType &&
511  GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
512  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
513 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TDat & GetDat() const
Definition: hash.h:81
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2046
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
bool TNEANet::Empty ( ) const
inline

Tests whether the graph is empty (has zero nodes).

Definition at line 2834 of file network.h.

2834 { return GetNodes()==0; }
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:2363
TAFltI TNEANet::EndEAFltI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end edge's attribute.

Definition at line 2772 of file network.h.

2772  {
2773  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2774  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
TAFltVI TNEANet::EndEAFltVI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end edge's attribute.

Definition at line 2722 of file network.h.

2722  {
2723  TVec<TFltV>::TIter HI = NULL;
2725  TInt location = CheckDenseOrSparseE(attr);
2726  TBool IsDense = true;
2727  if (location != -1) {
2728  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2729  if (location == 1) {
2730  HI = VecOfFltVecVecsE[index].EndI();
2731  } else {
2732  IsDense = false;
2733  HHI = VecOfFltHashVecsE[index].EndI();
2734  }
2735  }
2736  return TAFltVI(HI, HHI, attr, true, this, IsDense);
2737  }
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::EndEAIntI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end edge's attribute.

Definition at line 2644 of file network.h.

2644  {
2645  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2646  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVal2 Val2
Definition: ds.h:35
TAIntVI TNEANet::EndEAIntVI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end edge's attribute.

Definition at line 2670 of file network.h.

2670  {
2671  TVec<TIntV>::TIter HI = NULL;
2673  TInt location = CheckDenseOrSparseE(attr);
2674  TBool IsDense = true;
2675  if (location != -1) {
2676  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2677  if (location == 1) {
2678  HI = VecOfIntVecVecsE[index].EndI();
2679  } else {
2680  IsDense = false;
2681  HHI = VecOfIntHashVecsE[index].EndI();
2682  }
2683  }
2684  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2685  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::EndEAStrI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end edge's attribute.

Definition at line 2760 of file network.h.

2760  {
2761  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2762  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TEdgeI TNEANet::EndEI ( ) const
inline

Returns an iterator referring to the past-the-end edge in the graph.

Definition at line 2814 of file network.h.

2814 { return TEdgeI(EdgeH.EndI(), this); }
TIter EndI() const
Definition: hash.h:218
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAFltI TNEANet::EndNAFltI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2524 of file network.h.

2524  {
2525  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
TAFltVI TNEANet::EndNAFltVI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2474 of file network.h.

2474  {
2475  TVec<TFltV>::TIter HI = NULL;
2477  TInt location = CheckDenseOrSparseN(attr);
2478  TBool IsDense = true;
2479  if (location != -1) {
2480  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2481  if (location == 1) {
2482  HI = VecOfFltVecVecsN[index].EndI();
2483  } else {
2484  IsDense = false;
2485  HHI = VecOfFltHashVecsN[index].EndI();
2486  }
2487  }
2488  return TAFltVI(HI, HHI, attr, false, this, IsDense);
2489  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::EndNAIntI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2396 of file network.h.

2396  {
2397  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal2 Val2
Definition: ds.h:35
TAIntVI TNEANet::EndNAIntVI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2420 of file network.h.

2420  {
2421  TVec<TIntV>::TIter HI = NULL;
2423  TInt location = CheckDenseOrSparseN(attr);
2424  TBool IsDense = true;
2425  if (location != -1) {
2426  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2427  if (location == 1) {
2428  HI = VecOfIntVecVecsN[index].EndI();
2429  } else {
2430  IsDense = false;
2431  HHI = VecOfIntHashVecsN[index].EndI();
2432  }
2433  }
2434  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2435  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::EndNAStrI ( const TStr attr) const
inline

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2515 of file network.h.

2515  {
2516  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal2 Val2
Definition: ds.h:35
TNodeI TNEANet::EndNI ( ) const
inline

Returns an iterator referring to the past-the-end node in the graph.

Definition at line 2389 of file network.h.

2389 { return TNodeI(NodeH.EndI(), this); }
TIter EndI() const
Definition: hash.h:218
THash< TInt, TNode > NodeH
Definition: network.h:2053
void TNEANet::FltAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2631 of file network.h.

2631  {
2632  FltAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void FltAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: network.h:2631
void TNEANet::FltAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 432 of file network.cpp.

432  {
433  Names = TVec<TStr>();
434  while (!EdgeHI.IsEnd()) {
435  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
436  Names.Add(EdgeHI.GetKey());
437  }
438  EdgeHI++;
439  }
440 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt attr iterator.
Definition: network.cpp:515
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2577 of file network.h.

2577  {
2578  FltAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
void FltAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: network.h:2577
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::FltAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 196 of file network.cpp.

196  {
197  Names = TVec<TStr>();
198  while (!NodeHI.IsEnd()) {
199  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
200  Names.Add(NodeHI.GetKey());
201  }
202  NodeHI++;
203  }
204 }
const TKey & GetKey() const
Definition: hash.h:80
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node flt attr iterator.
Definition: network.cpp:286
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2635 of file network.h.

2635  {
2636  FltAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2635
void TNEANet::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TFltV Values 
) const

Definition at line 442 of file network.cpp.

442  {
443  Values = TVec<TFlt>();
444  while (!EdgeHI.IsEnd()) {
445  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
446  TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
447  Values.Add(val);
448  }
449  EdgeHI++;
450  }
451 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt attr iterator.
Definition: network.cpp:515
Definition: dt.h:1386
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltAttrValueNI ( const TInt NId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2581 of file network.h.

2581  {
2582  FltAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2581
void TNEANet::FltAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TFltV Values 
) const

Definition at line 206 of file network.cpp.

206  {
207  Values = TVec<TFlt>();
208  while (!NodeHI.IsEnd()) {
209  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
210  TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId)));
211  Values.Add(val);
212  }
213  NodeHI++;
214  }
215 }
Definition: dt.h:1386
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node flt attr iterator.
Definition: network.cpp:286
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TInt, TNode > NodeH
Definition: network.h:2053
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltVAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of flt attr names for edge EId.

Definition at line 2613 of file network.h.

2613  {
2614  FltVAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
void FltVAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of flt attr names for edge EId.
Definition: network.h:2613
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void TNEANet::FltVAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 380 of file network.cpp.

380  {
381  Names = TVec<TStr>();
382  while (!EdgeHI.IsEnd()) {
383  if (EdgeHI.GetDat().Val1 == FltVType) {
384  Names.Add(EdgeHI.GetKey());
385  }
386  EdgeHI++;
387  }
388 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltVAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of flt attr names for node NId.

Definition at line 2559 of file network.h.

2559  {
2560  FltVAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void FltVAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of flt attr names for node NId.
Definition: network.h:2559
void TNEANet::FltVAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 144 of file network.cpp.

144  {
145  Names = TVec<TStr>();
146  while (!NodeHI.IsEnd()) {
147  if (NodeHI.GetDat().Val1 == FltVType) {
148  Names.Add(NodeHI.GetKey());
149  }
150  NodeHI++;
151  }
152 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltVAttrValueEI ( const TInt EId,
TVec< TFltV > &  Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2617 of file network.h.

2617  {
2618  FltVAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void FltVAttrValueEI(const TInt &EId, TVec< TFltV > &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2617
void TNEANet::FltVAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TVec< TFltV > &  Values 
) const

Definition at line 390 of file network.cpp.

390  {
391  Values = TVec<TFltV>();
392  while (!EdgeHI.IsEnd()) {
393  if (EdgeHI.GetDat().Val1 == FltVType) {
394  TInt index = EdgeHI.GetDat().Val2;
395  TStr attr = EdgeHI.GetKey();
396  TInt loc = CheckDenseOrSparseE(attr);
397  if (loc == 1) {
398  TFltV val = this->VecOfFltVecVecsE.GetVal(index).GetVal(EdgeH.GetKeyId(EId));
399  if (val.Len() != 0) Values.Add(val);
400  } else {
401  const THash<TInt, TFltV>& NewHash = VecOfFltHashVecsE[index];
402  if (NewHash.IsKey(EdgeH.GetKeyId(EId))) {
403  Values.Add(NewHash[EdgeH.GetKeyId(EId)]);
404  }
405  }
406  }
407  EdgeHI++;
408  }
409 }
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::FltVAttrValueNI ( const TInt NId,
TVec< TFltV > &  Values 
) const
inline

Returns a vector of flt values for node NId.

Definition at line 2563 of file network.h.

2563  {
2564  FltVAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void FltVAttrValueNI(const TInt &NId, TVec< TFltV > &Values) const
Returns a vector of flt values for node NId.
Definition: network.h:2563
void TNEANet::FltVAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TVec< TFltV > &  Values 
) const

Definition at line 154 of file network.cpp.

154  {
155  Values = TVec<TFltV>();
156  while (!NodeHI.IsEnd()) {
157  if (NodeHI.GetDat().Val1 == FltVType) {
158  TInt index = NodeHI.GetDat().Val2;
159  TStr attr = NodeHI.GetKey();
160  TInt loc = CheckDenseOrSparseN(attr);
161  if (loc == 1) {
162  TFltV val = this->VecOfFltVecVecsN.GetVal(index).GetVal(NodeH.GetKeyId(NId));
163  if (val.Len() != 0) Values.Add(val);
164  } else {
165  const THash<TInt, TFltV>& NewHash = VecOfFltHashVecsN[index];
166  if (NewHash.IsKey(NodeH.GetKeyId(NId))) {
167  Values.Add(NewHash[NodeH.GetKeyId(NId)]);
168  }
169  }
170  }
171  NodeHI++;
172  }
173 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: dt.h:412
THash< TInt, TNode > NodeH
Definition: network.h:2053
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::GetAttrENames ( TStrV IntAttrNames,
TStrV FltAttrNames,
TStrV StrAttrNames 
) const

Fills each of the vectors with the names of edge attributes of the given type.

Definition at line 1817 of file network.cpp.

1817  {
1818  for (TStrIntPrH::TIter it = KeyToIndexTypeE.BegI(); it < KeyToIndexTypeE.EndI(); it++) {
1819  if (it.GetDat().GetVal1() == IntType) {
1820  IntAttrNames.Add(it.GetKey());
1821  }
1822  if (it.GetDat().GetVal1() == FltType) {
1823  FltAttrNames.Add(it.GetKey());
1824  }
1825  if (it.GetDat().GetVal1() == StrType) {
1826  StrAttrNames.Add(it.GetKey());
1827  }
1828  }
1829 }
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TIter EndI() const
Definition: hash.h:218
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int TNEANet::GetAttrIndE ( const TStr attr)

Gets the index of the edge attr value vector specified by attr.

Definition at line 1497 of file network.cpp.

1497  {
1498  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1499 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
int TNEANet::GetAttrIndN ( const TStr attr)

Gets the index of the node attr value vector specified by attr.

Definition at line 1452 of file network.cpp.

1452  {
1453  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1454 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal2 Val2
Definition: ds.h:35
void TNEANet::GetAttrNNames ( TStrV IntAttrNames,
TStrV FltAttrNames,
TStrV StrAttrNames 
) const

Fills each of the vectors with the names of node attributes of the given type.

Definition at line 1803 of file network.cpp.

1803  {
1804  for (TStrIntPrH::TIter it = KeyToIndexTypeN.BegI(); it < KeyToIndexTypeN.EndI(); it++) {
1805  if (it.GetDat().GetVal1() == IntType) {
1806  IntAttrNames.Add(it.GetKey());
1807  }
1808  if (it.GetDat().GetVal1() == FltType) {
1809  FltAttrNames.Add(it.GetKey());
1810  }
1811  if (it.GetDat().GetVal1() == StrType) {
1812  StrAttrNames.Add(it.GetKey());
1813  }
1814  }
1815 }
TIter BegI() const
Definition: hash.h:213
TIter EndI() const
Definition: hash.h:218
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TAFltI TNEANet::GetEAFltI ( const TStr attr,
const int &  EId 
) const
inline

Returns an iterator referring to the edge of ID EId in the graph.

Definition at line 2776 of file network.h.

2776  {
2777  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2778  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAFltVI TNEANet::GetEAFltVI ( const TStr attr,
const int &  EId 
) const
inline

Returns an iterator referring to the edge of ID EId in the graph.

Definition at line 2739 of file network.h.

2739  {
2740  TVec<TFltV>::TIter HI = NULL;
2742  TInt location = CheckDenseOrSparseE(attr);
2743  TBool IsDense = true;
2744  if (location != -1) {
2745  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2746  if (location == 1) {
2747  HI = VecOfFltVecVecsE[index].GetI(EdgeH.GetKeyId(EId));
2748  } else {
2749  IsDense = false;
2750  HHI = VecOfFltHashVecsE[index].GetI(EdgeH.GetKeyId(EId));
2751  }
2752  }
2753  return TAFltVI(HI, HHI, attr, true, this, IsDense);
2754  }
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::GetEAIntI ( const TStr attr,
const int &  EId 
) const
inline

Returns an iterator referring to the edge of ID EId in the graph.

Definition at line 2648 of file network.h.

2648  {
2649  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2650  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAIntVI TNEANet::GetEAIntVI ( const TStr attr,
const int &  EId 
) const
inline

Returns an iterator referring to the edge of ID EId in the graph.

Definition at line 2687 of file network.h.

2687  {
2688  TVec<TIntV>::TIter HI = NULL;
2690  TInt location = CheckDenseOrSparseE(attr);
2691  TBool IsDense = true;
2692  if (location != -1) {
2693  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2694  if (location == 1) {
2695  HI = VecOfIntVecVecsE[index].GetI(EdgeH.GetKeyId(EId));
2696  } else {
2697  IsDense = false;
2698  HHI = VecOfIntHashVecsE[index].GetI(EdgeH.GetKeyId(EId));
2699  }
2700  }
2701  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2702  }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:974
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::GetEAStrI ( const TStr attr,
const int &  EId 
) const
inline

Returns an iterator referring to the edge of ID EId in the graph.

Definition at line 2764 of file network.h.

2764  {
2765  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2766  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TEdge& TNEANet::GetEdge ( const int &  EId)
inlineprotected

Definition at line 2032 of file network.h.

2032 { return EdgeH.GetDat(EId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TEdge& TNEANet::GetEdge ( const int &  EId) const
inlineprotected

Definition at line 2033 of file network.h.

2033 { return EdgeH.GetDat(EId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TStr TNEANet::GetEdgeAttrValue ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Returns edge attribute value, converted to Str type.

Definition at line 521 of file network.cpp.

521  {
522  if (EdgeHI.GetDat().Val1 == IntType) {
523  return (this->VecOfIntVecsE.GetVal(
524  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
525  } else if(EdgeHI.GetDat().Val1 == StrType) {
526  return this->VecOfStrVecsE.GetVal(
527  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId));
528  } else if (EdgeHI.GetDat().Val1 == FltType) {
529  return (this->VecOfFltVecsE.GetVal(
530  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
531  }
532  return TStr::GetNullStr();
533 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
const TDat & GetDat() const
Definition: hash.h:81
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
int TNEANet::GetEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 2785 of file network.h.

2785 { return EdgeH.Len(); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int Len() const
Definition: hash.h:228
TEdgeI TNEANet::GetEI ( const int &  EId) const
inline

Returns an iterator referring to edge with edge ID EId.

Definition at line 2816 of file network.h.

2816 { return TEdgeI(EdgeH.GetI(EId), this); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TIter GetI(const TKey &Key) const
Definition: hash.h:220
TEdgeI TNEANet::GetEI ( const int &  SrcNId,
const int &  DstNId 
) const
inline

Returns an iterator referring to edge (SrcNId, DstNId) in the graph.

Definition at line 2818 of file network.h.

2818 { return GetEI(GetEId(SrcNId, DstNId)); }
TEdgeI GetEI(const int &EId) const
Returns an iterator referring to edge with edge ID EId.
Definition: network.h:2816
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.
Definition: network.h:2810
int TNEANet::GetEId ( const int &  SrcNId,
const int &  DstNId 
) const
inline

Returns an edge ID between node IDs SrcNId and DstNId, if such an edge exists. Otherwise, return -1.

Definition at line 2810 of file network.h.

2810 { int EId; return IsEdge(SrcNId, DstNId, EId)?EId:-1; }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
void TNEANet::GetEIdV ( TIntV EIdV) const

Gets a vector IDs of all edges in the graph.

Definition at line 894 of file network.cpp.

894  {
895  EIdV.Gen(GetEdges(), 0);
896  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
897  EIdV.Add(EdgeH.GetKey(E));
898  }
899 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2785
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
TFlt TNEANet::GetFltAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Gets the value of flt attr from the edge attr value vector.

Definition at line 2975 of file network.h.

2975 { return GetFltAttrDatE(EdgeI.GetId(), attr); }
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: network.h:2975
TFlt TNEANet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1477 of file network.cpp.

1477  {
1478  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1479 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TFlt TNEANet::GetFltAttrDatN ( const TNodeI NodeI,
const TStr attr 
)
inline

Gets the value of flt attr from the node attr value vector.

Definition at line 2938 of file network.h.

2938 { return GetFltAttrDatN(NodeI.GetId(), attr); }
TFlt GetFltAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of flt attr from the node attr value vector.
Definition: network.h:2938
TFlt TNEANet::GetFltAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1432 of file network.cpp.

1432  {
1433  return VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1434 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TFlt TNEANet::GetFltAttrDefaultE ( const TStr attribute) const
inlineprotected

Gets Flt edge attribute val. If not a proper attr, return default.

Definition at line 2048 of file network.h.

2048 { return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: dt.h:1386
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1390
TFlt TNEANet::GetFltAttrDefaultN ( const TStr attribute) const
inlineprotected

Gets Flt node attribute val. If not a proper attr, return default.

Definition at line 2042 of file network.h.

2042 { return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: dt.h:1386
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1390
TFlt TNEANet::GetFltAttrIndDatE ( const TEdgeI EdgeI,
const int &  index 
)
inline

Gets the value of a float edge attr specified by edge iterator EdgeI and the attr index.

Definition at line 2996 of file network.h.

2996 { return GetFltAttrIndDatE(EdgeI.GetId(), index); }
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...
Definition: network.h:2996
TFlt TNEANet::GetFltAttrIndDatE ( const int &  EId,
const int &  index 
)

Gets the value of an int edge attr specified by edge ID EId and the attr index.

Definition at line 1489 of file network.cpp.

1489  {
1490  return VecOfFltVecsE[index][EdgeH.GetKeyId(EId)];
1491 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TFlt TNEANet::GetFltAttrIndDatN ( const TNodeI NodeI,
const int &  index 
)
inline

Gets the value of a float node attr specified by node iterator NodeI and the attr index.

Definition at line 2964 of file network.h.

2964 { return GetFltAttrIndDatN(NodeI.GetId(), index); }
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...
Definition: network.h:2964
TFlt TNEANet::GetFltAttrIndDatN ( const int &  NId,
const int &  index 
)

Gets the value of a float node attr specified by node ID NId and the attr index.

Definition at line 1444 of file network.cpp.

1444  {
1445  return VecOfFltVecsN[index][NodeH.GetKeyId(NId)];
1446 }
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TFlt > & TNEANet::GetFltAttrVecE ( const TStr attr)

Gets Vector for the Flt Attribute attr.

Definition at line 1403 of file network.cpp.

1403  {
1404  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
1405 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
int TNEANet::GetFltKeyIdE ( const int &  EId)

Gets keyid for edge with id EId.

Definition at line 1407 of file network.cpp.

1407  {
1408  return EdgeH.GetKeyId(EId);
1409 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TFltV TNEANet::GetFltVAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Gets the value of the fltv attr from the edge attr value vector.

Definition at line 2982 of file network.h.

2982 { return GetFltVAttrDatE(EdgeI.GetId(), attr); }
TFltV GetFltVAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of the fltv attr from the edge attr value vector.
Definition: network.h:2982
TFltV TNEANet::GetFltVAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1467 of file network.cpp.

1467  {
1468  TInt location = CheckDenseOrSparseE(attr);
1469  if (location != 0) return VecOfFltVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1470  else return VecOfFltHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1471 }
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
TVal2 Val2
Definition: ds.h:35
TFltV TNEANet::GetFltVAttrDatN ( const TNodeI NodeI,
const TStr attr 
) const
inline

Gets the value of the fltv attr from the node attr value vector.

Definition at line 2945 of file network.h.

2945 { return GetFltVAttrDatN(NodeI.GetId(), attr); }
TFltV GetFltVAttrDatN(const TNodeI &NodeI, const TStr &attr) const
Gets the value of the fltv attr from the node attr value vector.
Definition: network.h:2945
TFltV TNEANet::GetFltVAttrDatN ( const int &  NId,
const TStr attr 
) const

Definition at line 1422 of file network.cpp.

1422  {
1423  TInt location = CheckDenseOrSparseN(attr);
1424  if (location != 0) return VecOfFltVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1425  else return VecOfFltHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1426 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
int TNEANet::GetIdVSAttrE ( const TStr AttrName,
TIntV IdV 
) const

Gets a list of all edges that have a sparse attribute with name AttrName.

Definition at line 2097 of file network.cpp.

2097  {
2098  return SAttrE.GetIdVSAttr(AttrName, IdV);
2099 }
TAttr SAttrE
Definition: network.h:2073
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
int TNEANet::GetIdVSAttrE ( const TInt AttrId,
TIntV IdV 
) const

Gets a list of all edges that have a sparse attribute with id AttrId.

Definition at line 2101 of file network.cpp.

2101  {
2102  return SAttrE.GetIdVSAttr(AttrId, IdV);
2103 }
TAttr SAttrE
Definition: network.h:2073
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
int TNEANet::GetIdVSAttrN ( const TStr AttrName,
TIntV IdV 
) const

Gets a list of all nodes that have a sparse attribute with name AttrName.

Definition at line 1971 of file network.cpp.

1971  {
1972  return SAttrN.GetIdVSAttr(AttrName, IdV);
1973 }
TAttr SAttrN
Definition: network.h:2072
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
int TNEANet::GetIdVSAttrN ( const TInt AttrId,
TIntV IdV 
) const

Gets a list of all nodes that have a sparse attribute with id AttrId.

Definition at line 1975 of file network.cpp.

1975  {
1976  return SAttrN.GetIdVSAttr(AttrId, IdV);
1977 }
TAttr SAttrN
Definition: network.h:2072
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
TInt TNEANet::GetIntAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Gets the value of int attr from the edge attr value vector.

Definition at line 2969 of file network.h.

2969 { return GetIntAttrDatE(EdgeI.GetId(), attr); }
TInt GetIntAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of int attr from the edge attr value vector.
Definition: network.h:2969
TInt TNEANet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1456 of file network.cpp.

1456  {
1457  return VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1458 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TInt TNEANet::GetIntAttrDatN ( const TNodeI NodeI,
const TStr attr 
)
inline

Gets the value of int attr from the node attr value vector.

Definition at line 2931 of file network.h.

2931 { return GetIntAttrDatN(NodeI.GetId(), attr); }
TInt GetIntAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of int attr from the node attr value vector.
Definition: network.h:2931
TInt TNEANet::GetIntAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1411 of file network.cpp.

1411  {
1412  return VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1413 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TInt TNEANet::GetIntAttrDefaultE ( const TStr attribute) const
inlineprotected

Gets Int edge attribute val. If not a proper attr, return default.

Definition at line 2044 of file network.h.

2044 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static const int Mn
Definition: dt.h:1141
Definition: dt.h:1137
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TInt TNEANet::GetIntAttrDefaultN ( const TStr attribute) const
inlineprotected

Gets Int node attribute val. If not a proper attr, return default.

Definition at line 2038 of file network.h.

2038 { return IntDefaultsN.IsKey(attribute) ? IntDefaultsN.GetDat(attribute) : (TInt) TInt::Mn; }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static const int Mn
Definition: dt.h:1141
Definition: dt.h:1137
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TInt TNEANet::GetIntAttrIndDatE ( const TEdgeI EdgeI,
const int &  index 
)
inline

Gets the value of an int edge attr specified by edge iterator EdgeI and the attr index.

Definition at line 2991 of file network.h.

2991 { return GetIntAttrIndDatE(EdgeI.GetId(), 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.
Definition: network.h:2991
TInt TNEANet::GetIntAttrIndDatE ( const int &  EId,
const int &  index 
)

Gets the value of an int edge attr specified by edge ID EId and the attr index.

Definition at line 1481 of file network.cpp.

1481  {
1482  return VecOfIntVecsE[index][EdgeH.GetKeyId(EId)];
1483 }
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TInt TNEANet::GetIntAttrIndDatN ( const TNodeI NodeI,
const int &  index 
)
inline

Gets the value of an int node attr specified by node iterator NodeI and the attr index.

Definition at line 2954 of file network.h.

2954 { return GetIntAttrIndDatN(NodeI.GetId(), index); }
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.
Definition: network.h:2954
TInt TNEANet::GetIntAttrIndDatN ( const int &  NId,
const int &  index 
)

Gets the value of an int node attr specified by node ID NId and the attr index.

Definition at line 1436 of file network.cpp.

1436  {
1437  return VecOfIntVecsN[index][NodeH.GetKeyId(NId)];
1438 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2053
int TNEANet::GetIntAttrIndE ( const TStr attr)

Gets the index of the edge attr value vector specified by attr (same as GetAttrIndE for compatibility reasons).

Definition at line 1493 of file network.cpp.

1493  {
1494  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1495 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
int TNEANet::GetIntAttrIndN ( const TStr attr)

Gets the index of the node attr value vector specified by attr (same as GetAttrIndN for compatibility reasons).

Definition at line 1448 of file network.cpp.

1448  {
1449  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1450 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal2 Val2
Definition: ds.h:35
TIntV TNEANet::GetIntVAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Gets the value of the intv attr from the edge attr value vector.

Definition at line 2978 of file network.h.

2978 { return GetIntVAttrDatE(EdgeI.GetId(), attr); }
TIntV GetIntVAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of the intv attr from the edge attr value vector.
Definition: network.h:2978
TIntV TNEANet::GetIntVAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1460 of file network.cpp.

1460  {
1461  TInt location = CheckDenseOrSparseE(attr);
1462  if (location != 0) return VecOfIntVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1463  else return VecOfIntHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1464 }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TIntV TNEANet::GetIntVAttrDatN ( const TNodeI NodeI,
const TStr attr 
) const
inline

Gets the value of the intv attr from the node attr value vector.

Definition at line 2941 of file network.h.

2941 { return GetIntVAttrDatN(NodeI.GetId(), attr); }
TIntV GetIntVAttrDatN(const TNodeI &NodeI, const TStr &attr) const
Gets the value of the intv attr from the node attr value vector.
Definition: network.h:2941
TIntV TNEANet::GetIntVAttrDatN ( const int &  NId,
const TStr attr 
) const

Definition at line 1415 of file network.cpp.

1415  {
1416  TInt location = CheckDenseOrSparseN(attr);
1417  if (location != 0) return VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1418  else return VecOfIntHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1419 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
int TNEANet::GetMxEId ( ) const
inline

Returns an ID that is larger than any edge ID in the network.

Definition at line 2782 of file network.h.

2782 { return MxEId; }
TInt MxEId
Definition: network.h:2052
int TNEANet::GetMxNId ( ) const
inline

Returns an ID that is larger than any node ID in the network.

Definition at line 2780 of file network.h.

2780 { return MxNId; }
TInt MxNId
Definition: network.h:2052
TAFltI TNEANet::GetNAFltI ( const TStr attr,
const int &  NId 
) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2527 of file network.h.

2527  {
2528  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAFltVI TNEANet::GetNAFltVI ( const TStr attr,
const int &  NId 
) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2493 of file network.h.

2493  {
2494  TVec<TFltV>::TIter HI = NULL;
2496  TInt location = CheckDenseOrSparseN(attr);
2497  TBool IsDense = true;
2498  if (location != -1) {
2499  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2500  if (location == 1) {
2501  HI = VecOfFltVecVecsN[index].GetI(NodeH.GetKeyId(NId));
2502  } else {
2503  IsDense = false;
2504  HHI = VecOfFltHashVecsN[index].GetI(NodeH.GetKeyId(NId));
2505  }
2506  }
2507  return TAFltVI(HI, HHI, attr, false, this, IsDense);
2508  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
Definition: dt.h:974
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAIntI TNEANet::GetNAIntI ( const TStr attr,
const int &  NId 
) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2399 of file network.h.

2399  {
2400  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAIntVI TNEANet::GetNAIntVI ( const TStr attr,
const int &  NId 
) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2439 of file network.h.

2439  {
2440  TVec<TIntV>::TIter HI = NULL;
2442  TInt location = CheckDenseOrSparseN(attr);
2443  TBool IsDense = true;
2444  if (location != -1) {
2445  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2446  if (location == 1) {
2447  HI = VecOfIntVecVecsN[index].GetI(NodeH.GetKeyId(NId));
2448  } else {
2449  IsDense = false;
2450  HHI = VecOfIntHashVecsN[index].GetI(NodeH.GetKeyId(NId));
2451  }
2452  }
2453  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2454  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
Definition: dt.h:974
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TAStrI TNEANet::GetNAStrI ( const TStr attr,
const int &  NId 
) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2518 of file network.h.

2518  {
2519  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TNodeI TNEANet::GetNI ( const int &  NId) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 2391 of file network.h.

2391 { return TNodeI(NodeH.GetI(NId), this); }
THash< TInt, TNode > NodeH
Definition: network.h:2053
TIter GetI(const TKey &Key) const
Definition: hash.h:220
void TNEANet::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the graph.

Definition at line 887 of file network.cpp.

887  {
888  NIdV.Gen(GetNodes(), 0);
889  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
890  NIdV.Add(NodeH.GetKey(N));
891  }
892 }
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:2363
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
THash< TInt, TNode > NodeH
Definition: network.h:2053
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
TNode& TNEANet::GetNode ( const int &  NId)
inlineprotected

Definition at line 2030 of file network.h.

2030 { return NodeH.GetDat(NId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TNode > NodeH
Definition: network.h:2053
const TNode& TNEANet::GetNode ( const int &  NId) const
inlineprotected

Definition at line 2031 of file network.h.

2031 { return NodeH.GetDat(NId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TNode > NodeH
Definition: network.h:2053
TStr TNEANet::GetNodeAttrValue ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns node attribute value, converted to Str type.

Definition at line 294 of file network.cpp.

294  {
295  if (NodeHI.GetDat().Val1 == IntType) {
296  return (this->VecOfIntVecsN.GetVal(
297  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
298  } else if(NodeHI.GetDat().Val1 == StrType) {
299  return this->VecOfStrVecsN.GetVal(
300  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId));
301  } else if (NodeHI.GetDat().Val1 == FltType) {
302  return (this->VecOfFltVecsN.GetVal(
303  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
304  }
305  return TStr::GetNullStr();
306 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
const TDat & GetDat() const
Definition: hash.h:81
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TInt, TNode > NodeH
Definition: network.h:2053
int TNEANet::GetNodes ( ) const
inline

Returns the number of nodes in the network.

Definition at line 2363 of file network.h.

2363 { return NodeH.Len(); }
THash< TInt, TNode > NodeH
Definition: network.h:2053
int Len() const
Definition: hash.h:228
TEdgeI TNEANet::GetRndEI ( TRnd Rnd = TInt::Rnd)
inline

Returns an interator referring to a random edge in the graph.

Definition at line 2827 of file network.h.

2827 { return GetEI(GetRndEId(Rnd)); }
TEdgeI GetEI(const int &EId) const
Returns an iterator referring to edge with edge ID EId.
Definition: network.h:2816
int GetRndEId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random edge in the graph.
Definition: network.h:2825
int TNEANet::GetRndEId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random edge in the graph.

Definition at line 2825 of file network.h.

2825 { return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetRndKeyId(TRnd &Rnd) const
Get an index of a random element. If the hash table has many deleted keys, this may take a long time...
Definition: hash.h:444
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
TNodeI TNEANet::GetRndNI ( TRnd Rnd = TInt::Rnd)
inline

Returns an interator referring to a random node in the graph.

Definition at line 2823 of file network.h.

2823 { return GetNI(GetRndNId(Rnd)); }
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the graph.
Definition: network.h:2821
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
Definition: network.h:2391
int TNEANet::GetRndNId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random node in the graph.

Definition at line 2821 of file network.h.

2821 { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TNode > NodeH
Definition: network.h:2053
int GetRndKeyId(TRnd &Rnd) const
Get an index of a random element. If the hash table has many deleted keys, this may take a long time...
Definition: hash.h:444
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
int TNEANet::GetSAttrDatE ( const TInt EId,
const TStr AttrName,
TInt ValX 
) const

Gets Int sparse attribute with name AttrName from edge with id EId.

Definition at line 2033 of file network.cpp.

2033  {
2034  if (!IsEdge(EId)) {
2035  return -1;
2036  }
2037  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2038 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TInt EId,
const TInt AttrId,
TInt ValX 
) const

Gets Int sparse attribute with id AttrId from edge with id EId.

Definition at line 2040 of file network.cpp.

2040  {
2041  if (!IsEdge(EId)) {
2042  return -1;
2043  }
2044  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2045 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TInt ValX 
) const
inline

Gets Int sparse attribute with name AttrName from EdgeI.

Definition at line 3285 of file network.h.

3285  {
3286  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3287  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TInt ValX 
) const
inline

Gets Int sparse attribute with id AttrId from EdgeI.

Definition at line 3289 of file network.h.

3289  {
3290  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3291  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatE ( const TInt EId,
const TStr AttrName,
TFlt ValX 
) const

Gets Flt sparse attribute with name AttrName from edge with id EId.

Definition at line 2047 of file network.cpp.

2047  {
2048  if (!IsEdge(EId)) {
2049  return -1;
2050  }
2051  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2052 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TInt EId,
const TInt AttrId,
TFlt ValX 
) const

Gets Flt sparse attribute with id AttrId from edge with id EId.

Definition at line 2054 of file network.cpp.

2054  {
2055  if (!IsEdge(EId)) {
2056  return -1;
2057  }
2058  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2059 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with name AttrName from EdgeI.

Definition at line 3299 of file network.h.

3299  {
3300  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3301  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with id AttrId from EdgeI.

Definition at line 3303 of file network.h.

3303  {
3304  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3305  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatE ( const TInt EId,
const TStr AttrName,
TStr ValX 
) const

Gets Str sparse attribute with name AttrName from edge with id EId.

Definition at line 2061 of file network.cpp.

2061  {
2062  if (!IsEdge(EId)) {
2063  return -1;
2064  }
2065  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2066 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TInt EId,
const TInt AttrId,
TStr ValX 
) const

Gets Str sparse attribute with id AttrId from edge with id EId.

Definition at line 2068 of file network.cpp.

2068  {
2069  if (!IsEdge(EId)) {
2070  return -1;
2071  }
2072  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2073 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TStr ValX 
) const
inline

Gets Str sparse attribute with name AttrName from EdgeI.

Definition at line 3313 of file network.h.

3313  {
3314  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3315  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TStr ValX 
) const
inline

Gets Str sparse attribute with id AttrId from EdgeI.

Definition at line 3317 of file network.h.

3317  {
3318  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3319  }
int GetSAttrDatE(const TInt &EId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with id EId.
Definition: network.cpp:2033
int TNEANet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TInt ValX 
) const

Gets Int sparse attribute with name AttrName from node with id NId.

Definition at line 1907 of file network.cpp.

1907  {
1908  if (!IsNode(NId)) {
1909  return -1;
1910  }
1911  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1912 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TInt ValX 
) const

Gets Int sparse attribute with id AttrId from node with id NId.

Definition at line 1914 of file network.cpp.

1914  {
1915  if (!IsNode(NId)) {
1916  return -1;
1917  }
1918  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1919 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TInt ValX 
) const
inline

Gets Int sparse attribute with name AttrName from NodeI.

Definition at line 3167 of file network.h.

3167  {
3168  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3169  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TInt ValX 
) const
inline

Gets Int sparse attribute with id AttrId from NodeI.

Definition at line 3171 of file network.h.

3171  {
3172  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3173  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TFlt ValX 
) const

Gets Flt sparse attribute with name AttrName from node with id NId.

Definition at line 1921 of file network.cpp.

1921  {
1922  if (!IsNode(NId)) {
1923  return -1;
1924  }
1925  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1926 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TFlt ValX 
) const

Gets Flt sparse attribute with id AttrId from node with id NId.

Definition at line 1928 of file network.cpp.

1928  {
1929  if (!IsNode(NId)) {
1930  return -1;
1931  }
1932  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1933 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with name AttrName from NodeI.

Definition at line 3181 of file network.h.

3181  {
3182  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3183  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with id AttrId from NodeI.

Definition at line 3185 of file network.h.

3185  {
3186  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3187  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TStr ValX 
) const

Gets Str sparse attribute with name AttrName from node with id NId.

Definition at line 1935 of file network.cpp.

1935  {
1936  if (!IsNode(NId)) {
1937  return -1;
1938  }
1939  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1940 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TStr ValX 
) const

Gets Str sparse attribute with id AttrId from node with id NId.

Definition at line 1942 of file network.cpp.

1942  {
1943  if (!IsNode(NId)) {
1944  return -1;
1945  }
1946  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1947 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TStr ValX 
) const
inline

Gets Str sparse attribute with name AttrName from NodeI.

Definition at line 3195 of file network.h.

3195  {
3196  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3197  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TStr ValX 
) const
inline

Gets Str sparse attribute with id AttrId from NodeI.

Definition at line 3199 of file network.h.

3199  {
3200  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3201  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:1907
int TNEANet::GetSAttrIdE ( const TStr Name,
TInt AttrIdX,
TAttrType AttrTypeX 
) const

Gets id and type for attribute with name Name.

Definition at line 2109 of file network.cpp.

2109  {
2110  return SAttrE.GetSAttrId(Name, AttrId, AttrType);
2111 }
TAttr SAttrE
Definition: network.h:2073
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id.
Definition: attr.cpp:224
int TNEANet::GetSAttrIdN ( const TStr Name,
TInt AttrIdX,
TAttrType AttrTypeX 
) const

Gets id and type for attribute with name Name.

Definition at line 1983 of file network.cpp.

1983  {
1984  return SAttrN.GetSAttrId(Name, AttrId, AttrType);
1985 }
TAttr SAttrN
Definition: network.h:2072
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id.
Definition: attr.cpp:224
int TNEANet::GetSAttrNameE ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 2113 of file network.cpp.

2113  {
2114  return SAttrE.GetSAttrName(AttrId, Name, AttrType);
2115 }
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name.
Definition: attr.cpp:233
TAttr SAttrE
Definition: network.h:2073
int TNEANet::GetSAttrNameN ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 1987 of file network.cpp.

1987  {
1988  return SAttrN.GetSAttrName(AttrId, Name, AttrType);
1989 }
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name.
Definition: attr.cpp:233
TAttr SAttrN
Definition: network.h:2072
int TNEANet::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.

Definition at line 2089 of file network.cpp.

2089  {
2090  if (!IsEdge(EId)) {
2091  return -1;
2092  }
2093  SAttrE.GetSAttrV(EId, AttrType, AttrV);
2094  return 0;
2095 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
TAttr SAttrE
Definition: network.h:2073
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.
Definition: attr.cpp:139
int TNEANet::GetSAttrVE ( const TEdgeI EdgeI,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const
inline

Gets a list of all sparse attributes of type AttrType for EdgeI.

Definition at line 3337 of file network.h.

3337  {
3338  return GetSAttrVE(EdgeI.GetId(), AttrType, AttrV);
3339  }
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.
Definition: network.cpp:2089
int TNEANet::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.

Definition at line 1963 of file network.cpp.

1963  {
1964  if (!IsNode(NId)) {
1965  return -1;
1966  }
1967  SAttrN.GetSAttrV(NId, AttrType, AttrV);
1968  return 0;
1969 }
TAttr SAttrN
Definition: network.h:2072
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.
Definition: attr.cpp:139
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
int TNEANet::GetSAttrVN ( const TNodeI NodeI,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const
inline

Gets a list of all sparse attributes of type AttrType for NodeI.

Definition at line 3220 of file network.h.

3220  {
3221  return GetSAttrVN(NodeI.GetId(), AttrType, AttrV);
3222  }
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.
Definition: network.cpp:1963
PNEANet TNEANet::GetSmallGraph ( )
static

Returns a small multigraph on 5 nodes and 6 edges.

/// Edges:  0 -> 1, 0 -> 2, 0 -> 3, 0 -> 4, 1 -> 2, 1 -> 2
/// 

Definition at line 1794 of file network.cpp.

1794  {
1795  PNEANet Net = TNEANet::New();
1796  for (int i = 0; i < 5; i++) { Net->AddNode(i); }
1797  Net->AddEdge(0,1); Net->AddEdge(0,2);
1798  Net->AddEdge(0,3); Net->AddEdge(0,4);
1799  Net->AddEdge(1,2); Net->AddEdge(1,2);
1800  return Net;
1801 }
Definition: bd.h:196
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
Definition: network.h:2226
TStr TNEANet::GetStrAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Gets the value of str attr from the edge attr value vector.

Definition at line 2972 of file network.h.

2972 { return GetStrAttrDatE(EdgeI.GetId(), attr); }
TStr GetStrAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of str attr from the edge attr value vector.
Definition: network.h:2972
TStr TNEANet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1473 of file network.cpp.

1473  {
1474  return VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1475 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TStr TNEANet::GetStrAttrDatN ( const TNodeI NodeI,
const TStr attr 
)
inline

Gets the value of str attr from the node attr value vector.

Definition at line 2935 of file network.h.

2935 { return GetStrAttrDatN(NodeI.GetId(), attr); }
TStr GetStrAttrDatN(const TNodeI &NodeI, const TStr &attr)
Gets the value of str attr from the node attr value vector.
Definition: network.h:2935
TStr TNEANet::GetStrAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1428 of file network.cpp.

1428  {
1429  return VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1430 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2053
TStr TNEANet::GetStrAttrDefaultE ( const TStr attribute) const
inlineprotected

Gets Str edge attribute val. If not a proper attr, return default.

Definition at line 2046 of file network.h.

2046 { return StrDefaultsE.IsKey(attribute) ? StrDefaultsE.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static TStr GetNullStr()
Definition: dt.cpp:1626
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TStr TNEANet::GetStrAttrDefaultN ( const TStr attribute) const
inlineprotected

Gets Str node attribute val. If not a proper attr, return default.

Definition at line 2040 of file network.h.

2040 { return StrDefaultsN.IsKey(attribute) ? StrDefaultsN.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TStr TNEANet::GetStrAttrIndDatE ( const TEdgeI EdgeI,
const int &  index 
)
inline

Gets the value of a string edge attr specified by edge iterator EdgeI and the attr index.

Definition at line 3001 of file network.h.

3001 { return GetStrAttrIndDatE(EdgeI.GetId(), index); }
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...
Definition: network.h:3001
TStr TNEANet::GetStrAttrIndDatE ( const int &  EId,
const int &  index 
)

Gets the value of an int edge attr specified by edge ID EId and the attr index.

Definition at line 1485 of file network.cpp.

1485  {
1486  return VecOfStrVecsE[index][EdgeH.GetKeyId(EId)];
1487 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TStr TNEANet::GetStrAttrIndDatN ( const TNodeI NodeI,
const int &  index 
)
inline

Gets the value of a string node attr specified by node iterator NodeI and the attr index.

Definition at line 2959 of file network.h.

2959 { return GetStrAttrIndDatN(NodeI.GetId(), index); }
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...
Definition: network.h:2959
TStr TNEANet::GetStrAttrIndDatN ( const int &  NId,
const int &  index 
)

Gets the value of a string node attr specified by node ID NId and the attr index.

Definition at line 1440 of file network.cpp.

1440  {
1441  return VecOfStrVecsN[index][NodeH.GetKeyId(NId)];
1442 }
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2053
TFlt TNEANet::GetWeightOutEdges ( const TNodeI NI,
const TStr attr 
)

Gets the sum of the weights of all the outgoing edges of the node.

Definition at line 1831 of file network.cpp.

1831  {
1832  TNode Node = GetNode(NI.GetId());
1833  TIntV OutEIdV = Node.OutEIdV;
1834  TFlt total = 0;
1835  int len = Node.OutEIdV.Len();
1836  for (int i = 0; i < len; i++) {
1837  total += GetFltAttrDatE(Node.OutEIdV[i], attr);
1838  }
1839  return total;
1840 }
TNode & GetNode(const int &NId)
Definition: network.h:2030
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: network.h:2975
Definition: dt.h:1386
void TNEANet::GetWeightOutEdgesV ( TFltV OutWeights,
const TFltV AttrVal 
)

Fills OutWeights with the outgoing weight from each node.

Definition at line 1842 of file network.cpp.

1842  {
1843  for (TEdgeI it = BegEI(); it < EndEI(); it++) {
1844  int EId = it.GetId();
1845  int SrcId = it.GetSrcNId();
1846  OutWeights[SrcId] +=AttrVal[GetFltKeyIdE(EId)];
1847  }
1848 }
int GetFltKeyIdE(const int &EId)
Gets keyid for edge with id EId.
Definition: network.cpp:1407
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2812
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2814
bool TNEANet::HasFlag ( const TGraphFlag Flag) const

Allows for run-time checking the type of the graph (see the TGraphFlag for flags).

Definition at line 50 of file network.cpp.

50  {
51  return HasGraphFlag(TNEANet::TNet, Flag);
52 }
#define HasGraphFlag(TGraph, Flag)
For quick testing of the properties of the graph/network object (see TGraphFlag). ...
Definition: gbase.h:41
Directed multigraph with node edge attributes.
Definition: network.h:1741
void TNEANet::IntAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 2594 of file network.h.

2594  {
2595  IntAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void IntAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
Definition: network.h:2594
void TNEANet::IntAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 328 of file network.cpp.

328  {
329  Names = TVec<TStr>();
330  while (!EdgeHI.IsEnd()) {
331  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
332  Names.Add(EdgeHI.GetKey());
333  }
334  EdgeHI++;
335  }
336 }
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int attr iterator.
Definition: network.cpp:491
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2540 of file network.h.

2540  {
2541  IntAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
void IntAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: network.h:2540
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::IntAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 92 of file network.cpp.

92  {
93  Names = TVec<TStr>();
94  while (!NodeHI.IsEnd()) {
95  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
96  Names.Add(NodeHI.GetKey());
97  }
98  NodeHI++;
99  }
100 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int attr iterator.
Definition: network.cpp:254
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2598 of file network.h.

2598  {
2599  IntAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2598
void TNEANet::IntAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TIntV Values 
) const

Definition at line 338 of file network.cpp.

338  {
339  Values = TVec<TInt>();
340  while (!EdgeHI.IsEnd()) {
341  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
342  TInt val = (this->VecOfIntVecsE[EdgeHI.GetDat().Val2].GetVal(EdgeH.GetKeyId(EId)));
343  Values.Add(val);
344  }
345  EdgeHI++;
346  }
347 }
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int attr iterator.
Definition: network.cpp:491
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntAttrValueNI ( const TInt NId,
TIntV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2544 of file network.h.

2544  {
2545  IntAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2544
void TNEANet::IntAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TIntV Values 
) const

Definition at line 102 of file network.cpp.

102  {
103  Values = TVec<TInt>();
104  while (!NodeHI.IsEnd()) {
105  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
106  TInt val = this->VecOfIntVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
107  Values.Add(val);
108  }
109  NodeHI++;
110  }
111 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int attr iterator.
Definition: network.cpp:254
THash< TInt, TNode > NodeH
Definition: network.h:2053
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntVAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 2604 of file network.h.

2604  {
2605  IntVAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void IntVAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
Definition: network.h:2604
void TNEANet::IntVAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 349 of file network.cpp.

349  {
350  Names = TVec<TStr>();
351  while (!EdgeHI.IsEnd()) {
352  if (EdgeHI.GetDat().Val1 == IntVType) {
353  Names.Add(EdgeHI.GetKey());
354  }
355  EdgeHI++;
356  }
357 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntVAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2550 of file network.h.

2550  {
2551  IntVAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
void IntVAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: network.h:2550
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::IntVAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 113 of file network.cpp.

113  {
114  Names = TVec<TStr>();
115  while (!NodeHI.IsEnd()) {
116  if (NodeHI.GetDat().Val1 == IntVType) {
117  Names.Add(NodeHI.GetKey());
118  }
119  NodeHI++;
120  }
121 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntVAttrValueEI ( const TInt EId,
TVec< TIntV > &  Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2608 of file network.h.

2608  {
2609  IntVAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
void IntVAttrValueEI(const TInt &EId, TVec< TIntV > &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2608
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void TNEANet::IntVAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TVec< TIntV > &  Values 
) const

Definition at line 359 of file network.cpp.

359  {
360  Values = TVec<TIntV>();
361  while (!EdgeHI.IsEnd()) {
362  if (EdgeHI.GetDat().Val1 == IntVType) {
363  TInt index = EdgeHI.GetDat().Val2;
364  TStr attr = EdgeHI.GetKey();
365  TInt loc = CheckDenseOrSparseE(attr);
366  if (loc == 1) {
367  TIntV val = this->VecOfIntVecVecsE.GetVal(index).GetVal(EdgeH.GetKeyId(EId));
368  if (val.Len() != 0) Values.Add(val);
369  } else {
370  const THash<TInt, TIntV>& NewHash = VecOfIntHashVecsE[index];
371  if (NewHash.IsKey(EdgeH.GetKeyId(EId))) {
372  Values.Add(NewHash[EdgeH.GetKeyId(EId)]);
373  }
374  }
375  }
376  EdgeHI++;
377  }
378 }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2116
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::IntVAttrValueNI ( const TInt NId,
TVec< TIntV > &  Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2554 of file network.h.

2554  {
2555  IntVAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
void IntVAttrValueNI(const TInt &NId, TVec< TIntV > &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2554
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::IntVAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TVec< TIntV > &  Values 
) const

Definition at line 123 of file network.cpp.

123  {
124  Values = TVec<TIntV>();
125  while (!NodeHI.IsEnd()) {
126  if (NodeHI.GetDat().Val1 == IntVType) {
127  TInt index = NodeHI.GetDat().Val2;
128  TStr attr = NodeHI.GetKey();
129  TInt loc = CheckDenseOrSparseN(attr);
130  if (loc == 1) {
131  TIntV val = this->VecOfIntVecVecsN.GetVal(index).GetVal(NodeH.GetKeyId(NId));
132  if (val.Len() != 0) Values.Add(val);
133  } else {
134  const THash<TInt, TIntV>& NewHash = VecOfIntHashVecsN[index];
135  if (NewHash.IsKey(NodeH.GetKeyId(NId))) {
136  Values.Add(NewHash[NodeH.GetKeyId(NId)]);
137  }
138  }
139  }
140  NodeHI++;
141  }
142 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: dt.h:412
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool TNEANet::IsAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if attr exists for edge EId and has default value.

Definition at line 453 of file network.cpp.

453  {
454  bool IntDel = IsIntAttrDeletedE(EId, attr);
455  bool IntVDel = IsIntVAttrDeletedE(EId, attr);
456  bool StrDel = IsStrAttrDeletedE(EId, attr);
457  bool FltDel = IsFltAttrDeletedE(EId, attr);
458  bool FltVDel = IsFltVAttrDeletedE(EId, attr);
459  return IntDel || StrDel || FltDel || IntVDel || FltVDel;
460 }
bool IsFltVAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if FltV attr exists for edge EId and is an empty vector.
Definition: network.cpp:470
bool IsFltAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Flt attr exists for edge NId and has default value.
Definition: network.cpp:478
bool IsIntAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Int attr exists for edge EId and has default value.
Definition: network.cpp:462
bool IsStrAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if Str attr exists for edge NId and has default value.
Definition: network.cpp:474
bool IsIntVAttrDeletedE(const int &EId, const TStr &attr) const
Returns true if IntV attr exists for edge EId and is an empty vector.
Definition: network.cpp:466
bool TNEANet::IsAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if attr exists for node NId and has default value.

Definition at line 217 of file network.cpp.

217  {
218  bool IntDel = IsIntAttrDeletedN(NId, attr);
219  bool StrDel = IsStrAttrDeletedN(NId, attr);
220  bool FltDel = IsFltAttrDeletedN(NId, attr);
221  bool IntVDel = IsIntVAttrDeletedN(NId, attr);
222  bool FltVDel = IsFltVAttrDeletedN(NId, attr);
223  return IntDel || StrDel || FltDel || IntVDel || FltVDel;
224 }
bool IsStrAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Str attr exists for node NId and has default value.
Definition: network.cpp:238
bool IsFltVAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if FltV attr exists for node NId and is an empty vector.
Definition: network.cpp:234
bool IsFltAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Flt attr exists for node NId and has default value.
Definition: network.cpp:242
bool IsIntAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if Int attr exists for node NId and has default value.
Definition: network.cpp:226
bool IsIntVAttrDeletedN(const int &NId, const TStr &attr) const
Returns true if IntV attr exists for node NId and is an empty vector.
Definition: network.cpp:230
bool TNEANet::IsEdge ( const int &  EId) const
inline

Tests whether an edge with edge ID EId exists in the graph.

Definition at line 2804 of file network.h.

2804 { return EdgeH.IsKey(EId); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANet::IsEdge ( const int &  SrcNId,
const int &  DstNId,
const bool &  IsDir = true 
) const
inline

Tests whether an edge between node IDs SrcNId and DstNId exists in the graph.

Definition at line 2806 of file network.h.

2806 { int EId; return IsEdge(SrcNId, DstNId, EId, IsDir); }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
bool TNEANet::IsEdge ( const int &  SrcNId,
const int &  DstNId,
int &  EId,
const bool &  IsDir = true 
) const

Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. if an edge exists, return its edge ID in EId.

Definition at line 866 of file network.cpp.

866  {
867  const TNode& SrcNode = GetNode(SrcNId);
868  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
869  const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
870  if (DstNId == Edge.GetDstNId()) {
871  EId = Edge.GetId();
872  return true;
873  }
874  }
875  if (! IsDir) {
876  for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
877  const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
878  if (DstNId == Edge.GetSrcNId()) {
879  EId = Edge.GetId();
880  return true;
881  }
882  }
883  }
884  return false;
885 }
int GetId() const
Definition: network.h:1781
TNode & GetNode(const int &NId)
Definition: network.h:2030
TEdge & GetEdge(const int &EId)
Definition: network.h:2032
bool TNEANet::IsFltAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if Flt attr exists for edge NId and has default value.

Definition at line 478 of file network.cpp.

478  {
479  return EdgeAttrIsFltDeleted(EId, KeyToIndexTypeE.GetI(attr));
480 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt attr iterator.
Definition: network.cpp:515
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsFltAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if Flt attr exists for node NId and has default value.

Definition at line 242 of file network.cpp.

242  {
243  return NodeAttrIsFltDeleted(NId, KeyToIndexTypeN.GetI(attr));
244 }
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node flt attr iterator.
Definition: network.cpp:286
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsFltAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1850 of file network.cpp.

1850  {
1851  return (KeyToIndexTypeE.IsKey(attr) &&
1852  KeyToIndexTypeE.GetDat(attr).Val1 == FltType);
1853 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANet::IsFltVAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if FltV attr exists for edge EId and is an empty vector.

Definition at line 470 of file network.cpp.

470  {
471  return EdgeAttrIsFltVDeleted(EId, KeyToIndexTypeE.GetI(attr));
472 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool EdgeAttrIsFltVDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge flt vector attr iterator.
Definition: network.cpp:503
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsFltVAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if FltV attr exists for node NId and is an empty vector.

Definition at line 234 of file network.cpp.

234  {
235  return NodeAttrIsFltVDeleted(NId, KeyToIndexTypeN.GetI(attr));
236 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
bool NodeAttrIsFltVDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int vector attr iterator. ...
Definition: network.cpp:270
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsIntAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if Int attr exists for edge EId and has default value.

Definition at line 462 of file network.cpp.

462  {
463  return EdgeAttrIsIntDeleted(EId, KeyToIndexTypeE.GetI(attr));
464 }
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int attr iterator.
Definition: network.cpp:491
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsIntAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if Int attr exists for node NId and has default value.

Definition at line 226 of file network.cpp.

226  {
227  return NodeAttrIsIntDeleted(NId, KeyToIndexTypeN.GetI(attr));
228 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int attr iterator.
Definition: network.cpp:254
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsIntAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1855 of file network.cpp.

1855  {
1856  return (KeyToIndexTypeE.IsKey(attr) &&
1857  KeyToIndexTypeE.GetDat(attr).Val1 == IntType);
1858 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANet::IsIntVAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if IntV attr exists for edge EId and is an empty vector.

Definition at line 466 of file network.cpp.

466  {
467  return EdgeAttrIsIntVDeleted(EId, KeyToIndexTypeE.GetI(attr));
468 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool EdgeAttrIsIntVDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge int vector attr iterator.
Definition: network.cpp:497
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsIntVAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if IntV attr exists for node NId and is an empty vector.

Definition at line 230 of file network.cpp.

230  {
231  return NodeAttrIsIntVDeleted(NId, KeyToIndexTypeN.GetI(attr));
232 }
bool NodeAttrIsIntVDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int vector attr iterator. ...
Definition: network.cpp:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsNode ( const int &  NId) const
inline

Tests whether ID NId is a node.

Definition at line 2385 of file network.h.

2385 { return NodeH.IsKey(NId); }
THash< TInt, TNode > NodeH
Definition: network.h:2053
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANet::IsOk ( const bool &  ThrowExcept = true) const

Checks the graph data structure for internal consistency.

For each node in the graph check that its neighbors are also nodes in the graph.

Definition at line 910 of file network.cpp.

910  {
911  bool RetVal = true;
912  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
913  const TNode& Node = NodeH[N];
914  if (! Node.OutEIdV.IsSorted()) {
915  const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
916  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
917  }
918  if (! Node.InEIdV.IsSorted()) {
919  const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
920  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
921  }
922  // check out-edge ids
923  int prevEId = -1;
924  for (int e = 0; e < Node.GetOutDeg(); e++) {
925  if (! IsEdge(Node.GetOutEId(e))) {
926  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetOutEId(e), Node.GetId());
927  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
928  }
929  if (e > 0 && prevEId == Node.GetOutEId(e)) {
930  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
931  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
932  }
933  prevEId = Node.GetOutEId(e);
934  }
935  // check in-edge ids
936  prevEId = -1;
937  for (int e = 0; e < Node.GetInDeg(); e++) {
938  if (! IsEdge(Node.GetInEId(e))) {
939  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetInEId(e), Node.GetId());
940  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
941  }
942  if (e > 0 && prevEId == Node.GetInEId(e)) {
943  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
944  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
945  }
946  prevEId = Node.GetInEId(e);
947  }
948  }
949  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
950  const TEdge& Edge = EdgeH[E];
951  if (! IsNode(Edge.GetSrcNId())) {
952  const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
953  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
954  }
955  if (! IsNode(Edge.GetDstNId())) {
956  const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
957  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
958  }
959  }
960  return RetVal;
961 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2804
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
THash< TInt, TNode > NodeH
Definition: network.h:2053
char * CStr()
Definition: dt.h:479
bool TNEANet::IsStrAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Returns true if Str attr exists for edge NId and has default value.

Definition at line 474 of file network.cpp.

474  {
475  return EdgeAttrIsStrDeleted(EId, KeyToIndexTypeE.GetI(attr));
476 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge str attr iterator.
Definition: network.cpp:509
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsStrAttrDeletedN ( const int &  NId,
const TStr attr 
) const

Returns true if Str attr exists for node NId and has default value.

Definition at line 238 of file network.cpp.

238  {
239  return NodeAttrIsStrDeleted(NId, KeyToIndexTypeN.GetI(attr));
240 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node str attr iterator.
Definition: network.cpp:278
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TNEANet::IsStrAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1860 of file network.cpp.

1860  {
1861  return (KeyToIndexTypeE.IsKey(attr) &&
1862  KeyToIndexTypeE.GetDat(attr).Val1 == StrType);
1863 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static PNEANet TNEANet::Load ( TSIn SIn)
inlinestatic

Static constructor that loads the graph from a stream SIn and returns a pointer to it.

Definition at line 2232 of file network.h.

2232 { return PNEANet(new TNEANet(SIn)); }
TNEANet()
Definition: network.h:2124
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
static PNEANet TNEANet::Load_V1 ( TSIn SIn)
inlinestatic

Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible.

Definition at line 2234 of file network.h.

2234  {
2235  PNEANet Graph = PNEANet(new TNEANet());
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);
2245  return Graph;
2246  }
TNEANet()
Definition: network.h:2124
Definition: bd.h:196
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
static PNEANet TNEANet::Load_V2 ( TSIn SIn)
inlinestatic

Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible without Sparse.

Definition at line 2249 of file network.h.

2249  {
2250  PNEANet Graph = PNEANet(new TNEANet());
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);
2263  return Graph;
2264  }
TNEANet()
Definition: network.h:2124
Definition: bd.h:196
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
void TNEANet::LoadNetworkShM ( TShMIn ShMIn)

load network from shared memory for this network

Definition at line 2 of file network.cpp.

2  {
3  MxNId = TInt(ShMIn);
4  MxEId = TInt(ShMIn);
5 
6  LoadTNodeFunctor NodeFn;
7  NodeH.LoadShM(ShMIn, NodeFn);
8 
9  EdgeH.LoadShM(ShMIn);
10  KeyToIndexTypeN.LoadShM(ShMIn);
11  KeyToIndexTypeE.LoadShM(ShMIn);
12 
13  KeyToDenseN.LoadShM(ShMIn);
14  KeyToDenseE.LoadShM(ShMIn);
15 
16  IntDefaultsN.LoadShM(ShMIn);
17  IntDefaultsE.LoadShM(ShMIn);
18  StrDefaultsN.LoadShM(ShMIn);
19  StrDefaultsE.LoadShM(ShMIn);
20  FltDefaultsE.LoadShM(ShMIn);
21  FltDefaultsE.LoadShM(ShMIn);
22 
23  LoadVecFunctor vec_fn;
24  VecOfIntVecsN.LoadShM(ShMIn, vec_fn);
25  VecOfIntVecsE.LoadShM(ShMIn, vec_fn);
26  /* Strings and floats are complicated, so don't optimize on these */
27  VecOfStrVecsN.Load(ShMIn);
28  VecOfStrVecsE.Load(ShMIn);
29  VecOfFltVecsN.Load(ShMIn);
30  VecOfFltVecsE.Load(ShMIn);
31 
32  LoadVecOfVecFunctor vec_of_vec_fn;
33  VecOfIntVecVecsN.LoadShM(ShMIn, vec_of_vec_fn);
34  VecOfIntVecVecsE.LoadShM(ShMIn, vec_of_vec_fn);
35  VecOfFltVecVecsN.LoadShM(ShMIn, vec_of_vec_fn);
36  VecOfFltVecVecsE.LoadShM(ShMIn, vec_of_vec_fn);
37 
38  LoadHashOfVecFunctor hash_of_vec_fn;
39  VecOfIntHashVecsN.LoadShM(ShMIn, hash_of_vec_fn);
40  VecOfIntHashVecsE.LoadShM(ShMIn, hash_of_vec_fn);
41  VecOfFltHashVecsN.LoadShM(ShMIn, hash_of_vec_fn);
42  VecOfFltHashVecsE.LoadShM(ShMIn, hash_of_vec_fn);
43 
44  /* Attributes are complicated so load these straight */
45  SAttrN.Load(ShMIn);
46  SAttrE.Load(ShMIn);
47 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
void Load(TSIn &SIn)
Definition: ds.h:946
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
Definition: hash.h:157
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
Definition: dt.h:1137
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
Definition: ds.h:932
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
void Load(TSIn &SIn)
Load attribute from input stream.
Definition: attr.h:25
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
static PNEANet TNEANet::LoadShM ( TShMIn ShMIn)
inlinestatic

Static constructor that loads the network from memory.

The object is read-only. It does not support operations that edit the edge vectors of nodes or perform illegal operations on the NodeH, EdgeH (deletion or swapping keys).

Definition at line 2273 of file network.h.

2273  {
2274  TNEANet* Network = new TNEANet();
2275  Network->LoadNetworkShM(ShMIn);
2276  return PNEANet(Network);
2277  }
TNEANet()
Definition: network.h:2124
Directed multigraph with node edge attributes.
Definition: network.h:1741
void LoadNetworkShM(TShMIn &ShMIn)
load network from shared memory for this network
Definition: network.cpp:2
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
static PNEANet TNEANet::New ( )
inlinestatic

Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().

Definition at line 2226 of file network.h.

2226 { return PNEANet(new TNEANet()); }
TNEANet()
Definition: network.h:2124
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
static PNEANet TNEANet::New ( const int &  Nodes,
const int &  Edges 
)
inlinestatic

Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges.

Call: PNEANet Net = TNEANet::New(Nodes, Edges).

Definition at line 2230 of file network.h.

2230 { return PNEANet(new TNEANet(Nodes, Edges)); }
TNEANet()
Definition: network.h:2124
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1720
bool TNEANet::NodeAttrIsDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted for current node attr iterator.

Definition at line 246 of file network.cpp.

246  {
247  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
248  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
249  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
250  bool IntVDel = NodeAttrIsIntVDeleted(NId, NodeHI);
251  return IntDel || StrDel || FltDel || IntVDel;
252 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node str attr iterator.
Definition: network.cpp:278
bool NodeAttrIsIntVDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int vector attr iterator. ...
Definition: network.cpp:262
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node flt attr iterator.
Definition: network.cpp:286
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node int attr iterator.
Definition: network.cpp:254
bool TNEANet::NodeAttrIsFltDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted value for current node flt attr iterator.

Definition at line 286 of file network.cpp.

286  {
287  if (NodeHI.GetDat().Val1 != FltType) {
288  return false;
289  }
290  return (GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
291  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
292 }
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TInt, TNode > NodeH
Definition: network.h:2053
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2042
bool TNEANet::NodeAttrIsFltVDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted value for current node int vector attr iterator.

Definition at line 270 of file network.cpp.

270  {
271  if (NodeHI.GetDat().Val1 != FltVType) {
272  return false;
273  }
274  return (TFltV() == this->VecOfFltVecVecsN.GetVal(
275  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
276 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
const TKey & GetKey() const
Definition: hash.h:80
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFlt > TFltV
Definition: ds.h:1596
THash< TInt, TNode > NodeH
Definition: network.h:2053
bool TNEANet::NodeAttrIsIntDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted value for current node int attr iterator.

Definition at line 254 of file network.cpp.

254  {
255  if (NodeHI.GetDat().Val1 != IntType) {
256  return false;
257  }
258  return (GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
259  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
260 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2053
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2038
bool TNEANet::NodeAttrIsIntVDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted value for current node int vector attr iterator.

Definition at line 262 of file network.cpp.

262  {
263  if (NodeHI.GetDat().Val1 != IntVType) {
264  return false;
265  }
266  return (TIntV() == this->VecOfIntVecVecsN.GetVal(
267  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
268 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TInt > TIntV
Definition: ds.h:1594
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
bool TNEANet::NodeAttrIsStrDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Returns true if NId attr deleted value for current node str attr iterator.

Definition at line 278 of file network.cpp.

278  {
279  if (NodeHI.GetDat().Val1 != StrType) {
280  return false;
281  }
282  return (GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
283  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
284 }
const TKey & GetKey() const
Definition: hash.h:80
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
const TDat & GetDat() const
Definition: hash.h:81
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2040
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2053
TNEANet& TNEANet::operator= ( const TNEANet Graph)
inline

Definition at line 2358 of file network.h.

2358  { if (this!=&Graph) {
2359  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH; }
2360  return *this; }
TInt MxNId
Definition: network.h:2052
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TInt MxEId
Definition: network.h:2052
THash< TInt, TNode > NodeH
Definition: network.h:2053
void TNEANet::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

Reserves memory for a graph of Nodes nodes and Edges edges.

Definition at line 2844 of file network.h.

2844  {
2845  if (Nodes>0) { NodeH.Gen(Nodes/2); } if (Edges>0) { EdgeH.Gen(Edges/2); } }
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
void Gen(const int &ExpectVals)
Definition: hash.h:222
THash< TInt, TNode > NodeH
Definition: network.h:2053
void TNEANet::Save ( TSOut SOut) const
inline

Saves the graph to a (binary) stream SOut. Expects data structures for sparse attributes.

Definition at line 2187 of file network.h.

2187  {
2188  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.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);
2200  VecOfFltHashVecsN.Save(SOut); VecOfFltHashVecsE.Save(SOut);
2201  SAttrN.Save(SOut); SAttrE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
void Save(TSOut &SOut) const
Definition: dt.h:1153
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
Definition: network.h:2069
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
Definition: network.h:2069
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:33
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
void TNEANet::Save_V1 ( TSOut SOut) const
inline

Saves the graph to a (binary) stream SOut. Available for backwards compatibility.

Definition at line 2203 of file network.h.

2203  {
2204  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.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); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
void Save(TSOut &SOut) const
Definition: dt.h:1153
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TInt MxEId
Definition: network.h:2052
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
void TNEANet::Save_V2 ( TSOut SOut) const
inline

Saves the graph without any sparse data structures. Available for backwards compatibility.

Definition at line 2213 of file network.h.

2213  {
2214  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.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); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
void Save(TSOut &SOut) const
Definition: dt.h:1153
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TVec< TFltV > > VecOfFltVecVecsN
Definition: network.h:2067
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVec< TVec< TFltV > > VecOfFltVecVecsE
Definition: network.h:2067
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:33
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
void TNEANet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 2623 of file network.h.

2623  {
2624  StrAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void StrAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of str attr names for node NId.
Definition: network.h:2623
void TNEANet::StrAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 411 of file network.cpp.

411  {
412  Names = TVec<TStr>();
413  while (!EdgeHI.IsEnd()) {
414  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
415  Names.Add(EdgeHI.GetKey());
416  }
417  EdgeHI++;
418  }
419 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge str attr iterator.
Definition: network.cpp:509
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::StrAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 2569 of file network.h.

2569  {
2570  StrAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}
void StrAttrNameNI(const TInt &NId, TStrV &Names) const
Returns a vector of str attr names for node NId.
Definition: network.h:2569
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::StrAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 175 of file network.cpp.

175  {
176  Names = TVec<TStr>();
177  while (!NodeHI.IsEnd()) {
178  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
179  Names.Add(NodeHI.GetKey());
180  }
181  NodeHI++;
182  }
183 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node str attr iterator.
Definition: network.cpp:278
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2627 of file network.h.

2627  {
2628  StrAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2627
void TNEANet::StrAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 421 of file network.cpp.

421  {
422  Values = TVec<TStr>();
423  while (!EdgeHI.IsEnd()) {
424  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
425  TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
426  Values.Add(val);
427  }
428  EdgeHI++;
429  }
430 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge str attr iterator.
Definition: network.cpp:509
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANet::StrAttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2573 of file network.h.

2573  {
2574  StrAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}
TIter BegI() const
Definition: hash.h:213
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2573
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
void TNEANet::StrAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 185 of file network.cpp.

185  {
186  Values = TVec<TStr>();
187  while (!NodeHI.IsEnd()) {
188  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
189  TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
190  Values.Add(val);
191  }
192  NodeHI++;
193  }
194 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted value for current node str attr iterator.
Definition: network.cpp:278
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: dt.h:412
THash< TInt, TNode > NodeH
Definition: network.h:2053
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Friends And Related Function Documentation

friend class TPt< TNEANet >
friend

Definition at line 3360 of file network.h.

Member Data Documentation

TCRef TNEANet::CRef

Definition at line 2050 of file network.h.

THash<TInt, TEdge> TNEANet::EdgeH
protected

Definition at line 2054 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsE
protected

Definition at line 2062 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsN
protected

Definition at line 2062 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsE
protected

Definition at line 2060 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsN
protected

Definition at line 2060 of file network.h.

THash<TStr, TBool> TNEANet::KeyToDenseE
protected

Definition at line 2058 of file network.h.

THash<TStr, TBool> TNEANet::KeyToDenseN
protected

KeyToDense[N|E]: Key->(True if Vec, False if Hash)

Definition at line 2058 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeE
protected

Definition at line 2056 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeN
protected

KeyToIndexType[N|E]: Key->(Type,Index).

Definition at line 2056 of file network.h.

TInt TNEANet::MxEId
protected

Definition at line 2052 of file network.h.

TInt TNEANet::MxNId
protected

Definition at line 2052 of file network.h.

THash<TInt, TNode> TNEANet::NodeH
protected

Definition at line 2053 of file network.h.

TAttr TNEANet::SAttrE
protected

Definition at line 2073 of file network.h.

TAttr TNEANet::SAttrN
protected

Definition at line 2072 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsE
protected

Definition at line 2061 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsN
protected

Definition at line 2061 of file network.h.

TVec<THash<TInt, TFltV> > TNEANet::VecOfFltHashVecsE
protected

Definition at line 2069 of file network.h.

TVec<THash<TInt, TFltV> > TNEANet::VecOfFltHashVecsN
protected

Definition at line 2069 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsE
protected

Definition at line 2065 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsN
protected

Definition at line 2065 of file network.h.

TVec<TVec<TFltV> > TNEANet::VecOfFltVecVecsE
protected

Definition at line 2067 of file network.h.

TVec<TVec<TFltV> > TNEANet::VecOfFltVecVecsN
protected

Definition at line 2067 of file network.h.

TVec<THash<TInt, TIntV> > TNEANet::VecOfIntHashVecsE
protected

Definition at line 2068 of file network.h.

TVec<THash<TInt, TIntV> > TNEANet::VecOfIntHashVecsN
protected

Definition at line 2068 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsE
protected

Definition at line 2063 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsN
protected

Definition at line 2063 of file network.h.

TVec<TVec<TIntV> > TNEANet::VecOfIntVecVecsE
protected

Definition at line 2066 of file network.h.

TVec<TVec<TIntV> > TNEANet::VecOfIntVecVecsN
protected

Definition at line 2066 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsE
protected

Definition at line 2064 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsN
protected

Definition at line 2064 of file network.h.


The documentation for this class was generated from the following files: