SNAP Library 4.0, User Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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  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...
 
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 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 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...
 
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 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 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)
 
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
 
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)
 
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 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 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 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 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 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 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 }
 

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< THash< TInt, TIntV > > VecOfIntHashVecsN
 
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
 
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 

Definition at line 2043 of file network.h.

Constructor & Destructor Documentation

TNEANet::TNEANet ( )
inline

Definition at line 2097 of file network.h.

2097  : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
TCRef CRef
Definition: network.h:2025
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
TNEANet::TNEANet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

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

Definition at line 2104 of file network.h.

2104  : CRef(),
2110  { Reserve(Nodes, Edges); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: network.h:2634
TCRef CRef
Definition: network.h:2025
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
TNEANet::TNEANet ( const TNEANet Graph)
inline

Definition at line 2111 of file network.h.

2111  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
TNEANet::TNEANet ( TSIn SIn)
inline

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

Definition at line 2118 of file network.h.

2118  : MxNId(SIn), MxEId(SIn), NodeH(SIn), EdgeH(SIn),
2120  StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
2123  SAttrN(SIn), SAttrE(SIn) { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
TNEANet::TNEANet ( const TNEANet Graph,
bool  modeSubGraph 
)
inlineprotected

Definition at line 2125 of file network.h.

2125  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
TNEANet::TNEANet ( bool  copyAll,
const TNEANet Graph 
)
inlineprotected

Definition at line 2131 of file network.h.

2131  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033

Member Function Documentation

int TNEANet::AddAttributes ( const int  NId)
protected

Definition at line 468 of file network.cpp.

468  {
469  int i;
470  // update attribute columns
471  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
472  TVec<TInt>& IntVec = VecOfIntVecsN[i];
473  int KeyId = NodeH.GetKeyId(NId);
474  if (IntVec.Len() > KeyId) {
475  IntVec[KeyId] = TInt::Mn;
476  } else {
477  IntVec.Ins(KeyId, TInt::Mn);
478  }
479  }
480  TVec<TStr> DefIntVec = TVec<TStr>();
481  IntDefaultsN.GetKeyV(DefIntVec);
482  for (i = 0; i < DefIntVec.Len(); i++) {
483  TStr attr = DefIntVec[i];
484  TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
485  IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
486  }
487  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
488  TVec<TStr>& StrVec = VecOfStrVecsN[i];
489  int KeyId = NodeH.GetKeyId(NId);
490  if (StrVec.Len() > KeyId) {
491  StrVec[KeyId] = TStr::GetNullStr();
492  } else {
493  StrVec.Ins(KeyId, TStr::GetNullStr());
494  }
495  }
496  TVec<TStr> DefStrVec = TVec<TStr>();
497  StrDefaultsN.GetKeyV(DefStrVec);
498  for (i = 0; i < DefStrVec.Len(); i++) {
499  TStr attr = DefStrVec[i];
500  TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
501  StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
502  }
503  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
504  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
505  int KeyId = NodeH.GetKeyId(NId);
506  if (FltVec.Len() > KeyId) {
507  FltVec[KeyId] = TFlt::Mn;
508  } else {
509  FltVec.Ins(KeyId, TFlt::Mn);
510  }
511  }
512  TVec<TStr> DefFltVec = TVec<TStr>();
513  FltDefaultsN.GetKeyV(DefFltVec);
514  for (i = 0; i < DefFltVec.Len(); i++) {
515  TStr attr = DefFltVec[i];
516  TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
517  FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
518  }
519  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
520  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
521  int KeyId = NodeH.GetKeyId(NId);
522  if (IntVecV.Len() > KeyId) {
523  IntVecV[KeyId] = TIntV();
524  } else {
525  IntVecV.Ins(KeyId, TIntV());
526  }
527  }
528  return NId;
529 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
static const int Mn
Definition: dt.h:1138
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2015
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
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
Definition: dt.h:412
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2017
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2013
static const double Mn
Definition: dt.h:1387
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 622 of file network.cpp.

622  {
623  int i;
624 
625  if (EId == -1) { EId = MxEId; MxEId++; }
626  else { MxEId = TMath::Mx(EId+1, MxEId()); }
627  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
628  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
629  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
630  GetNode(SrcNId).OutEIdV.AddSorted(EId);
631  GetNode(DstNId).InEIdV.AddSorted(EId);
632 
633  // update attribute columns
634  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
635  TVec<TInt>& IntVec = VecOfIntVecsE[i];
636  int KeyId = EdgeH.GetKeyId(EId);
637  if (IntVec.Len() > KeyId) {
638  IntVec[KeyId] = TInt::Mn;
639  } else {
640  IntVec.Ins(KeyId, TInt::Mn);
641  }
642  }
643  TVec<TStr> DefIntVec = TVec<TStr>();
644  IntDefaultsE.GetKeyV(DefIntVec);
645  for (i = 0; i < DefIntVec.Len(); i++) {
646  TStr attr = DefIntVec[i];
647  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
648  IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
649  }
650 
651  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
652  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
653  IntVecV.Ins(EdgeH.GetKeyId(EId), TIntV());
654  }
655 
656  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
657  TVec<TStr>& StrVec = VecOfStrVecsE[i];
658  int KeyId = EdgeH.GetKeyId(EId);
659  if (StrVec.Len() > KeyId) {
660  StrVec[KeyId] = TStr::GetNullStr();
661  } else {
662  StrVec.Ins(KeyId, TStr::GetNullStr());
663  }
664  }
665  TVec<TStr> DefStrVec = TVec<TStr>();
666  StrDefaultsE.GetKeyV(DefStrVec);
667  for (i = 0; i < DefStrVec.Len(); i++) {
668  TStr attr = DefStrVec[i];
669  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
670  StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
671  }
672 
673  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
674  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
675  int KeyId = EdgeH.GetKeyId(EId);
676  if (FltVec.Len() > KeyId) {
677  FltVec[KeyId] = TFlt::Mn;
678  } else {
679  FltVec.Ins(KeyId, TFlt::Mn);
680  }
681  }
682  TVec<TStr> DefFltVec = TVec<TStr>();
683  FltDefaultsE.GetKeyV(DefFltVec);
684  for (i = 0; i < DefFltVec.Len(); i++) {
685  TStr attr = DefFltVec[i];
686  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
687  FltVec[EdgeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
688  }
689  return EId;
690 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TNode & GetNode(const int &NId)
Definition: network.h:2005
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2019
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TIntV OutEIdV
Definition: network.h:1749
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
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:2029
static const int Mn
Definition: dt.h:1138
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2021
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
static TStr GetNullStr()
Definition: dt.cpp:1626
TInt MxEId
Definition: network.h:2027
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:2036
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:2023
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:2298
TIntV InEIdV
Definition: network.h:1749
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
static const double Mn
Definition: dt.h:1387
int TNEANet::AddEdge ( const TEdgeI EdgeI)
inline

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

Definition at line 2585 of file network.h.

2585 { 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:622
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 2690 of file network.h.

2690 { 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:2690
int TNEANet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 1121 of file network.cpp.

1121  {
1122  int i;
1123  TInt CurrLen;
1124 
1125  if (!IsEdge(EId)) {
1126  //AddEdge(EId);
1127  return -1;
1128  }
1129  if (KeyToIndexTypeE.IsKey(attr)) {
1131  NewVec[EdgeH.GetKeyId(EId)] = value;
1132  } else {
1133  CurrLen = VecOfFltVecsE.Len();
1134  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1135  TVec<TFlt> NewVec = TVec<TFlt>();
1136  for (i = 0; i < MxEId; i++) {
1137  NewVec.Ins(i, GetFltAttrDefaultE(attr));
1138  }
1139  NewVec[EdgeH.GetKeyId(EId)] = value;
1140  VecOfFltVecsE.Add(NewVec);
1141  }
1142  return 0;
1143 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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:2023
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::AddFltAttrDatN ( const TNodeI NodeI,
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 node attribute value vector.

Definition at line 2664 of file network.h.

2664 { 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:2664
int TNEANet::AddFltAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 1010 of file network.cpp.

1010  {
1011  int i;
1012  TInt CurrLen;
1013 
1014  if (!IsNode(NId)) {
1015  // AddNode(NId);
1016  return -1;
1017  }
1018  if (KeyToIndexTypeN.IsKey(attr)) {
1020  NewVec[NodeH.GetKeyId(NId)] = value;
1021  } else {
1022  CurrLen = VecOfFltVecsN.Len();
1023  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
1024  TVec<TFlt> NewVec = TVec<TFlt>();
1025  for (i = 0; i < MxNId; i++) {
1026  NewVec.Ins(i, GetFltAttrDefaultN(attr));
1027  }
1028  NewVec[NodeH.GetKeyId(NId)] = value;
1029  VecOfFltVecsN.Add(NewVec);
1030  }
1031  return 0;
1032 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:2027
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2040
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2017
bool IsKey(const TKey &Key) const
Definition: hash.h:258
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 1399 of file network.cpp.

1399  {
1400  int i;
1401  TInt CurrLen;
1402  TVec<TFlt> NewVec;
1403  CurrLen = VecOfFltVecsE.Len();
1404  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1405  NewVec = TVec<TFlt>();
1406  for (i = 0; i < MxEId; i++) {
1407  NewVec.Ins(i, defaultValue);
1408  }
1409  VecOfFltVecsE.Add(NewVec);
1410  if (!FltDefaultsE.IsKey(attr)) {
1411  FltDefaultsE.AddDat(attr, defaultValue);
1412  } else {
1413  return -1;
1414  }
1415  return 0;
1416 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 1322 of file network.cpp.

1322  {
1323  // TODO(nkhadke): add error checking
1324  int i;
1325  TInt CurrLen;
1326  TVec<TFlt> NewVec;
1327  CurrLen = VecOfFltVecsN.Len();
1328  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
1329  NewVec = TVec<TFlt>();
1330  for (i = 0; i < MxNId; i++) {
1331  NewVec.Ins(i, defaultValue);
1332  }
1333  VecOfFltVecsN.Add(NewVec);
1334  if (!FltDefaultsN.IsKey(attr)) {
1335  FltDefaultsN.AddDat(attr, defaultValue);
1336  } else {
1337  return -1;
1338  }
1339  return 0;
1340 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2040
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
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 2680 of file network.h.

2680 { 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:2680
int TNEANet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 1034 of file network.cpp.

1034  {
1035  int i;
1036  TInt CurrLen;
1037  if (!IsEdge(EId)) {
1038  //AddEdge(EId);
1039  return -1;
1040  }
1041  if (KeyToIndexTypeE.IsKey(attr)) {
1043  NewVec[EdgeH.GetKeyId(EId)] = value;
1044  } else {
1045  CurrLen = VecOfIntVecsE.Len();
1046  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
1047  TVec<TInt> NewVec = TVec<TInt>();
1048  for (i = 0; i < MxEId; i++) {
1049  NewVec.Ins(i, GetIntAttrDefaultE(attr));
1050  }
1051  NewVec[EdgeH.GetKeyId(EId)] = value;
1052  VecOfIntVecsE.Add(NewVec);
1053  }
1054  return 0;
1055 }
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:2019
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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.

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

Definition at line 2654 of file network.h.

2654 { 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:2654
int TNEANet::AddIntAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 894 of file network.cpp.

894  {
895  int i;
896  TInt CurrLen;
897  if (!IsNode(NId)) {
898  // AddNode(NId);
899  return -1;
900  }
901  if (KeyToIndexTypeN.IsKey(attr)) {
903  NewVec[NodeH.GetKeyId(NId)] = value;
904  } else {
905  CurrLen = VecOfIntVecsN.Len();
906  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
907  TVec<TInt> NewVec = TVec<TInt>();
908  for (i = 0; i < MxNId; i++) {
909  NewVec.Ins(i, GetIntAttrDefaultN(attr));
910  }
911  NewVec[NodeH.GetKeyId(NId)] = value;
912  VecOfIntVecsN.Add(NewVec);
913  }
914  return 0;
915 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:2027
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2013
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 1342 of file network.cpp.

1342  {
1343  // TODO(nkhadke): add error checking
1344  int i;
1345  TInt CurrLen;
1346  TVec<TInt> NewVec;
1347  CurrLen = VecOfIntVecsE.Len();
1348  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
1349  NewVec = TVec<TInt>();
1350  for (i = 0; i < MxEId; i++) {
1351  NewVec.Ins(i, defaultValue);
1352  }
1353  VecOfIntVecsE.Add(NewVec);
1354  if (!IntDefaultsE.IsKey(attr)) {
1355  IntDefaultsE.AddDat(attr, defaultValue);
1356  } else {
1357  return -1;
1358  }
1359  return 0;
1360 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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 1266 of file network.cpp.

1266  {
1267  int i;
1268  TInt CurrLen;
1269  TVec<TInt> NewVec;
1270  CurrLen = VecOfIntVecsN.Len();
1271  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
1272  NewVec = TVec<TInt>();
1273  for (i = 0; i < MxNId; i++) {
1274  NewVec.Ins(i, defaultValue);
1275  }
1276  VecOfIntVecsN.Add(NewVec);
1277  if (!IntDefaultsN.IsKey(attr)) {
1278  IntDefaultsN.AddDat(attr, defaultValue);
1279  } else {
1280  return -1;
1281  }
1282  return 0;
1283 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:2027
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2035
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 intv value pair to the corresponding edge attribute value vector.

Definition at line 2695 of file network.h.

2695 { 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:2695
int TNEANet::AddIntVAttrDatE ( const int &  EId,
const TIntV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1057 of file network.cpp.

1057  {
1058  if (!IsNode(EId)) {
1059  // AddNode(NId);
1060  return -1;
1061  }
1062  TInt location = CheckDenseOrSparseE(attr);
1063  if (location==-1) {
1064  AddIntVAttrE(attr, UseDense);
1065  location = CheckDenseOrSparseE(attr);
1066  }
1067  if (UseDense) {
1068  IAssertR(location != 0, TStr::Fmt("EdgeID %d exists for %s in sparse representation", EId, attr.CStr()));
1070  NewVec[EdgeH.GetKeyId(EId)] = value;
1071  } else {
1072  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", EId, attr.CStr()));
1074  NewHash.AddDat(EdgeH.GetKeyId(EId), value);
1075  }
1076  return 0;
1077 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
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:1362
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:2298
char * CStr()
Definition: dt.h:476
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.

Adds the key intv value pair to the corresponding node attribute value vector.

Definition at line 2669 of file network.h.

2669 { 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:2669
int TNEANet::AddIntVAttrDatN ( const int &  NId,
const TIntV value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 917 of file network.cpp.

917  {
918  if (!IsNode(NId)) {
919  // AddNode(NId);
920  return -1;
921  }
922  TInt location = CheckDenseOrSparseN(attr);
923  if (location==-1) {
924  AddIntVAttrN(attr, UseDense);
925  location = CheckDenseOrSparseN(attr);
926  }
927  if (UseDense) {
928  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
930  NewVec[NodeH.GetKeyId(NId)] = value;
931  } else {
932  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
934  NewHash.AddDat(NodeH.GetKeyId(NId), value);
935  }
936 
937  return 0;
938 }
#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:1285
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2042
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
char * CStr()
Definition: dt.h:476
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 1362 of file network.cpp.

1362  {
1363  TInt CurrLen;
1364  if (UseDense) {
1365  CurrLen = VecOfIntVecVecsE.Len();
1366  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
1367  KeyToDenseE.AddDat(attr, true);
1368  TVec<TIntV> NewVec = TVec<TIntV>(MxEId);
1369  VecOfIntVecVecsE.Add(NewVec);
1370  } else {
1371  CurrLen = VecOfIntHashVecsE.Len();
1372  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
1373  KeyToDenseE.AddDat(attr, false);
1374  THash<TInt, TIntV> NewHash;
1375  VecOfIntHashVecsE.Add(NewHash);
1376  }
1377  return 0;
1378 }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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 1285 of file network.cpp.

1285  {
1286  TInt CurrLen;
1287  if (UseDense) {
1288  CurrLen = VecOfIntVecVecsN.Len();
1289  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
1290  KeyToDenseN.AddDat(attr, true);
1291  TVec<TIntV> NewVec = TVec<TIntV>(MxNId);
1292  VecOfIntVecVecsN.Add(NewVec);
1293  } else {
1294  CurrLen = VecOfIntHashVecsN.Len();
1295  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
1296  KeyToDenseN.AddDat(attr, false);
1297  THash<TInt, TIntV> NewHash;
1298  VecOfIntHashVecsN.Add(NewHash);
1299  }
1300  return 0;
1301 }
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:2027
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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:2033
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 444 of file network.cpp.

444  {
445  if (NId == -1) {
446  NId = MxNId; MxNId++;
447  } else {
448  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
449  MxNId = TMath::Mx(NId+1, MxNId());
450  }
451  NodeH.AddDat(NId, TNode(NId));
452  AddAttributes(NId);
453  return NId;
454 }
#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:2027
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:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
int AddAttributes(const int NId)
Definition: network.cpp:468
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 2290 of file network.h.

2290 { return AddNode(NodeI.GetId()); }
int AddNode(int NId=-1)
Adds a node of ID NId to the network.
Definition: network.cpp:444
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 456 of file network.cpp.

456  {
457  if (NId == -1) {
458  NId = MxNId; MxNId++;
459  } else {
460  if (IsNode(NId)) { return -1;}
461  MxNId = TMath::Mx(NId+1, MxNId());
462  }
463  NodeH.AddDat(NId, TNode(NId));
464  AddAttributes(NId);
465  return NId;
466 }
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt MxNId
Definition: network.h:2027
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
int AddAttributes(const int NId)
Definition: network.cpp:468
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 1669 of file network.cpp.

1669  {
1670  if (!IsEdge(EId)) {
1671  return -1;
1672  }
1673  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1674 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 1676 of file network.cpp.

1676  {
1677  if (!IsEdge(EId)) {
1678  return -1;
1679  }
1680  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1681 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 2991 of file network.h.

2991  {
2992  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
2993  }
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:1669
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 2995 of file network.h.

2995  {
2996  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
2997  }
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:1669
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 1683 of file network.cpp.

1683  {
1684  if (!IsEdge(EId)) {
1685  return -1;
1686  }
1687  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1688 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 1690 of file network.cpp.

1690  {
1691  if (!IsEdge(EId)) {
1692  return -1;
1693  }
1694  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1695 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 3005 of file network.h.

3005  {
3006  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
3007  }
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:1669
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 3009 of file network.h.

3009  {
3010  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
3011  }
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:1669
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 1697 of file network.cpp.

1697  {
1698  if (!IsEdge(EId)) {
1699  return -1;
1700  }
1701  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1702 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 1704 of file network.cpp.

1704  {
1705  if (!IsEdge(EId)) {
1706  return -1;
1707  }
1708  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1709 }
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:2595
TAttr SAttrE
Definition: network.h:2046
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 3019 of file network.h.

3019  {
3020  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
3021  }
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:1669
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 3023 of file network.h.

3023  {
3024  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
3025  }
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:1669
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 1543 of file network.cpp.

1543  {
1544  if (!IsNode(NId)) {
1545  return -1;
1546  }
1547  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1548 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 1550 of file network.cpp.

1550  {
1551  if (!IsNode(NId)) {
1552  return -1;
1553  }
1554  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1555 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 2873 of file network.h.

2873  {
2874  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2875  }
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:1543
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 2877 of file network.h.

2877  {
2878  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2879  }
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:1543
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 1557 of file network.cpp.

1557  {
1558  if (!IsNode(NId)) {
1559  return -1;
1560  }
1561  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1562 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 1564 of file network.cpp.

1564  {
1565  if (!IsNode(NId)) {
1566  return -1;
1567  }
1568  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1569 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 2887 of file network.h.

2887  {
2888  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2889  }
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:1543
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 2891 of file network.h.

2891  {
2892  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2893  }
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:1543
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 1571 of file network.cpp.

1571  {
1572  if (!IsNode(NId)) {
1573  return -1;
1574  }
1575  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1576 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 1578 of file network.cpp.

1578  {
1579  if (!IsNode(NId)) {
1580  return -1;
1581  }
1582  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1583 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
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 2901 of file network.h.

2901  {
2902  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2903  }
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:1543
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 2905 of file network.h.

2905  {
2906  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2907  }
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:1543
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 1783 of file network.cpp.

1783  {
1784  return SAttrE.AddSAttr(Name, AttrType, AttrId);
1785 }
TAttr SAttrE
Definition: network.h:2046
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 1657 of file network.cpp.

1657  {
1658  return SAttrN.AddSAttr(Name, AttrType, AttrId);
1659 }
TAttr SAttrN
Definition: network.h:2045
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 2685 of file network.h.

2685 { 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:2685
int TNEANet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 1098 of file network.cpp.

1098  {
1099  int i;
1100  TInt CurrLen;
1101  if (!IsEdge(EId)) {
1102  //AddEdge(EId);
1103  return -1;
1104  }
1105  if (KeyToIndexTypeE.IsKey(attr)) {
1107  NewVec[EdgeH.GetKeyId(EId)] = value;
1108  } else {
1109  CurrLen = VecOfStrVecsE.Len();
1110  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
1111  TVec<TStr> NewVec = TVec<TStr>();
1112  for (i = 0; i < MxEId; i++) {
1113  NewVec.Ins(i, GetStrAttrDefaultE(attr));
1114  }
1115  NewVec[EdgeH.GetKeyId(EId)] = value;
1116  VecOfStrVecsE.Add(NewVec);
1117  }
1118  return 0;
1119 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2021
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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.

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

Definition at line 2659 of file network.h.

2659 { 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:2659
int TNEANet::AddStrAttrDatN ( const int &  NId,
const TStr value,
const TStr attr 
)

Definition at line 987 of file network.cpp.

987  {
988  int i;
989  TInt CurrLen;
990  if (!IsNode(NId)) {
991  // AddNode(NId);
992  return -1;
993  }
994  if (KeyToIndexTypeN.IsKey(attr)) {
996  NewVec[NodeH.GetKeyId(NId)] = value;
997  } else {
998  CurrLen = VecOfStrVecsN.Len();
999  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
1000  TVec<TStr> NewVec = TVec<TStr>();
1001  for (i = 0; i < MxNId; i++) {
1002  NewVec.Ins(i, GetStrAttrDefaultN(attr));
1003  }
1004  NewVec[NodeH.GetKeyId(NId)] = value;
1005  VecOfStrVecsN.Add(NewVec);
1006  }
1007  return 0;
1008 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:2027
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2015
Definition: dt.h:1134
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:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 1380 of file network.cpp.

1380  {
1381  int i;
1382  TInt CurrLen;
1383  TVec<TStr> NewVec;
1384  CurrLen = VecOfStrVecsE.Len();
1385  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
1386  NewVec = TVec<TStr>();
1387  for (i = 0; i < MxEId; i++) {
1388  NewVec.Ins(i, defaultValue);
1389  }
1390  VecOfStrVecsE.Add(NewVec);
1391  if (!StrDefaultsE.IsKey(attr)) {
1392  StrDefaultsE.AddDat(attr, defaultValue);
1393  } else {
1394  return -1;
1395  }
1396  return 0;
1397 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
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:2036
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 1303 of file network.cpp.

1303  {
1304  int i;
1305  TInt CurrLen;
1306  TVec<TStr> NewVec;
1307  CurrLen = VecOfStrVecsN.Len();
1308  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
1309  NewVec = TVec<TStr>();
1310  for (i = 0; i < MxNId; i++) {
1311  NewVec.Ins(i, defaultValue);
1312  }
1313  VecOfStrVecsN.Add(NewVec);
1314  if (!StrDefaultsN.IsKey(attr)) {
1315  StrDefaultsN.AddDat(attr, defaultValue);
1316  } else {
1317  return -1;
1318  }
1319  return 0;
1320 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:2027
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
Definition: dt.h:1134
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::AppendIntVAttrDatE ( const TEdgeI EdgeI,
const TInt value,
const TStr attr 
)
inline

Appends value onto the TIntV attribute for the given node.

Definition at line 2698 of file network.h.

2698 { 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:2698
int TNEANet::AppendIntVAttrDatE ( const int &  EId,
const TInt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 1079 of file network.cpp.

1079  {
1080  if (!IsNode(EId)) {
1081  // AddNode(NId);
1082  return -1;
1083  }
1084  TInt location = CheckDenseOrSparseE(attr);
1085  if (location==-1) return -1;
1086  if (UseDense) {
1087  IAssertR(location != 0, TStr::Fmt("Edge %d exists for %s in sparse representation", EId, attr.CStr()));
1089  NewVec[EdgeH.GetKeyId(EId)].Add(value);
1090  } else {
1091  IAssertR(location != 1, TStr::Fmt("Edge %d exists for %s in dense representation", EId, attr.CStr()));
1093  NewHash[EdgeH.GetKeyId(EId)].Add(value);
1094  }
1095  return 0;
1096 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
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:2298
char * CStr()
Definition: dt.h:476
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 2672 of file network.h.

2672 { 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:2672
int TNEANet::AppendIntVAttrDatN ( const int &  NId,
const TInt value,
const TStr attr,
TBool  UseDense = true 
)

Definition at line 940 of file network.cpp.

940  {
941  if (!IsNode(NId)) {
942  // AddNode(NId);
943  return -1;
944  }
945  TInt location = CheckDenseOrSparseN(attr);
946  if (location==-1) {
947  AddIntVAttrN(attr, UseDense);
948  location = CheckDenseOrSparseN(attr);
949  }
950  if (UseDense) {
951  IAssertR(location != 0, TStr::Fmt("NodeId %d exists for %s in sparse representation", NId, attr.CStr()));
953  NewVec[NodeH.GetKeyId(NId)].Add(value);
954  } else {
955  IAssertR(location != 1, TStr::Fmt("NodeId %d exists for %s in dense representation", NId, attr.CStr()));
957  NewHash[NodeH.GetKeyId(NId)].Add(value);
958  }
959  return 0;
960 }
#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:1285
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2042
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
char * CStr()
Definition: dt.h:476
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 2438 of file network.h.

2438  {
2439  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:2438
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
void TNEANet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 260 of file network.cpp.

260  {
261  Names = TVec<TStr>();
262  while (!EdgeHI.IsEnd()) {
263  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
264  Names.Add(EdgeHI.GetKey());
265  }
266  EdgeHI++;
267  }
268 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:398
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 2392 of file network.h.

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

Definition at line 68 of file network.cpp.

68  {
69  Names = TVec<TStr>();
70  while (!NodeHI.IsEnd()) {
71  if (!NodeAttrIsDeleted(NId, NodeHI)) {
72  Names.Add(NodeHI.GetKey());
73  }
74  NodeHI++;
75  }
76 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:206
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 2442 of file network.h.

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

Definition at line 270 of file network.cpp.

270  {
271  Values = TVec<TStr>();
272  while (!EdgeHI.IsEnd()) {
273  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
274  Values.Add(GetEdgeAttrValue(EId, EdgeHI));
275  }
276  EdgeHI++;
277  }
278 }
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns edge attribute value, converted to Str type.
Definition: network.cpp:430
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:398
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 2396 of file network.h.

2396  {
2397  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:2396
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::AttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 78 of file network.cpp.

78  {
79  Values = TVec<TStr>();
80  while (!NodeHI.IsEnd()) {
81  if (!NodeAttrIsDeleted(NId, NodeHI)) {
82  Values.Add(GetNodeAttrValue(NId, NodeHI));
83  }
84  NodeHI++;
85  }
86 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:206
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:246
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 2559 of file network.h.

2559  {
2560  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2561  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANet::BegEAIntI ( const TStr attr) const
inline

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

Definition at line 2483 of file network.h.

2483  {
2484  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2485  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
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 2496 of file network.h.

2496  {
2497  TVec<TIntV>::TIter HI = NULL;
2499  TInt location = CheckDenseOrSparseE(attr);
2500  TBool IsDense = true;
2501  if (location != -1) {
2502  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2503  if (location == 1) {
2504  HI = VecOfIntVecVecsE[index].BegI();
2505  } else {
2506  IsDense = false;
2507  HHI = VecOfIntHashVecsE[index].BegI();
2508  }
2509  }
2510  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2511  }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
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:971
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 2548 of file network.h.

2548  {
2549  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this); }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 2603 of file network.h.

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

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

Definition at line 2382 of file network.h.

2382  {
2383  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:2031
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANet::BegNAIntI ( const TStr attr) const
inline

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

Definition at line 2306 of file network.h.

2306  {
2307  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 2316 of file network.h.

2316  {
2317  TVec<TIntV>::TIter HI = NULL;
2319  TInt location = CheckDenseOrSparseN(attr);
2320  TBool IsDense = true;
2321  if (location != -1) {
2322  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2323  if (location == 1) {
2324  HI = VecOfIntVecVecsN[index].BegI();
2325  } else {
2326  IsDense = false;
2327  HHI = VecOfIntHashVecsN[index].BegI();
2328  }
2329  }
2330  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2331  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
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:2042
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
Definition: dt.h:971
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 2372 of file network.h.

2372  {
2373 
2374  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:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 2300 of file network.h.

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

Definition at line 2089 of file network.h.

2089  {
2090  if (!KeyToDenseE.IsKey(attr)) return -1;
2091  if (KeyToDenseE.GetDat(attr)) return 1;
2092  return 0;
2093  }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
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 2083 of file network.h.

2083  {
2084  if (!KeyToDenseN.IsKey(attr)) return -1;
2085  if (KeyToDenseN.GetDat(attr)) return 1;
2086  return 0;
2087  }
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:2033
void TNEANet::Clr ( )
inline

Deletes all nodes and edges from the graph.

Definition at line 2627 of file network.h.

2627  { MxNId=0; MxEId=0; NodeH.Clr(); EdgeH.Clr();
2631  VecOfFltVecsN.Clr(); VecOfFltVecsE.Clr(); VecOfIntVecVecsN.Clr(); VecOfIntVecVecsE.Clr();
2632  SAttrN.Clr(); SAttrE.Clr();}
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
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:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
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:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
void Clr()
Clears the contents of the attribute map.
Definition: attr.h:37
void TNEANet::ConvertToSparse ( )
inline

Definition at line 2228 of file network.h.

2228  {
2229  TInt VecLength = VecOfIntVecVecsN.Len();
2231  if (VecLength != 0) {
2233  for (iter = KeyToIndexTypeN.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2234  if (iter.GetDat().Val1 == IntVType) {
2235  TStr attribute = iter.GetKey();
2236  TInt index = iter.GetDat().Val2();
2237  for (int i=0; i<VecOfIntVecVecsN[index].Len(); i++) {
2238  if(VecOfIntVecVecsN[index][i].Len() > 0) {
2239  VecOfIntHashVecsN[index].AddDat(TInt(i), VecOfIntVecVecsN[index][i]);
2240  }
2241  }
2242  KeyToDenseN.AddDat(attribute, TBool(false));
2243  }
2244  }
2245  }
2246  VecOfIntVecVecsN.Clr();
2247 
2248  VecLength = VecOfIntVecVecsE.Len();
2249  if (VecLength != 0) {
2251  for (iter = KeyToIndexTypeE.BegI(); !iter.IsEnd(); iter=iter.Next()) {
2252  if (iter.GetDat().Val1 == IntVType) {
2253  TStr attribute = iter.GetKey();
2254  TInt index = iter.GetDat().Val2();
2255  for (int i=0; i<VecOfIntVecVecsE[index].Len(); i++) {
2256  if(VecOfIntVecVecsE[index][i].Len() > 0) {
2257  VecOfIntHashVecsE[index].AddDat(TInt(i), VecOfIntVecVecsE[index][i]);
2258  }
2259  }
2260  KeyToDenseE.AddDat(attribute, TBool(false));
2261  }
2262  }
2263  }
2264  VecOfIntVecVecsE.Clr();
2265  }
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
Definition: dt.h:412
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal1 Val1
Definition: ds.h:34
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
Definition: dt.h:971
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:2033
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 765 of file network.cpp.

765  {
766  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
767  TNode& Node = NodeH[kid];
768  Node.InEIdV.Pack(); Node.OutEIdV.Pack();
769  }
770  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
771  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
772 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
void Defrag()
Definition: hash.h:555
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2771 of file network.h.

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

Definition at line 1247 of file network.cpp.

1247  {
1248  // TODO(nkhadke): add error checking
1249  TInt vecType = KeyToIndexTypeE(attr).Val1;
1250  if (vecType == IntType) {
1252  } else if (vecType == StrType) {
1254  } else if (vecType == FltType) {
1256  } else if (vecType == IntVType) {
1257  TInt location = CheckDenseOrSparseE(attr);
1258  if (location == 0) VecOfIntHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)] = TIntV();
1260  } else {
1261  return -1;
1262  }
1263  return 0;
1264 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2019
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:2021
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
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:2023
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 2768 of file network.h.

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

Definition at line 1229 of file network.cpp.

1229  {
1230  TInt vecType = KeyToIndexTypeN(attr).Val1;
1231  if (vecType == IntType) {
1233  } else if (vecType == StrType) {
1235  } else if (vecType == FltType) {
1237  } else if (vecType ==IntVType) {
1238  TInt location = CheckDenseOrSparseN(attr);
1239  if (location == 0) VecOfIntHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)] = TIntV();
1241  } else {
1242  return -1;
1243  }
1244  return 0;
1245 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:2015
Definition: dt.h:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVec< TInt > TIntV
Definition: ds.h:1594
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2017
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2013
int TNEANet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 1447 of file network.cpp.

1447  {
1448  TInt vecType = KeyToIndexTypeE(attr).Val1;
1449  if (vecType == IntType) {
1451  if (IntDefaultsE.IsKey(attr)) {
1452  IntDefaultsE.DelKey(attr);
1453  }
1454  } else if (vecType == StrType) {
1456  if (StrDefaultsE.IsKey(attr)) {
1457  StrDefaultsE.DelKey(attr);
1458  }
1459  } else if (vecType == FltType) {
1461  if (FltDefaultsE.IsKey(attr)) {
1462  FltDefaultsE.DelKey(attr);
1463  }
1464  } else {
1465  return -1;
1466  }
1467  KeyToIndexTypeE.DelKey(attr);
1468  return 0;
1469 }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
void DelKey(const TKey &Key)
Definition: hash.h:404
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
Definition: dt.h:1134
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
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 1418 of file network.cpp.

1418  {
1419  TInt vecType = KeyToIndexTypeN(attr).Val1;
1420  if (vecType == IntType) {
1422  if (IntDefaultsN.IsKey(attr)) {
1423  IntDefaultsN.DelKey(attr);
1424  }
1425  } else if (vecType == StrType) {
1427  if (StrDefaultsN.IsKey(attr)) {
1428  StrDefaultsN.DelKey(attr);
1429  }
1430  } else if (vecType == FltType) {
1432  if (FltDefaultsN.IsKey(attr)) {
1433  FltDefaultsN.DelKey(attr);
1434  }
1435  } else if (vecType == IntVType) {
1436  TInt location = CheckDenseOrSparseN(attr);
1437  if (location == 1) VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TIntV>();
1439  KeyToDenseN.DelKey(attr);
1440  } else {
1441  return -1;
1442  }
1443  KeyToIndexTypeN.DelKey(attr);
1444  return 0;
1445 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
void DelKey(const TKey &Key)
Definition: hash.h:404
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
Definition: dt.h:1134
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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:2033
void TNEANet::DelEdge ( const int &  EId)

Deletes an edge with edge ID EId from the graph.

Definition at line 692 of file network.cpp.

692  {
693  int i;
694 
695  IAssert(IsEdge(EId));
696  const int SrcNId = GetEdge(EId).GetSrcNId();
697  const int DstNId = GetEdge(EId).GetDstNId();
698  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
699  GetNode(DstNId).InEIdV.DelIfIn(EId);
700  TInt Id(EId);
701  SAttrE.DelSAttrId(Id);
702 
703  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
704  TVec<TInt>& IntVec = VecOfIntVecsE[i];
705  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
706  }
707  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
708  TVec<TStr>& StrVec = VecOfStrVecsE[i];
709  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
710  }
711  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
712  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
713  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
714  }
715 
716  EdgeH.DelKey(EId);
717 }
#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:2039
TNode & GetNode(const int &NId)
Definition: network.h:2005
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:2595
TIntV OutEIdV
Definition: network.h:1749
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
void DelKey(const TKey &Key)
Definition: hash.h:404
TAttr SAttrE
Definition: network.h:2046
static const int Mn
Definition: dt.h:1138
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
int GetDstNId() const
Definition: network.h:1783
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1134
TEdge & GetEdge(const int &EId)
Definition: network.h:2007
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TIntV InEIdV
Definition: network.h:1749
static const double Mn
Definition: dt.h:1387
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 720 of file network.cpp.

720  {
721  int EId = 0;
722  bool Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
723  IAssert(Edge); // there is at least one edge
724  while (Edge) {
725  DelEdge(EId);
726  Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
727  }
728 }
#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:692
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
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 2675 of file network.h.

2675 { 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:2675
int TNEANet::DelFromIntVAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 962 of file network.cpp.

962  {
963  TInt CurrLen;
964  if (!IsNode(NId)) {
965  // AddNode(NId);
966  return -1;
967  }
968  TInt location = CheckDenseOrSparseN(attr);
969  if (location != -1) {
970  if (location == 1) {
972  if (!NewVec[NodeH.GetKeyId(NId)].DelIfIn(value)) {
973  return -1;
974  }
975  } else {
977  if (!NewHash[NodeH.GetKeyId(NId)].DelIfIn(value)) {
978  return -1;
979  }
980  }
981  } else {
982  return -1;
983  }
984  return 0;
985 }
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:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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 531 of file network.cpp.

531  {
532  int i;
533  TInt Id(NId);
534  SAttrN.DelSAttrId(Id);
535  const TNode& Node = GetNode(NId);
536  for (int out = 0; out < Node.GetOutDeg(); out++) {
537  const int EId = Node.GetOutEId(out);
538  const TEdge& Edge = GetEdge(EId);
539  IAssert(Edge.GetSrcNId() == NId);
540  GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
541  // Delete from Edge Attributes
542  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
543  TVec<TInt>& IntVec = VecOfIntVecsE[i];
544  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
545  }
546  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
547  TVec<TStr>& StrVec = VecOfStrVecsE[i];
548  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
549  }
550  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
551  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
552  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
553  }
554  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
555  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
556  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
557  }
558  EdgeH.DelKey(EId);
559  for (i = 0; i < VecOfIntHashVecsE.Len(); i++) {
560  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsE[i];
561  if (IntHashV.IsKey(EdgeH.GetKeyId(EId))) {
562  IntHashV.DelKey(EdgeH.GetKeyId(EId));
563  }
564  }
565  }
566  for (int in = 0; in < Node.GetInDeg(); in++) {
567  const int EId = Node.GetInEId(in);
568  const TEdge& Edge = GetEdge(EId);
569  IAssert(Edge.GetDstNId() == NId);
570  GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
571  // Delete from Edge Attributes
572  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
573  TVec<TInt>& IntVec = VecOfIntVecsE[i];
574  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
575  }
576  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
577  TVec<TStr>& StrVec = VecOfStrVecsE[i];
578  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
579  }
580  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
581  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
582  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
583  }
584  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
585  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
586  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
587  }
588  for (i = 0; i < VecOfIntHashVecsE.Len(); i++) {
589  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsE[i];
590  if (IntHashV.IsKey(EdgeH.GetKeyId(EId))) {
591  IntHashV.DelKey(EdgeH.GetKeyId(EId));
592  }
593  }
594  EdgeH.DelKey(EId);
595  }
596 
597  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
598  TVec<TInt>& IntVec = VecOfIntVecsN[i];
599  IntVec[NodeH.GetKeyId(NId)] = TInt::Mn;
600  }
601  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
602  TVec<TStr>& StrVec = VecOfStrVecsN[i];
603  StrVec[NodeH.GetKeyId(NId)] = TStr::GetNullStr();
604  }
605  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
606  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
607  FltVec[NodeH.GetKeyId(NId)] = TFlt::Mn;
608  }
609  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
610  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
611  IntVecV[NodeH.GetKeyId(NId)] = TIntV();
612  }
613  for (i = 0; i < VecOfIntHashVecsN.Len(); i++) {
614  THash<TInt, TIntV>& IntHashV = VecOfIntHashVecsN[i];
615  if (IntHashV.IsKey(NodeH.GetKeyId(NId))) {
616  IntHashV.DelKey(NodeH.GetKeyId(NId));
617  }
618  }
619  NodeH.DelKey(NId);
620 }
#define IAssert(Cond)
Definition: bd.h:262
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TNode & GetNode(const int &NId)
Definition: network.h:2005
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TAttr SAttrN
Definition: network.h:2045
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
void DelKey(const TKey &Key)
Definition: hash.h:404
static const int Mn
Definition: dt.h:1138
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1134
TEdge & GetEdge(const int &EId)
Definition: network.h:2007
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVec< TInt > TIntV
Definition: ds.h:1594
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1387
void TNEANet::DelNode ( const TNode NodeI)
inline

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

Definition at line 2296 of file network.h.

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

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

Definition at line 1753 of file network.cpp.

1753  {
1754  if (!IsEdge(EId)) {
1755  return -1;
1756  }
1757  return SAttrE.DelSAttrDat(EId, AttrName);
1758 }
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:2595
TAttr SAttrE
Definition: network.h:2046
int TNEANet::DelSAttrDatE ( const TInt EId,
const TInt AttrId 
)

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

Definition at line 1760 of file network.cpp.

1760  {
1761  if (!IsEdge(EId)) {
1762  return -1;
1763  }
1764  return SAttrE.DelSAttrDat(EId, AttrId);
1765 }
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:2595
TAttr SAttrE
Definition: network.h:2046
int TNEANet::DelSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from EdgeI.

Definition at line 3075 of file network.h.

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

Deletes sparse attribute with id AttrId from EdgeI.

Definition at line 3079 of file network.h.

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

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

Definition at line 1627 of file network.cpp.

1627  {
1628  if (!IsNode(NId)) {
1629  return -1;
1630  }
1631  return SAttrN.DelSAttrDat(NId, AttrName);
1632 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
int TNEANet::DelSAttrDatN ( const TInt NId,
const TInt AttrId 
)

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

Definition at line 1634 of file network.cpp.

1634  {
1635  if (!IsNode(NId)) {
1636  return -1;
1637  }
1638  return SAttrN.DelSAttrDat(NId, AttrId);
1639 }
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:2045
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2298
int TNEANet::DelSAttrDatN ( const TNodeI NodeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from NodeI.

Definition at line 2957 of file network.h.

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

Deletes sparse attribute with id AttrId from NodeI.

Definition at line 2961 of file network.h.

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

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

Definition at line 827 of file network.cpp.

827  {
828  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
829  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
830  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network with Attributes: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
831  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
832  fprintf(OutF, " %*d:", NodePlaces, NodeI.GetId());
833  fprintf(OutF, " in[%d]", NodeI.GetInDeg());
834  for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
835  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
836  //fprintf(OutF, "\n");
837  fprintf(OutF, " out[%d]", NodeI.GetOutDeg());
838  for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
839  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
840  //fprintf(OutF, "\n");
841 
842  // load node attributes
843  TIntV IntAttrN;
844  IntAttrValueNI(NodeI.GetId(), IntAttrN);
845  fprintf(OutF, " nai[%d]", IntAttrN.Len());
846  for (int i = 0; i < IntAttrN.Len(); i++) {
847  fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
848  //fprintf(OutF, "\n");
849 
850  TStrV StrAttrN;
851  StrAttrValueNI(NodeI.GetId(), StrAttrN);
852  fprintf(OutF, " nas[%d]", StrAttrN.Len());
853  for (int i = 0; i < StrAttrN.Len(); i++) {
854  fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
855  //fprintf(OutF, "\n");
856 
857  TFltV FltAttrN;
858  FltAttrValueNI(NodeI.GetId(), FltAttrN);
859  fprintf(OutF, " naf[%d]", FltAttrN.Len());
860  for (int i = 0; i < FltAttrN.Len(); i++) {
861  fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }
862  //fprintf(OutF, "\n");
863  fprintf(OutF, "\n");
864  }
865  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
866  fprintf(OutF, " %*d: %*d -> %*d", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
867 
868  // load edge attributes
869  TIntV IntAttrE;
870  IntAttrValueEI(EdgeI.GetId(), IntAttrE);
871  fprintf(OutF, " eai[%d]", IntAttrE.Len());
872  for (int i = 0; i < IntAttrE.Len(); i++) {
873  fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]());
874  }
875  TStrV StrAttrE;
876  StrAttrValueEI(EdgeI.GetId(), StrAttrE);
877  fprintf(OutF, " eas[%d]", StrAttrE.Len());
878  for (int i = 0; i < StrAttrE.Len(); i++) {
879  fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]());
880  }
881  TFltV FltAttrE;
882  FltAttrValueEI(EdgeI.GetId(), FltAttrE);
883  fprintf(OutF, " eaf[%d]", FltAttrE.Len());
884  for (int i = 0; i < FltAttrE.Len(); i++) {
885  fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]());
886  }
887  fprintf(OutF, "\n");
888  }
889  //fprintf(OutF, "\n");
890 }
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:2276
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:2425
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2450
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2470
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2478
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2603
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2605
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2433
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2405
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: network.h:2302
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2576
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: network.h:2300
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 398 of file network.cpp.

398  {
399  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
400  bool IntVDel = EdgeAttrIsIntVDeleted(EId, EdgeHI);
401  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
402  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
403  return IntDel || StrDel || FltDel || IntVDel;
404 }
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:424
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:406
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:412
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:418
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 424 of file network.cpp.

424  {
425  return (EdgeHI.GetDat().Val1 == FltType &&
426  GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
427  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
428 }
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
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:2023
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 406 of file network.cpp.

406  {
407  return (EdgeHI.GetDat().Val1 == IntType &&
408  GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
409  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
410 }
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:2019
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 412 of file network.cpp.

412  {
413  return (EdgeHI.GetDat().Val1 == IntVType &&
414  TIntV() == this->VecOfIntVecVecsE.GetVal(
415  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
416 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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:2029
const TDat & GetDat() const
Definition: hash.h:81
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
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 418 of file network.cpp.

418  {
419  return (EdgeHI.GetDat().Val1 == StrType &&
420  GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
421  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
422 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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:2021
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 2625 of file network.h.

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

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

Definition at line 2563 of file network.h.

2563  {
2564  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2565  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANet::EndEAIntI ( const TStr attr) const
inline

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

Definition at line 2487 of file network.h.

2487  {
2488  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2489  }
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:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
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 2513 of file network.h.

2513  {
2514  TVec<TIntV>::TIter HI = NULL;
2516  TInt location = CheckDenseOrSparseE(attr);
2517  TBool IsDense = true;
2518  if (location != -1) {
2519  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2520  if (location == 1) {
2521  HI = VecOfIntVecVecsE[index].EndI();
2522  } else {
2523  IsDense = false;
2524  HHI = VecOfIntHashVecsE[index].EndI();
2525  }
2526  }
2527  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2528  }
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:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:971
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 2551 of file network.h.

2551  {
2552  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2553  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 2605 of file network.h.

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

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

Definition at line 2385 of file network.h.

2385  {
2386  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), 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:2031
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANet::EndNAIntI ( const TStr attr) const
inline

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

Definition at line 2309 of file network.h.

2309  {
2310  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:2031
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 2333 of file network.h.

2333  {
2334  TVec<TIntV>::TIter HI = NULL;
2336  TInt location = CheckDenseOrSparseN(attr);
2337  TBool IsDense = true;
2338  if (location != -1) {
2339  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2340  if (location == 1) {
2341  HI = VecOfIntVecVecsN[index].EndI();
2342  } else {
2343  IsDense = false;
2344  HHI = VecOfIntHashVecsN[index].EndI();
2345  }
2346  }
2347  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2348  }
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:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
Definition: dt.h:971
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 2376 of file network.h.

2376  {
2377  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:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 2302 of file network.h.

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

Returns a vector of int attr names for node NId.

Definition at line 2474 of file network.h.

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

Definition at line 353 of file network.cpp.

353  {
354  Names = TVec<TStr>();
355  while (!EdgeHI.IsEnd()) {
356  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
357  Names.Add(EdgeHI.GetKey());
358  }
359  EdgeHI++;
360  }
361 }
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:424
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 2429 of file network.h.

2429  {
2430  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:2429
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::FltAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 161 of file network.cpp.

161  {
162  Names = TVec<TStr>();
163  while (!NodeHI.IsEnd()) {
164  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
165  Names.Add(NodeHI.GetKey());
166  }
167  NodeHI++;
168  }
169 }
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:238
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 2478 of file network.h.

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

Definition at line 363 of file network.cpp.

363  {
364  Values = TVec<TFlt>();
365  while (!EdgeHI.IsEnd()) {
366  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
367  TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
368  Values.Add(val);
369  }
370  EdgeHI++;
371  }
372 }
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:424
Definition: dt.h:1383
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
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 2433 of file network.h.

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

Definition at line 171 of file network.cpp.

171  {
172  Values = TVec<TFlt>();
173  while (!NodeHI.IsEnd()) {
174  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
175  TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId)));
176  Values.Add(val);
177  }
178  NodeHI++;
179  }
180 }
Definition: dt.h:1383
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:238
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:2040
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 1495 of file network.cpp.

1495  {
1496  for (TStrIntPrH::TIter it = KeyToIndexTypeE.BegI(); it < KeyToIndexTypeE.EndI(); it++) {
1497  if (it.GetDat().GetVal1() == IntType) {
1498  IntAttrNames.Add(it.GetKey());
1499  }
1500  if (it.GetDat().GetVal1() == FltType) {
1501  FltAttrNames.Add(it.GetKey());
1502  }
1503  if (it.GetDat().GetVal1() == StrType) {
1504  StrAttrNames.Add(it.GetKey());
1505  }
1506  }
1507 }
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 1225 of file network.cpp.

1225  {
1226  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1227 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 1187 of file network.cpp.

1187  {
1188  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1189 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 1481 of file network.cpp.

1481  {
1482  for (TStrIntPrH::TIter it = KeyToIndexTypeN.BegI(); it < KeyToIndexTypeN.EndI(); it++) {
1483  if (it.GetDat().GetVal1() == IntType) {
1484  IntAttrNames.Add(it.GetKey());
1485  }
1486  if (it.GetDat().GetVal1() == FltType) {
1487  FltAttrNames.Add(it.GetKey());
1488  }
1489  if (it.GetDat().GetVal1() == StrType) {
1490  StrAttrNames.Add(it.GetKey());
1491  }
1492  }
1493 }
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:2031
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 2567 of file network.h.

2567  {
2568  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2569  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
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 2491 of file network.h.

2491  {
2492  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2493  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2530 of file network.h.

2530  {
2531  TVec<TIntV>::TIter HI = NULL;
2533  TInt location = CheckDenseOrSparseE(attr);
2534  TBool IsDense = true;
2535  if (location != -1) {
2536  TInt index = KeyToIndexTypeE.GetDat(attr).Val2;
2537  if (location == 1) {
2538  HI = VecOfIntVecVecsE[index].GetI(EdgeH.GetKeyId(EId));
2539  } else {
2540  IsDense = false;
2541  HHI = VecOfIntHashVecsE[index].GetI(EdgeH.GetKeyId(EId));
2542  }
2543  }
2544  return TAIntVI(HI, HHI, attr, true, this, IsDense);
2545  }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: hash.h:97
TVal2 Val2
Definition: ds.h:35
Definition: dt.h:971
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 2555 of file network.h.

2555  {
2556  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2557  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2007 of file network.h.

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

Definition at line 2008 of file network.h.

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

Returns edge attribute value, converted to Str type.

Definition at line 430 of file network.cpp.

430  {
431  if (EdgeHI.GetDat().Val1 == IntType) {
432  return (this->VecOfIntVecsE.GetVal(
433  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
434  } else if(EdgeHI.GetDat().Val1 == StrType) {
435  return this->VecOfStrVecsE.GetVal(
436  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId));
437  } else if (EdgeHI.GetDat().Val1 == FltType) {
438  return (this->VecOfFltVecsE.GetVal(
439  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
440  }
441  return TStr::GetNullStr();
442 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
const TKey & GetKey() const
Definition: hash.h:80
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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:2040
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 2576 of file network.h.

2576 { return EdgeH.Len(); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2607 of file network.h.

2607 { return TEdgeI(EdgeH.GetI(EId), this); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2609 of file network.h.

2609 { return GetEI(GetEId(SrcNId, DstNId)); }
TEdgeI GetEI(const int &EId) const
Returns an iterator referring to edge with edge ID EId.
Definition: network.h:2607
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:2601
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 2601 of file network.h.

2601 { 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:2595
void TNEANet::GetEIdV ( TIntV EIdV) const

Gets a vector IDs of all edges in the graph.

Definition at line 758 of file network.cpp.

758  {
759  EIdV.Gen(GetEdges(), 0);
760  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
761  EIdV.Add(EdgeH.GetKey(E));
762  }
763 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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:2576
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 2741 of file network.h.

2741 { 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:2741
TFlt TNEANet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1205 of file network.cpp.

1205  {
1206  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1207 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
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 2708 of file network.h.

2708 { 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:2708
TFlt TNEANet::GetFltAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1167 of file network.cpp.

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

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

Definition at line 2023 of file network.h.

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

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

Definition at line 2017 of file network.h.

2017 { return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: dt.h:1383
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1387
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 2758 of file network.h.

2758 { 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:2758
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 1217 of file network.cpp.

1217  {
1218  return VecOfFltVecsE[index][EdgeH.GetKeyId(EId)];
1219 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
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 2730 of file network.h.

2730 { 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:2730
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 1179 of file network.cpp.

1179  {
1180  return VecOfFltVecsN[index][NodeH.GetKeyId(NId)];
1181 }
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TFlt > & TNEANet::GetFltAttrVecE ( const TStr attr)

Gets Vector for the Flt Attribute attr.

Definition at line 1145 of file network.cpp.

1145  {
1146  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
1147 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
int TNEANet::GetFltKeyIdE ( const int &  EId)

Gets keyid for edge with id EId.

Definition at line 1149 of file network.cpp.

1149  {
1150  return EdgeH.GetKeyId(EId);
1151 }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
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 1775 of file network.cpp.

1775  {
1776  return SAttrE.GetIdVSAttr(AttrName, IdV);
1777 }
TAttr SAttrE
Definition: network.h:2046
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 1779 of file network.cpp.

1779  {
1780  return SAttrE.GetIdVSAttr(AttrId, IdV);
1781 }
TAttr SAttrE
Definition: network.h:2046
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 1649 of file network.cpp.

1649  {
1650  return SAttrN.GetIdVSAttr(AttrName, IdV);
1651 }
TAttr SAttrN
Definition: network.h:2045
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 1653 of file network.cpp.

1653  {
1654  return SAttrN.GetIdVSAttr(AttrId, IdV);
1655 }
TAttr SAttrN
Definition: network.h:2045
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 2735 of file network.h.

2735 { 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:2735
TInt TNEANet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1191 of file network.cpp.

1191  {
1192  return VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1193 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2701 of file network.h.

2701 { 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:2701
TInt TNEANet::GetIntAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1153 of file network.cpp.

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

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

Definition at line 2019 of file network.h.

2019 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static const int Mn
Definition: dt.h:1138
Definition: dt.h:1134
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 2013 of file network.h.

2013 { 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:1138
Definition: dt.h:1134
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
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 2753 of file network.h.

2753 { 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:2753
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 1209 of file network.cpp.

1209  {
1210  return VecOfIntVecsE[index][EdgeH.GetKeyId(EId)];
1211 }
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2720 of file network.h.

2720 { 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:2720
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 1171 of file network.cpp.

1171  {
1172  return VecOfIntVecsN[index][NodeH.GetKeyId(NId)];
1173 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 1221 of file network.cpp.

1221  {
1222  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1223 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 1183 of file network.cpp.

1183  {
1184  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1185 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 2744 of file network.h.

2744 { 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:2744
TIntV TNEANet::GetIntVAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1195 of file network.cpp.

1195  {
1196  TInt location = CheckDenseOrSparseE(attr);
1197  if (location != 0) return VecOfIntVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1198  else return VecOfIntHashVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1199 }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
Definition: dt.h:1134
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 2711 of file network.h.

2711 { 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:2711
TIntV TNEANet::GetIntVAttrDatN ( const int &  NId,
const TStr attr 
) const

Definition at line 1157 of file network.cpp.

1157  {
1158  TInt location = CheckDenseOrSparseN(attr);
1159  if (location != 0) return VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1160  else return VecOfIntHashVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1161 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
int TNEANet::GetMxEId ( ) const
inline

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

Definition at line 2573 of file network.h.

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

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

Definition at line 2571 of file network.h.

2571 { return MxNId; }
TInt MxNId
Definition: network.h:2027
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 2388 of file network.h.

2388  {
2389  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:2031
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2312 of file network.h.

2312  {
2313  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2352 of file network.h.

2352  {
2353  TVec<TIntV>::TIter HI = NULL;
2355  TInt location = CheckDenseOrSparseN(attr);
2356  TBool IsDense = true;
2357  if (location != -1) {
2358  TInt index = KeyToIndexTypeN.GetDat(attr).Val2;
2359  if (location == 1) {
2360  HI = VecOfIntVecVecsN[index].GetI(NodeH.GetKeyId(NId));
2361  } else {
2362  IsDense = false;
2363  HHI = VecOfIntHashVecsN[index].GetI(NodeH.GetKeyId(NId));
2364  }
2365  }
2366  return TAIntVI(HI, HHI, attr, false, this, IsDense);
2367  }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
Definition: dt.h:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: hash.h:97
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
Definition: dt.h:971
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 2379 of file network.h.

2379  {
2380  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:2039
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:2028
TNodeI TNEANet::GetNI ( const int &  NId) const
inline

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

Definition at line 2304 of file network.h.

2304 { return TNodeI(NodeH.GetI(NId), this); }
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 751 of file network.cpp.

751  {
752  NIdV.Gen(GetNodes(), 0);
753  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
754  NIdV.Add(NodeH.GetKey(N));
755  }
756 }
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:2276
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2005 of file network.h.

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

Definition at line 2006 of file network.h.

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

Returns node attribute value, converted to Str type.

Definition at line 246 of file network.cpp.

246  {
247  if (NodeHI.GetDat().Val1 == IntType) {
248  return (this->VecOfIntVecsN.GetVal(
249  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
250  } else if(NodeHI.GetDat().Val1 == StrType) {
251  return this->VecOfStrVecsN.GetVal(
252  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId));
253  } else if (NodeHI.GetDat().Val1 == FltType) {
254  return (this->VecOfFltVecsN.GetVal(
255  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
256  }
257  return TStr::GetNullStr();
258 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:2039
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:2031
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:2040
THash< TInt, TNode > NodeH
Definition: network.h:2028
int TNEANet::GetNodes ( ) const
inline

Returns the number of nodes in the network.

Definition at line 2276 of file network.h.

2276 { return NodeH.Len(); }
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2618 of file network.h.

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

Returns an ID of a random edge in the graph.

Definition at line 2616 of file network.h.

2616 { return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2614 of file network.h.

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

Returns an ID of a random node in the graph.

Definition at line 2612 of file network.h.

2612 { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 1711 of file network.cpp.

1711  {
1712  if (!IsEdge(EId)) {
1713  return -1;
1714  }
1715  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1716 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 1718 of file network.cpp.

1718  {
1719  if (!IsEdge(EId)) {
1720  return -1;
1721  }
1722  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1723 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 3033 of file network.h.

3033  {
3034  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3035  }
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:1711
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 3037 of file network.h.

3037  {
3038  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3039  }
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:1711
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 1725 of file network.cpp.

1725  {
1726  if (!IsEdge(EId)) {
1727  return -1;
1728  }
1729  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1730 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 1732 of file network.cpp.

1732  {
1733  if (!IsEdge(EId)) {
1734  return -1;
1735  }
1736  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1737 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 3047 of file network.h.

3047  {
3048  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3049  }
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:1711
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 3051 of file network.h.

3051  {
3052  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3053  }
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:1711
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 1739 of file network.cpp.

1739  {
1740  if (!IsEdge(EId)) {
1741  return -1;
1742  }
1743  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1744 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 1746 of file network.cpp.

1746  {
1747  if (!IsEdge(EId)) {
1748  return -1;
1749  }
1750  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1751 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 3061 of file network.h.

3061  {
3062  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
3063  }
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:1711
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 3065 of file network.h.

3065  {
3066  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
3067  }
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:1711
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 1585 of file network.cpp.

1585  {
1586  if (!IsNode(NId)) {
1587  return -1;
1588  }
1589  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1590 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 1592 of file network.cpp.

1592  {
1593  if (!IsNode(NId)) {
1594  return -1;
1595  }
1596  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1597 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 2915 of file network.h.

2915  {
2916  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2917  }
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:1585
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 2919 of file network.h.

2919  {
2920  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
2921  }
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:1585
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 1599 of file network.cpp.

1599  {
1600  if (!IsNode(NId)) {
1601  return -1;
1602  }
1603  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1604 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 1606 of file network.cpp.

1606  {
1607  if (!IsNode(NId)) {
1608  return -1;
1609  }
1610  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1611 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 2929 of file network.h.

2929  {
2930  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2931  }
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:1585
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 2933 of file network.h.

2933  {
2934  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
2935  }
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:1585
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 1613 of file network.cpp.

1613  {
1614  if (!IsNode(NId)) {
1615  return -1;
1616  }
1617  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1618 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 1620 of file network.cpp.

1620  {
1621  if (!IsNode(NId)) {
1622  return -1;
1623  }
1624  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1625 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 2943 of file network.h.

2943  {
2944  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2945  }
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:1585
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 2947 of file network.h.

2947  {
2948  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
2949  }
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:1585
int TNEANet::GetSAttrIdE ( const TStr Name,
TInt AttrIdX,
TAttrType AttrTypeX 
) const

Gets id and type for attribute with name Name.

Definition at line 1787 of file network.cpp.

1787  {
1788  return SAttrE.GetSAttrId(Name, AttrId, AttrType);
1789 }
TAttr SAttrE
Definition: network.h:2046
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 1661 of file network.cpp.

1661  {
1662  return SAttrN.GetSAttrId(Name, AttrId, AttrType);
1663 }
TAttr SAttrN
Definition: network.h:2045
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 1791 of file network.cpp.

1791  {
1792  return SAttrE.GetSAttrName(AttrId, Name, AttrType);
1793 }
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:2046
int TNEANet::GetSAttrNameN ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 1665 of file network.cpp.

1665  {
1666  return SAttrN.GetSAttrName(AttrId, Name, AttrType);
1667 }
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:2045
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 1767 of file network.cpp.

1767  {
1768  if (!IsEdge(EId)) {
1769  return -1;
1770  }
1771  SAttrE.GetSAttrV(EId, AttrType, AttrV);
1772  return 0;
1773 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
TAttr SAttrE
Definition: network.h:2046
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 3085 of file network.h.

3085  {
3086  return GetSAttrVE(EdgeI.GetId(), AttrType, AttrV);
3087  }
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:1767
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 1641 of file network.cpp.

1641  {
1642  if (!IsNode(NId)) {
1643  return -1;
1644  }
1645  SAttrN.GetSAttrV(NId, AttrType, AttrV);
1646  return 0;
1647 }
TAttr SAttrN
Definition: network.h:2045
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:2298
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 2968 of file network.h.

2968  {
2969  return GetSAttrVN(NodeI.GetId(), AttrType, AttrV);
2970  }
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:1641
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 1472 of file network.cpp.

1472  {
1473  PNEANet Net = TNEANet::New();
1474  for (int i = 0; i < 5; i++) { Net->AddNode(i); }
1475  Net->AddEdge(0,1); Net->AddEdge(0,2);
1476  Net->AddEdge(0,3); Net->AddEdge(0,4);
1477  Net->AddEdge(1,2); Net->AddEdge(1,2);
1478  return Net;
1479 }
Definition: bd.h:196
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
Definition: network.h:2176
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 2738 of file network.h.

2738 { 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:2738
TStr TNEANet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 1201 of file network.cpp.

1201  {
1202  return VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1203 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2705 of file network.h.

2705 { 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:2705
TStr TNEANet::GetStrAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 1163 of file network.cpp.

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

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

Definition at line 2021 of file network.h.

2021 { 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:2036
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 2015 of file network.h.

2015 { 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:2036
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 2763 of file network.h.

2763 { 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:2763
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 1213 of file network.cpp.

1213  {
1214  return VecOfStrVecsE[index][EdgeH.GetKeyId(EId)];
1215 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2725 of file network.h.

2725 { 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:2725
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 1175 of file network.cpp.

1175  {
1176  return VecOfStrVecsN[index][NodeH.GetKeyId(NId)];
1177 }
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 1509 of file network.cpp.

1509  {
1510  TNode Node = GetNode(NI.GetId());
1511  TIntV OutEIdV = Node.OutEIdV;
1512  TFlt total = 0;
1513  int len = Node.OutEIdV.Len();
1514  for (int i = 0; i < len; i++) {
1515  total += GetFltAttrDatE(Node.OutEIdV[i], attr);
1516  }
1517  return total;
1518 }
TNode & GetNode(const int &NId)
Definition: network.h:2005
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: network.h:2741
Definition: dt.h:1383
void TNEANet::GetWeightOutEdgesV ( TFltV OutWeights,
const TFltV AttrVal 
)

Fills OutWeights with the outgoing weight from each node.

Definition at line 1520 of file network.cpp.

1520  {
1521  for (TEdgeI it = BegEI(); it < EndEI(); it++) {
1522  int EId = it.GetId();
1523  int SrcId = it.GetSrcNId();
1524  OutWeights[SrcId] +=AttrVal[GetFltKeyIdE(EId)];
1525  }
1526 }
int GetFltKeyIdE(const int &EId)
Gets keyid for edge with id EId.
Definition: network.cpp:1149
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2603
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2605
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 46 of file network.cpp.

46  {
47  return HasGraphFlag(TNEANet::TNet, Flag);
48 }
#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 2446 of file network.h.

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

Definition at line 280 of file network.cpp.

280  {
281  Names = TVec<TStr>();
282  while (!EdgeHI.IsEnd()) {
283  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
284  Names.Add(EdgeHI.GetKey());
285  }
286  EdgeHI++;
287  }
288 }
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:406
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 2401 of file network.h.

2401  {
2402  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:2401
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::IntAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 88 of file network.cpp.

88  {
89  Names = TVec<TStr>();
90  while (!NodeHI.IsEnd()) {
91  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
92  Names.Add(NodeHI.GetKey());
93  }
94  NodeHI++;
95  }
96 }
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:214
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 2450 of file network.h.

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

Definition at line 290 of file network.cpp.

290  {
291  Values = TVec<TInt>();
292  while (!EdgeHI.IsEnd()) {
293  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
294  TInt val = (this->VecOfIntVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
295  Values.Add(val);
296  }
297  EdgeHI++;
298  }
299 }
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:406
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
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:1134
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 2405 of file network.h.

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

Definition at line 98 of file network.cpp.

98  {
99  Values = TVec<TInt>();
100  while (!NodeHI.IsEnd()) {
101  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
102  TInt val = this->VecOfIntVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
103  Values.Add(val);
104  }
105  NodeHI++;
106  }
107 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:1134
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:214
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 2456 of file network.h.

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

Definition at line 301 of file network.cpp.

301  {
302  Names = TVec<TStr>();
303  while (!EdgeHI.IsEnd()) {
304  if (EdgeHI.GetDat().Val1 == IntVType) {
305  Names.Add(EdgeHI.GetKey());
306  }
307  EdgeHI++;
308  }
309 }
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 2411 of file network.h.

2411  {
2412  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:2411
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::IntVAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 109 of file network.cpp.

109  {
110  Names = TVec<TStr>();
111  while (!NodeHI.IsEnd()) {
112  if (NodeHI.GetDat().Val1 == IntVType) {
113  Names.Add(NodeHI.GetKey());
114  }
115  NodeHI++;
116  }
117 }
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 2460 of file network.h.

2460  {
2461  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:2460
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
void TNEANet::IntVAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TVec< TIntV > &  Values 
) const

Definition at line 311 of file network.cpp.

311  {
312  Values = TVec<TIntV>();
313  while (!EdgeHI.IsEnd()) {
314  if (EdgeHI.GetDat().Val1 == IntVType) {
315  TInt index = EdgeHI.GetDat().Val2;
316  TStr attr = EdgeHI.GetKey();
317  TInt loc = CheckDenseOrSparseE(attr);
318  if (loc == 1) {
319  TIntV val = this->VecOfIntVecVecsE.GetVal(index).GetVal(EdgeH.GetKeyId(EId));
320  if (val.Len() != 0) Values.Add(val);
321  } else {
322  const THash<TInt, TIntV>& NewHash = VecOfIntHashVecsE[index];
323  if (NewHash.IsKey(EdgeH.GetKeyId(EId))) {
324  Values.Add(NewHash[EdgeH.GetKeyId(EId)]);
325  }
326  }
327  }
328  EdgeHI++;
329  }
330 }
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TInt CheckDenseOrSparseE(const TStr &attr) const
Definition: network.h:2089
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:2029
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:2041
Definition: dt.h:1134
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 2415 of file network.h.

2415  {
2416  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:2415
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::IntVAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TVec< TIntV > &  Values 
) const

Definition at line 119 of file network.cpp.

119  {
120  Values = TVec<TIntV>();
121  while (!NodeHI.IsEnd()) {
122  if (NodeHI.GetDat().Val1 == IntVType) {
123  TInt index = NodeHI.GetDat().Val2;
124  TStr attr = NodeHI.GetKey();
125  TInt loc = CheckDenseOrSparseN(attr);
126  if (loc == 1) {
127  TIntV val = this->VecOfIntVecVecsN.GetVal(index).GetVal(NodeH.GetKeyId(NId));
128  if (val.Len() != 0) Values.Add(val);
129  } else {
130  const THash<TInt, TIntV>& NewHash = VecOfIntHashVecsN[index];
131  if (NewHash.IsKey(NodeH.GetKeyId(NId))) {
132  Values.Add(NewHash[NodeH.GetKeyId(NId)]);
133  }
134  }
135  }
136  NodeHI++;
137  }
138 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2083
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:1134
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
Definition: dt.h:412
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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 374 of file network.cpp.

374  {
375  bool IntDel = IsIntAttrDeletedE(EId, attr);
376  bool IntVDel = IsIntVAttrDeletedE(EId, attr);
377  bool StrDel = IsStrAttrDeletedE(EId, attr);
378  bool FltDel = IsFltAttrDeletedE(EId, attr);
379  return IntDel || StrDel || FltDel || IntVDel;
380 }
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:394
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:382
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:390
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:386
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 182 of file network.cpp.

182  {
183  bool IntDel = IsIntAttrDeletedN(NId, attr);
184  bool StrDel = IsStrAttrDeletedN(NId, attr);
185  bool FltDel = IsFltAttrDeletedN(NId, attr);
186  bool IntVDel = IsIntVAttrDeletedN(NId, attr);
187  return IntDel || StrDel || FltDel || IntVDel;
188 }
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:198
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:202
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:190
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:194
bool TNEANet::IsEdge ( const int &  EId) const
inline

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

Definition at line 2595 of file network.h.

2595 { return EdgeH.IsKey(EId); }
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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 2597 of file network.h.

2597 { 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:2595
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 730 of file network.cpp.

730  {
731  const TNode& SrcNode = GetNode(SrcNId);
732  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
733  const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
734  if (DstNId == Edge.GetDstNId()) {
735  EId = Edge.GetId();
736  return true;
737  }
738  }
739  if (! IsDir) {
740  for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
741  const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
742  if (DstNId == Edge.GetSrcNId()) {
743  EId = Edge.GetId();
744  return true;
745  }
746  }
747  }
748  return false;
749 }
int GetId() const
Definition: network.h:1781
TNode & GetNode(const int &NId)
Definition: network.h:2005
TEdge & GetEdge(const int &EId)
Definition: network.h:2007
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 394 of file network.cpp.

394  {
395  return EdgeAttrIsFltDeleted(EId, KeyToIndexTypeE.GetI(attr));
396 }
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:424
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 202 of file network.cpp.

202  {
203  return NodeAttrIsFltDeleted(NId, KeyToIndexTypeN.GetI(attr));
204 }
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:238
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 1528 of file network.cpp.

1528  {
1529  return (KeyToIndexTypeE.IsKey(attr) &&
1530  KeyToIndexTypeE.GetDat(attr).Val1 == FltType);
1531 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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::IsIntAttrDeletedE ( const int &  EId,
const TStr attr 
) const

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

Definition at line 382 of file network.cpp.

382  {
383  return EdgeAttrIsIntDeleted(EId, KeyToIndexTypeE.GetI(attr));
384 }
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:406
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 190 of file network.cpp.

190  {
191  return NodeAttrIsIntDeleted(NId, KeyToIndexTypeN.GetI(attr));
192 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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:214
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 1533 of file network.cpp.

1533  {
1534  return (KeyToIndexTypeE.IsKey(attr) &&
1535  KeyToIndexTypeE.GetDat(attr).Val1 == IntType);
1536 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 386 of file network.cpp.

386  {
387  return EdgeAttrIsIntVDeleted(EId, KeyToIndexTypeE.GetI(attr));
388 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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:412
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 194 of file network.cpp.

194  {
195  return NodeAttrIsIntVDeleted(NId, KeyToIndexTypeN.GetI(attr));
196 }
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:222
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 2298 of file network.h.

2298 { return NodeH.IsKey(NId); }
THash< TInt, TNode > NodeH
Definition: network.h:2028
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 774 of file network.cpp.

774  {
775  bool RetVal = true;
776  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
777  const TNode& Node = NodeH[N];
778  if (! Node.OutEIdV.IsSorted()) {
779  const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
780  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
781  }
782  if (! Node.InEIdV.IsSorted()) {
783  const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
784  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
785  }
786  // check out-edge ids
787  int prevEId = -1;
788  for (int e = 0; e < Node.GetOutDeg(); e++) {
789  if (! IsEdge(Node.GetOutEId(e))) {
790  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetOutEId(e), Node.GetId());
791  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
792  }
793  if (e > 0 && prevEId == Node.GetOutEId(e)) {
794  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
795  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
796  }
797  prevEId = Node.GetOutEId(e);
798  }
799  // check in-edge ids
800  prevEId = -1;
801  for (int e = 0; e < Node.GetInDeg(); e++) {
802  if (! IsEdge(Node.GetInEId(e))) {
803  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetInEId(e), Node.GetId());
804  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
805  }
806  if (e > 0 && prevEId == Node.GetInEId(e)) {
807  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
808  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
809  }
810  prevEId = Node.GetInEId(e);
811  }
812  }
813  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
814  const TEdge& Edge = EdgeH[E];
815  if (! IsNode(Edge.GetSrcNId())) {
816  const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
817  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
818  }
819  if (! IsNode(Edge.GetDstNId())) {
820  const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
821  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
822  }
823  }
824  return RetVal;
825 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2595
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
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:2298
THash< TInt, TNode > NodeH
Definition: network.h:2028
char * CStr()
Definition: dt.h:476
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 390 of file network.cpp.

390  {
391  return EdgeAttrIsStrDeleted(EId, KeyToIndexTypeE.GetI(attr));
392 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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:418
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 198 of file network.cpp.

198  {
199  return NodeAttrIsStrDeleted(NId, KeyToIndexTypeN.GetI(attr));
200 }
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:230
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
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 1538 of file network.cpp.

1538  {
1539  return (KeyToIndexTypeE.IsKey(attr) &&
1540  KeyToIndexTypeE.GetDat(attr).Val1 == StrType);
1541 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
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 2182 of file network.h.

2182 { return PNEANet(new TNEANet(SIn)); }
TNEANet()
Definition: network.h:2097
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 2184 of file network.h.

2184  {
2185  PNEANet Graph = PNEANet(new TNEANet());
2186  Graph->MxNId.Load(SIn); Graph->MxEId.Load(SIn);
2187  Graph->NodeH.Load(SIn); Graph->EdgeH.Load(SIn);
2188  Graph->KeyToIndexTypeN.Load(SIn); Graph->KeyToIndexTypeE.Load(SIn);
2189  Graph->IntDefaultsN.Load(SIn); Graph->IntDefaultsE.Load(SIn);
2190  Graph->StrDefaultsN.Load(SIn); Graph->StrDefaultsE.Load(SIn);
2191  Graph->FltDefaultsN.Load(SIn); Graph->FltDefaultsE.Load(SIn);
2192  Graph->VecOfIntVecsN.Load(SIn); Graph->VecOfIntVecsE.Load(SIn);
2193  Graph->VecOfStrVecsN.Load(SIn); Graph->VecOfStrVecsE.Load(SIn);
2194  Graph->VecOfFltVecsN.Load(SIn); Graph->VecOfFltVecsE.Load(SIn);
2195  return Graph;
2196  }
TNEANet()
Definition: network.h:2097
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 2199 of file network.h.

2199  {
2200  PNEANet Graph = PNEANet(new TNEANet());
2201  Graph->MxNId.Load(SIn); Graph->MxEId.Load(SIn);
2202  Graph->NodeH.Load(SIn); Graph->EdgeH.Load(SIn);
2203  Graph->KeyToIndexTypeN.Load(SIn); Graph->KeyToIndexTypeE.Load(SIn);
2204  Graph->IntDefaultsN.Load(SIn); Graph->IntDefaultsE.Load(SIn);
2205  Graph->StrDefaultsN.Load(SIn); Graph->StrDefaultsE.Load(SIn);
2206  Graph->FltDefaultsN.Load(SIn); Graph->FltDefaultsE.Load(SIn);
2207  Graph->VecOfIntVecsN.Load(SIn); Graph->VecOfIntVecsE.Load(SIn);
2208  Graph->VecOfStrVecsN.Load(SIn); Graph->VecOfStrVecsE.Load(SIn);
2209  Graph->VecOfFltVecsN.Load(SIn); Graph->VecOfFltVecsE.Load(SIn);
2210  Graph->VecOfIntVecVecsN.Load(SIn); Graph->VecOfIntVecVecsE.Load(SIn);
2211  Graph->SAttrN.Load(SIn); Graph->SAttrE.Load(SIn);
2212  return Graph;
2213  }
TNEANet()
Definition: network.h:2097
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 
36  LoadHashOfVecFunctor hash_of_vec_fn;
37  VecOfIntHashVecsN.LoadShM(ShMIn, hash_of_vec_fn);
38  VecOfIntHashVecsE.LoadShM(ShMIn, hash_of_vec_fn);
39 
40  /* Attributes are complicated so load these straight */
41  SAttrN.Load(ShMIn);
42  SAttrE.Load(ShMIn);
43 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
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:2039
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
Definition: dt.h:1134
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
Definition: ds.h:932
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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:2033
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 2222 of file network.h.

2222  {
2223  TNEANet* Network = new TNEANet();
2224  Network->LoadNetworkShM(ShMIn);
2225  return PNEANet(Network);
2226  }
TNEANet()
Definition: network.h:2097
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 2176 of file network.h.

2176 { return PNEANet(new TNEANet()); }
TNEANet()
Definition: network.h:2097
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 2180 of file network.h.

2180 { return PNEANet(new TNEANet(Nodes, Edges)); }
TNEANet()
Definition: network.h:2097
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 206 of file network.cpp.

206  {
207  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
208  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
209  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
210  bool IntVDel = NodeAttrIsIntVDeleted(NId, NodeHI);
211  return IntDel || StrDel || FltDel || IntVDel;
212 }
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:230
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:222
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:238
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:214
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 238 of file network.cpp.

238  {
239  if (NodeHI.GetDat().Val1 != FltType) {
240  return false;
241  }
242  return (GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
243  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
244 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
THash< TInt, TNode > NodeH
Definition: network.h:2028
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:2017
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 214 of file network.cpp.

214  {
215  if (NodeHI.GetDat().Val1 != IntType) {
216  return false;
217  }
218  return (GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
219  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
220 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
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:2028
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:2013
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 222 of file network.cpp.

222  {
223  if (NodeHI.GetDat().Val1 != IntVType) {
224  return false;
225  }
226  return (TIntV() == this->VecOfIntVecVecsN.GetVal(
227  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
228 }
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:2031
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:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
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 230 of file network.cpp.

230  {
231  if (NodeHI.GetDat().Val1 != StrType) {
232  return false;
233  }
234  return (GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
235  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
236 }
const TKey & GetKey() const
Definition: hash.h:80
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
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:2015
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TNode > NodeH
Definition: network.h:2028
TNEANet& TNEANet::operator= ( const TNEANet Graph)
inline

Definition at line 2271 of file network.h.

2271  { if (this!=&Graph) {
2272  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH; }
2273  return *this; }
TInt MxNId
Definition: network.h:2027
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TInt MxEId
Definition: network.h:2027
THash< TInt, TNode > NodeH
Definition: network.h:2028
void TNEANet::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

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

Definition at line 2634 of file network.h.

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

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

Definition at line 2140 of file network.h.

2140  {
2141  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
2143  KeyToDenseN.Save(SOut); KeyToDenseE.Save(SOut);
2144  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
2145  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
2146  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
2147  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
2148  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
2149  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut);
2150  VecOfIntVecVecsN.Save(SOut); VecOfIntVecVecsE.Save(SOut);
2152  SAttrN.Save(SOut); SAttrE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2033
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2042
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:33
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2042
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2033
void TNEANet::Save_V1 ( TSOut SOut) const
inline

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

Definition at line 2154 of file network.h.

2154  {
2155  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
2157  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
2158  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
2159  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
2160  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
2161  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
2162  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
void TNEANet::Save_V2 ( TSOut SOut) const
inline

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

Definition at line 2164 of file network.h.

2164  {
2165  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
2167  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
2168  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
2169  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
2170  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
2171  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
2172  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut);
2173  VecOfIntVecVecsN.Save(SOut); VecOfIntVecVecsE.Save(SOut);
2174  SAttrN.Save(SOut); SAttrE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2038
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2037
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2035
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2031
TAttr SAttrN
Definition: network.h:2045
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2037
TInt MxNId
Definition: network.h:2027
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2038
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TInt, TEdge > EdgeH
Definition: network.h:2029
TAttr SAttrE
Definition: network.h:2046
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2040
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2036
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2041
TInt MxEId
Definition: network.h:2027
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2036
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:33
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2040
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2035
THash< TInt, TNode > NodeH
Definition: network.h:2028
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2041
void TNEANet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 2466 of file network.h.

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

Definition at line 332 of file network.cpp.

332  {
333  Names = TVec<TStr>();
334  while (!EdgeHI.IsEnd()) {
335  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
336  Names.Add(EdgeHI.GetKey());
337  }
338  EdgeHI++;
339  }
340 }
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:418
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 2421 of file network.h.

2421  {
2422  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:2421
TIter BegI() const
Definition: hash.h:213
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::StrAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 140 of file network.cpp.

140  {
141  Names = TVec<TStr>();
142  while (!NodeHI.IsEnd()) {
143  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
144  Names.Add(NodeHI.GetKey());
145  }
146  NodeHI++;
147  }
148 }
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:230
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 2470 of file network.h.

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

Definition at line 342 of file network.cpp.

342  {
343  Values = TVec<TStr>();
344  while (!EdgeHI.IsEnd()) {
345  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
346  TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
347  Values.Add(val);
348  }
349  EdgeHI++;
350  }
351 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2039
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:418
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 2425 of file network.h.

2425  {
2426  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:2425
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2031
void TNEANet::StrAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 150 of file network.cpp.

150  {
151  Values = TVec<TStr>();
152  while (!NodeHI.IsEnd()) {
153  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
154  TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
155  Values.Add(val);
156  }
157  NodeHI++;
158  }
159 }
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:230
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2039
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:2028
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 3108 of file network.h.

Member Data Documentation

TCRef TNEANet::CRef

Definition at line 2025 of file network.h.

THash<TInt, TEdge> TNEANet::EdgeH
protected

Definition at line 2029 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsE
protected

Definition at line 2037 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsN
protected

Definition at line 2037 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsE
protected

Definition at line 2035 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsN
protected

Definition at line 2035 of file network.h.

THash<TStr, TBool> TNEANet::KeyToDenseE
protected

Definition at line 2033 of file network.h.

THash<TStr, TBool> TNEANet::KeyToDenseN
protected

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

Definition at line 2033 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeE
protected

Definition at line 2031 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeN
protected

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

Definition at line 2031 of file network.h.

TInt TNEANet::MxEId
protected

Definition at line 2027 of file network.h.

TInt TNEANet::MxNId
protected

Definition at line 2027 of file network.h.

THash<TInt, TNode> TNEANet::NodeH
protected

Definition at line 2028 of file network.h.

TAttr TNEANet::SAttrE
protected

Definition at line 2046 of file network.h.

TAttr TNEANet::SAttrN
protected

Definition at line 2045 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsE
protected

Definition at line 2036 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsN
protected

Definition at line 2036 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsE
protected

Definition at line 2040 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsN
protected

Definition at line 2040 of file network.h.

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

Definition at line 2042 of file network.h.

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

Definition at line 2042 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsE
protected

Definition at line 2038 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsN
protected

Definition at line 2038 of file network.h.

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

Definition at line 2041 of file network.h.

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

Definition at line 2041 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsE
protected

Definition at line 2039 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsN
protected

Definition at line 2039 of file network.h.


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