SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TNEANet Class Reference

Directed multigraph with node edge attributes. More...

#include <network.h>

Inherited by TModeNet.

Classes

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...
 
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 graph. More...
 
int AddNode (int NId=-1)
 Adds a node of ID NId to the graph. 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)
 
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)
 
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)
 
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)
 
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)
 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)
 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 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
 
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...
 
 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, 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
 
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 1591 of file network.h.

Member Typedef Documentation

Definition at line 1594 of file network.h.

Definition at line 1593 of file network.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
IntType 
StrType 
FltType 
IntVType 

Definition at line 1874 of file network.h.

Constructor & Destructor Documentation

TNEANet::TNEANet ( )
inline

Definition at line 1880 of file network.h.

1880  : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TCRef CRef
Definition: network.h:1859
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TNEANet::TNEANet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

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

Definition at line 1886 of file network.h.

1886  : CRef(),
1891  { Reserve(Nodes, Edges); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: network.h:2237
TCRef CRef
Definition: network.h:1859
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TNEANet::TNEANet ( const TNEANet Graph)
inline

Definition at line 1892 of file network.h.

1892  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
1893  NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(), KeyToIndexTypeE(),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TNEANet::TNEANet ( TSIn SIn)
inline

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

Definition at line 1898 of file network.h.

1898  : MxNId(SIn), MxEId(SIn), NodeH(SIn), EdgeH(SIn),
1900  StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
1902  VecOfFltVecsN(SIn), VecOfFltVecsE(SIn), VecOfIntVecVecsN(SIn), VecOfIntVecVecsE(SIn), SAttrN(SIn), SAttrE(SIn) { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TNEANet::TNEANet ( const TNEANet Graph,
bool  modeSubGraph 
)
inlineprotected

Definition at line 1904 of file network.h.

1904  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TNEANet::TNEANet ( bool  copyAll,
const TNEANet Graph 
)
inlineprotected

Definition at line 1910 of file network.h.

1910  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873

Member Function Documentation

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 524 of file network.cpp.

524  {
525  int i;
526 
527  if (EId == -1) { EId = MxEId; MxEId++; }
528  else { MxEId = TMath::Mx(EId+1, MxEId()); }
529  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
530  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
531  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
532  GetNode(SrcNId).OutEIdV.AddSorted(EId);
533  GetNode(DstNId).InEIdV.AddSorted(EId);
534 
535  // update attribute columns
536  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
537  TVec<TInt>& IntVec = VecOfIntVecsE[i];
538  int KeyId = EdgeH.GetKeyId(EId);
539  if (IntVec.Len() > KeyId) {
540  IntVec[KeyId] = TInt::Mn;
541  } else {
542  IntVec.Ins(KeyId, TInt::Mn);
543  }
544  }
545  TVec<TStr> DefIntVec = TVec<TStr>();
546  IntDefaultsE.GetKeyV(DefIntVec);
547  for (i = 0; i < DefIntVec.Len(); i++) {
548  TStr attr = DefIntVec[i];
549  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
550  IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
551  }
552 
553  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
554  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
555  IntVecV.Ins(EdgeH.GetKeyId(EId), TIntV());
556  }
557 
558  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
559  TVec<TStr>& StrVec = VecOfStrVecsE[i];
560  int KeyId = EdgeH.GetKeyId(EId);
561  if (StrVec.Len() > KeyId) {
562  StrVec[KeyId] = TStr::GetNullStr();
563  } else {
564  StrVec.Ins(KeyId, TStr::GetNullStr());
565  }
566  }
567  TVec<TStr> DefStrVec = TVec<TStr>();
568  StrDefaultsE.GetKeyV(DefStrVec);
569  for (i = 0; i < DefStrVec.Len(); i++) {
570  TStr attr = DefStrVec[i];
571  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
572  StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
573  }
574 
575  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
576  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
577  int KeyId = EdgeH.GetKeyId(EId);
578  if (FltVec.Len() > KeyId) {
579  FltVec[KeyId] = TFlt::Mn;
580  } else {
581  FltVec.Ins(KeyId, TFlt::Mn);
582  }
583  }
584  TVec<TStr> DefFltVec = TVec<TStr>();
585  FltDefaultsE.GetKeyV(DefFltVec);
586  for (i = 0; i < DefFltVec.Len(); i++) {
587  TStr attr = DefFltVec[i];
588  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
589  FltVec[EdgeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
590  }
591  return EId;
592 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TNode & GetNode(const int &NId)
Definition: network.h:1840
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1853
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TIntV OutEIdV
Definition: network.h:1599
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1063
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
static const int Mn
Definition: dt.h:1048
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1855
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
static TStr GetNullStr()
Definition: dt.cpp:1626
TInt MxEId
Definition: network.h:1861
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1857
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:442
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< TInt > TIntV
Definition: ds.h:1529
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
TIntV InEIdV
Definition: network.h:1599
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
static const double Mn
Definition: dt.h:1297
int TNEANet::AddEdge ( const TEdgeI EdgeI)
inline

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

Definition at line 2188 of file network.h.

2188 { 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:524
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 2293 of file network.h.

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

Definition at line 1006 of file network.cpp.

1006  {
1007  int i;
1008  TInt CurrLen;
1009 
1010  if (!IsEdge(EId)) {
1011  //AddEdge(EId);
1012  return -1;
1013  }
1014  if (KeyToIndexTypeE.IsKey(attr)) {
1016  NewVec[EdgeH.GetKeyId(EId)] = value;
1017  } else {
1018  CurrLen = VecOfFltVecsE.Len();
1019  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1020  TVec<TFlt> NewVec = TVec<TFlt>();
1021  for (i = 0; i < MxEId; i++) {
1022  NewVec.Ins(i, GetFltAttrDefaultE(attr));
1023  }
1024  NewVec[EdgeH.GetKeyId(EId)] = value;
1025  VecOfFltVecsE.Add(NewVec);
1026  }
1027  return 0;
1028 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1857
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2267 of file network.h.

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

Definition at line 898 of file network.cpp.

898  {
899  int i;
900  TInt CurrLen;
901 
902  if (!IsNode(NId)) {
903  // AddNode(NId);
904  return -1;
905  }
906  if (KeyToIndexTypeN.IsKey(attr)) {
908  NewVec[NodeH.GetKeyId(NId)] = value;
909  } else {
910  CurrLen = VecOfFltVecsN.Len();
911  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
912  TVec<TFlt> NewVec = TVec<TFlt>();
913  for (i = 0; i < MxNId; i++) {
914  NewVec.Ins(i, GetFltAttrDefaultN(attr));
915  }
916  NewVec[NodeH.GetKeyId(NId)] = value;
917  VecOfFltVecsN.Add(NewVec);
918  }
919  return 0;
920 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1851
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 1264 of file network.cpp.

1264  {
1265  int i;
1266  TInt CurrLen;
1267  TVec<TFlt> NewVec;
1268  CurrLen = VecOfFltVecsE.Len();
1269  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
1270  NewVec = TVec<TFlt>();
1271  for (i = 0; i < MxEId; i++) {
1272  NewVec.Ins(i, defaultValue);
1273  }
1274  VecOfFltVecsE.Add(NewVec);
1275  if (!FltDefaultsE.IsKey(attr)) {
1276  FltDefaultsE.AddDat(attr, defaultValue);
1277  } else {
1278  return -1;
1279  }
1280  return 0;
1281 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 1191 of file network.cpp.

1191  {
1192  // TODO(nkhadke): add error checking
1193  int i;
1194  TInt CurrLen;
1195  TVec<TFlt> NewVec;
1196  CurrLen = VecOfFltVecsN.Len();
1197  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
1198  NewVec = TVec<TFlt>();
1199  for (i = 0; i < MxNId; i++) {
1200  NewVec.Ins(i, defaultValue);
1201  }
1202  VecOfFltVecsN.Add(NewVec);
1203  if (!FltDefaultsN.IsKey(attr)) {
1204  FltDefaultsN.AddDat(attr, defaultValue);
1205  } else {
1206  return -1;
1207  }
1208  return 0;
1209 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2283 of file network.h.

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

Definition at line 922 of file network.cpp.

922  {
923  int i;
924  TInt CurrLen;
925  if (!IsEdge(EId)) {
926  //AddEdge(EId);
927  return -1;
928  }
929  if (KeyToIndexTypeE.IsKey(attr)) {
931  NewVec[EdgeH.GetKeyId(EId)] = value;
932  } else {
933  CurrLen = VecOfIntVecsE.Len();
934  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
935  TVec<TInt> NewVec = TVec<TInt>();
936  for (i = 0; i < MxEId; i++) {
937  NewVec.Ins(i, GetIntAttrDefaultE(attr));
938  }
939  NewVec[EdgeH.GetKeyId(EId)] = value;
940  VecOfIntVecsE.Add(NewVec);
941  }
942  return 0;
943 }
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:1853
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2257 of file network.h.

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

Definition at line 796 of file network.cpp.

796  {
797  int i;
798  TInt CurrLen;
799  if (!IsNode(NId)) {
800  // AddNode(NId);
801  return -1;
802  }
803  if (KeyToIndexTypeN.IsKey(attr)) {
805  NewVec[NodeH.GetKeyId(NId)] = value;
806  } else {
807  CurrLen = VecOfIntVecsN.Len();
808  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
809  TVec<TInt> NewVec = TVec<TInt>();
810  for (i = 0; i < MxNId; i++) {
811  NewVec.Ins(i, GetIntAttrDefaultN(attr));
812  }
813  NewVec[NodeH.GetKeyId(NId)] = value;
814  VecOfIntVecsN.Add(NewVec);
815  }
816  return 0;
817 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:1847
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 1211 of file network.cpp.

1211  {
1212  // TODO(nkhadke): add error checking
1213  int i;
1214  TInt CurrLen;
1215  TVec<TInt> NewVec;
1216  CurrLen = VecOfIntVecsE.Len();
1217  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
1218  NewVec = TVec<TInt>();
1219  for (i = 0; i < MxEId; i++) {
1220  NewVec.Ins(i, defaultValue);
1221  }
1222  VecOfIntVecsE.Add(NewVec);
1223  if (!IntDefaultsE.IsKey(attr)) {
1224  IntDefaultsE.AddDat(attr, defaultValue);
1225  } else {
1226  return -1;
1227  }
1228  return 0;
1229 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddIntAttrN ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int node attribute to the hashmap.

Definition at line 1143 of file network.cpp.

1143  {
1144  int i;
1145  TInt CurrLen;
1146  TVec<TInt> NewVec;
1147  CurrLen = VecOfIntVecsN.Len();
1148  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
1149  NewVec = TVec<TInt>();
1150  for (i = 0; i < MxNId; i++) {
1151  NewVec.Ins(i, defaultValue);
1152  }
1153  VecOfIntVecsN.Add(NewVec);
1154  if (!IntDefaultsN.IsKey(attr)) {
1155  IntDefaultsN.AddDat(attr, defaultValue);
1156  } else {
1157  return -1;
1158  }
1159  return 0;
1160 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TInt MxNId
Definition: network.h:1861
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2298 of file network.h.

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

Definition at line 945 of file network.cpp.

945  {
946  int i;
947  TInt CurrLen;
948  if (!IsEdge(EId)) {
949  //AddEdge(EId);
950  return -1;
951  }
952  if (KeyToIndexTypeE.IsKey(attr)) {
954  NewVec[EdgeH.GetKeyId(EId)] = value;
955  } else {
956  CurrLen = VecOfIntVecVecsE.Len();
957  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
958  TVec<TIntV> NewVec = TVec<TIntV>();
959  for (i = 0; i < MxEId; i++) {
960  NewVec.Ins(i, TIntV());
961  }
962  NewVec[EdgeH.GetKeyId(EId)] = value;
963  VecOfIntVecVecsE.Add(NewVec);
964  }
965  return 0;
966 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVec< TInt > TIntV
Definition: ds.h:1529
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2272 of file network.h.

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

Definition at line 819 of file network.cpp.

819  {
820  TInt CurrLen;
821  if (!IsNode(NId)) {
822  // AddNode(NId);
823  return -1;
824  }
825  if (KeyToIndexTypeN.IsKey(attr)) {
827  NewVec[NodeH.GetKeyId(NId)] = value;
828  } else {
829  CurrLen = VecOfIntVecVecsN.Len();
830  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
831  TVec<TIntV> NewVec = TVec<TIntV>(MxNId);
832  NewVec[NodeH.GetKeyId(NId)] = value;
833  VecOfIntVecVecsN.Add(NewVec);
834  }
835  return 0;
836 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddIntVAttrE ( const TStr attr)

Adds a new IntV edge attribute to the hashmap.

Definition at line 1231 of file network.cpp.

1231  {
1232  int i;
1233  TInt CurrLen;
1234  TVec<TIntV> NewVec;
1235  CurrLen = VecOfIntVecVecsE.Len();
1236  KeyToIndexTypeE.AddDat(attr, TIntPr(IntVType, CurrLen));
1237  NewVec = TVec<TIntV>();
1238  for (i = 0; i < MxEId; i++) {
1239  NewVec.Ins(i, TIntV());
1240  }
1241  VecOfIntVecVecsE.Add(NewVec);
1242  return 0;
1243 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVec< TInt > TIntV
Definition: ds.h:1529
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddIntVAttrN ( const TStr attr)

Adds a new IntV node attribute to the hashmap.

Definition at line 1162 of file network.cpp.

1162  {
1163  TInt CurrLen;
1164  TVec<TIntV> NewVec;
1165  CurrLen = VecOfIntVecVecsN.Len();
1166  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
1167  NewVec = TVec<TIntV>(MxNId);
1168  VecOfIntVecVecsN.Add(NewVec);
1169  return 0;
1170 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddNode ( int  NId = -1)

Adds a node of ID NId to the graph.

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 381 of file network.cpp.

381  {
382  int i;
383  if (NId == -1) {
384  NId = MxNId; MxNId++;
385  } else {
386  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
387  MxNId = TMath::Mx(NId+1, MxNId());
388  }
389  // update attribute columns
390  NodeH.AddDat(NId, TNode(NId));
391  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
392  TVec<TInt>& IntVec = VecOfIntVecsN[i];
393  int KeyId = NodeH.GetKeyId(NId);
394  if (IntVec.Len() > KeyId) {
395  IntVec[KeyId] = TInt::Mn;
396  } else {
397  IntVec.Ins(KeyId, TInt::Mn);
398  }
399  }
400  TVec<TStr> DefIntVec = TVec<TStr>();
401  IntDefaultsN.GetKeyV(DefIntVec);
402  for (i = 0; i < DefIntVec.Len(); i++) {
403  TStr attr = DefIntVec[i];
404  TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
405  IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
406  }
407  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
408  TVec<TStr>& StrVec = VecOfStrVecsN[i];
409  int KeyId = NodeH.GetKeyId(NId);
410  if (StrVec.Len() > KeyId) {
411  StrVec[KeyId] = TStr::GetNullStr();
412  } else {
413  StrVec.Ins(KeyId, TStr::GetNullStr());
414  }
415  }
416  TVec<TStr> DefStrVec = TVec<TStr>();
417  StrDefaultsN.GetKeyV(DefStrVec);
418  for (i = 0; i < DefStrVec.Len(); i++) {
419  TStr attr = DefStrVec[i];
420  TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
421  StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
422  }
423  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
424  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
425  int KeyId = NodeH.GetKeyId(NId);
426  if (FltVec.Len() > KeyId) {
427  FltVec[KeyId] = TFlt::Mn;
428  } else {
429  FltVec.Ins(KeyId, TFlt::Mn);
430  }
431  }
432  TVec<TStr> DefFltVec = TVec<TStr>();
433  FltDefaultsN.GetKeyV(DefFltVec);
434  for (i = 0; i < DefFltVec.Len(); i++) {
435  TStr attr = DefFltVec[i];
436  TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
437  FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
438  }
439  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
440  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
441  int KeyId = NodeH.GetKeyId(NId);
442  if (IntVecV.Len() > KeyId) {
443  IntVecV[KeyId] = TIntV();
444  } else {
445  IntVecV.Ins(KeyId, TIntV());
446  }
447  }
448  return NId;
449 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
static const int Mn
Definition: dt.h:1048
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:1849
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:442
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVec< TInt > TIntV
Definition: ds.h:1529
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1851
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:1847
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
static const double Mn
Definition: dt.h:1297
int TNEANet::AddNode ( const TNodeI NodeI)
inline

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

Definition at line 1977 of file network.h.

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

1531  {
1532  if (!IsEdge(EId)) {
1533  return -1;
1534  }
1535  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1536 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 1538 of file network.cpp.

1538  {
1539  if (!IsEdge(EId)) {
1540  return -1;
1541  }
1542  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1543 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 2594 of file network.h.

2594  {
2595  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
2596  }
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:1531
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 2598 of file network.h.

2598  {
2599  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
2600  }
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:1531
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 1545 of file network.cpp.

1545  {
1546  if (!IsEdge(EId)) {
1547  return -1;
1548  }
1549  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1550 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 1552 of file network.cpp.

1552  {
1553  if (!IsEdge(EId)) {
1554  return -1;
1555  }
1556  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1557 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 2608 of file network.h.

2608  {
2609  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
2610  }
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:1531
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 2612 of file network.h.

2612  {
2613  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
2614  }
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:1531
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 1559 of file network.cpp.

1559  {
1560  if (!IsEdge(EId)) {
1561  return -1;
1562  }
1563  return SAttrE.AddSAttrDat(EId, AttrName, Val);
1564 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 1566 of file network.cpp.

1566  {
1567  if (!IsEdge(EId)) {
1568  return -1;
1569  }
1570  return SAttrE.AddSAttrDat(EId, AttrId, Val);
1571 }
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:2198
TAttr SAttrE
Definition: network.h:1877
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 2622 of file network.h.

2622  {
2623  return AddSAttrDatE(EdgeI.GetId(), AttrName, Val);
2624  }
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:1531
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 2626 of file network.h.

2626  {
2627  return AddSAttrDatE(EdgeI.GetId(), AttrId, Val);
2628  }
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:1531
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 1405 of file network.cpp.

1405  {
1406  if (!IsNode(NId)) {
1407  return -1;
1408  }
1409  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1410 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 1412 of file network.cpp.

1412  {
1413  if (!IsNode(NId)) {
1414  return -1;
1415  }
1416  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1417 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 2476 of file network.h.

2476  {
2477  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2478  }
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:1405
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 2480 of file network.h.

2480  {
2481  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2482  }
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:1405
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 1419 of file network.cpp.

1419  {
1420  if (!IsNode(NId)) {
1421  return -1;
1422  }
1423  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1424 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 1426 of file network.cpp.

1426  {
1427  if (!IsNode(NId)) {
1428  return -1;
1429  }
1430  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1431 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 2490 of file network.h.

2490  {
2491  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2492  }
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:1405
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 2494 of file network.h.

2494  {
2495  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2496  }
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:1405
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 1433 of file network.cpp.

1433  {
1434  if (!IsNode(NId)) {
1435  return -1;
1436  }
1437  return SAttrN.AddSAttrDat(NId, AttrName, Val);
1438 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 1440 of file network.cpp.

1440  {
1441  if (!IsNode(NId)) {
1442  return -1;
1443  }
1444  return SAttrN.AddSAttrDat(NId, AttrId, Val);
1445 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
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 2504 of file network.h.

2504  {
2505  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
2506  }
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:1405
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 2508 of file network.h.

2508  {
2509  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
2510  }
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:1405
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 1645 of file network.cpp.

1645  {
1646  return SAttrE.AddSAttr(Name, AttrType, AttrId);
1647 }
TAttr SAttrE
Definition: network.h:1877
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 1519 of file network.cpp.

1519  {
1520  return SAttrN.AddSAttr(Name, AttrType, AttrId);
1521 }
TAttr SAttrN
Definition: network.h:1876
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 2288 of file network.h.

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

Definition at line 983 of file network.cpp.

983  {
984  int i;
985  TInt CurrLen;
986  if (!IsEdge(EId)) {
987  //AddEdge(EId);
988  return -1;
989  }
990  if (KeyToIndexTypeE.IsKey(attr)) {
992  NewVec[EdgeH.GetKeyId(EId)] = value;
993  } else {
994  CurrLen = VecOfStrVecsE.Len();
995  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
996  TVec<TStr> NewVec = TVec<TStr>();
997  for (i = 0; i < MxEId; i++) {
998  NewVec.Ins(i, GetStrAttrDefaultE(attr));
999  }
1000  NewVec[EdgeH.GetKeyId(EId)] = value;
1001  VecOfStrVecsE.Add(NewVec);
1002  }
1003  return 0;
1004 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1855
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2262 of file network.h.

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

Definition at line 875 of file network.cpp.

875  {
876  int i;
877  TInt CurrLen;
878  if (!IsNode(NId)) {
879  // AddNode(NId);
880  return -1;
881  }
882  if (KeyToIndexTypeN.IsKey(attr)) {
884  NewVec[NodeH.GetKeyId(NId)] = value;
885  } else {
886  CurrLen = VecOfStrVecsN.Len();
887  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
888  TVec<TStr> NewVec = TVec<TStr>();
889  for (i = 0; i < MxNId; i++) {
890  NewVec.Ins(i, GetStrAttrDefaultN(attr));
891  }
892  NewVec[NodeH.GetKeyId(NId)] = value;
893  VecOfStrVecsN.Add(NewVec);
894  }
895  return 0;
896 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:1849
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 1245 of file network.cpp.

1245  {
1246  int i;
1247  TInt CurrLen;
1248  TVec<TStr> NewVec;
1249  CurrLen = VecOfStrVecsE.Len();
1250  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
1251  NewVec = TVec<TStr>();
1252  for (i = 0; i < MxEId; i++) {
1253  NewVec.Ins(i, defaultValue);
1254  }
1255  VecOfStrVecsE.Add(NewVec);
1256  if (!StrDefaultsE.IsKey(attr)) {
1257  StrDefaultsE.AddDat(attr, defaultValue);
1258  } else {
1259  return -1;
1260  }
1261  return 0;
1262 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TInt MxEId
Definition: network.h:1861
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TNEANet::AddStrAttrN ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str node attribute to the hashmap.

Definition at line 1172 of file network.cpp.

1172  {
1173  int i;
1174  TInt CurrLen;
1175  TVec<TStr> NewVec;
1176  CurrLen = VecOfStrVecsN.Len();
1177  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
1178  NewVec = TVec<TStr>();
1179  for (i = 0; i < MxNId; i++) {
1180  NewVec.Ins(i, defaultValue);
1181  }
1182  VecOfStrVecsN.Add(NewVec);
1183  if (!StrDefaultsN.IsKey(attr)) {
1184  StrDefaultsN.AddDat(attr, defaultValue);
1185  } else {
1186  return -1;
1187  }
1188  return 0;
1189 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 2301 of file network.h.

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

Definition at line 968 of file network.cpp.

968  {
969  TInt CurrLen;
970  if (!IsEdge(EId)) {
971  //AddEdge(EId);
972  return -1;
973  }
974  if (KeyToIndexTypeE.IsKey(attr)) {
976  NewVec[EdgeH.GetKeyId(EId)].Add(value);
977  } else {
978  return -1;
979  }
980  return 0;
981 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
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 2275 of file network.h.

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

Definition at line 838 of file network.cpp.

838  {
839  TInt CurrLen;
840  if (!IsNode(NId)) {
841  // AddNode(NId);
842  return -1;
843  }
844  if (KeyToIndexTypeN.IsKey(attr)) {
846  NewVec[NodeH.GetKeyId(NId)].Add(value);
847  } else {
848  CurrLen = VecOfIntVecVecsN.Len();
849  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
850  TVec<TIntV> NewVec;
851  VecOfIntVecVecsN.Add(NewVec);
852  VecOfIntVecVecsN[CurrLen].Gen(MxNId);
853  VecOfIntVecVecsN[CurrLen][NodeH.GetKeyId(NId)].Add(value);
854  }
855  return 0;
856 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
void TNEANet::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 2080 of file network.h.

2080  {
2081  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:2080
TIter BegI() const
Definition: hash.h:171
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
void TNEANet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 207 of file network.cpp.

207  {
208  Names = TVec<TStr>();
209  while (!EdgeHI.IsEnd()) {
210  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
211  Names.Add(EdgeHI.GetKey());
212  }
213  EdgeHI++;
214  }
215 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:335
const TKey & GetKey() const
Definition: hash.h:71
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::AttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of attr names for node NId.

Definition at line 2034 of file network.h.

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

Definition at line 25 of file network.cpp.

25  {
26  Names = TVec<TStr>();
27  while (!NodeHI.IsEnd()) {
28  if (!NodeAttrIsDeleted(NId, NodeHI)) {
29  Names.Add(NodeHI.GetKey());
30  }
31  NodeHI++;
32  }
33 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:153
const TKey & GetKey() const
Definition: hash.h:71
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2084 of file network.h.

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

Definition at line 217 of file network.cpp.

217  {
218  Values = TVec<TStr>();
219  while (!EdgeHI.IsEnd()) {
220  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
221  Values.Add(GetEdgeAttrValue(EId, EdgeHI));
222  }
223  EdgeHI++;
224  }
225 }
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns edge attribute value, converted to Str type.
Definition: network.cpp:367
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Returns true if EId attr deleted for current edge attr iterator.
Definition: network.cpp:335
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::AttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2038 of file network.h.

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

Definition at line 35 of file network.cpp.

35  {
36  Values = TVec<TStr>();
37  while (!NodeHI.IsEnd()) {
38  if (!NodeAttrIsDeleted(NId, NodeHI)) {
39  Values.Add(GetNodeAttrValue(NId, NodeHI));
40  }
41  NodeHI++;
42  }
43 }
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns true if NId attr deleted for current node attr iterator.
Definition: network.cpp:153
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TStr GetNodeAttrValue(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Returns node attribute value, converted to Str type.
Definition: network.cpp:193
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TAFltI TNEANet::BegEAFltI ( const TStr attr) const
inline

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

Definition at line 2162 of file network.h.

2162  {
2163  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2164  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
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 2125 of file network.h.

2125  {
2126  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2127  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:565
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 2138 of file network.h.

2138  {
2139  return TAIntVI(VecOfIntVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2140  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANet::BegEAStrI ( const TStr attr) const
inline

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

Definition at line 2151 of file network.h.

2151  {
2152  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this); }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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 2206 of file network.h.

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

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

Definition at line 2024 of file network.h.

2024  {
2025  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
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 1993 of file network.h.

1993  {
1994  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:565
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 2003 of file network.h.

2003  {
2004  return TAIntVI(VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TAStrI TNEANet::BegNAStrI ( const TStr attr) const
inline

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

Definition at line 2014 of file network.h.

2014  {
2015 
2016  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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 1987 of file network.h.

1987 { return TNodeI(NodeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:171
THash< TInt, TNode > NodeH
Definition: network.h:1862
void TNEANet::Clr ( )
inline

Deletes all nodes and edges from the graph.

Definition at line 2230 of file network.h.

2230  { MxNId=0; MxEId=0; NodeH.Clr(); EdgeH.Clr();
2234  VecOfFltVecsN.Clr(); VecOfFltVecsE.Clr(); VecOfIntVecVecsN.Clr(); VecOfIntVecVecsE.Clr();
2235  SAttrN.Clr(); SAttrE.Clr();}
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:319
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
void Clr()
Clears the contents of the attribute map.
Definition: attr.h:29
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 667 of file network.cpp.

667  {
668  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
669  TNode& Node = NodeH[kid];
670  Node.InEIdV.Pack(); Node.OutEIdV.Pack();
671  }
672  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
673  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
674 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:191
void Defrag()
Definition: hash.h:513
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
bool FNextKeyId(int &KeyId) const
Definition: hash.h:436
int FFirstKeyId() const
Definition: hash.h:236
THash< TInt, TNode > NodeH
Definition: network.h:1862
void Pack()
Definition: hash.h:247
int TNEANet::DelAttrDatE ( const TEdgeI EdgeI,
const TStr attr 
)
inline

Deletes the edge attribute for NodeI.

Definition at line 2374 of file network.h.

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

Definition at line 1126 of file network.cpp.

1126  {
1127  // TODO(nkhadke): add error checking
1128  TInt vecType = KeyToIndexTypeE(attr).Val1;
1129  if (vecType == IntType) {
1131  } else if (vecType == StrType) {
1133  } else if (vecType == FltType) {
1135  } else if (vecType == IntVType) {
1137  } else {
1138  return -1;
1139  }
1140  return 0;
1141 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1853
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1855
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1857
TVec< TInt > TIntV
Definition: ds.h:1529
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 2371 of file network.h.

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

Definition at line 1110 of file network.cpp.

1110  {
1111  TInt vecType = KeyToIndexTypeN(attr).Val1;
1112  if (vecType == IntType) {
1114  } else if (vecType == StrType) {
1116  } else if (vecType == FltType) {
1118  } else if (vecType ==IntVType) {
1120  } else {
1121  return -1;
1122  }
1123  return 0;
1124 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:1849
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVec< TInt > TIntV
Definition: ds.h:1529
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1851
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:1847
int TNEANet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 1309 of file network.cpp.

1309  {
1310  TInt vecType = KeyToIndexTypeE(attr).Val1;
1311  if (vecType == IntType) {
1313  if (IntDefaultsE.IsKey(attr)) {
1314  IntDefaultsE.DelKey(attr);
1315  }
1316  } else if (vecType == StrType) {
1318  if (StrDefaultsE.IsKey(attr)) {
1319  StrDefaultsE.DelKey(attr);
1320  }
1321  } else if (vecType == FltType) {
1323  if (FltDefaultsE.IsKey(attr)) {
1324  FltDefaultsE.DelKey(attr);
1325  }
1326  } else {
1327  return -1;
1328  }
1329  KeyToIndexTypeE.DelKey(attr);
1330  return 0;
1331 }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
void DelKey(const TKey &Key)
Definition: hash.h:362
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
Definition: dt.h:1044
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216
int TNEANet::DelAttrN ( const TStr attr)

Removes all the values for node attr.

Definition at line 1283 of file network.cpp.

1283  {
1284  TInt vecType = KeyToIndexTypeN(attr).Val1;
1285  if (vecType == IntType) {
1287  if (IntDefaultsN.IsKey(attr)) {
1288  IntDefaultsN.DelKey(attr);
1289  }
1290  } else if (vecType == StrType) {
1292  if (StrDefaultsN.IsKey(attr)) {
1293  StrDefaultsN.DelKey(attr);
1294  }
1295  } else if (vecType == FltType) {
1297  if (FltDefaultsN.IsKey(attr)) {
1298  FltDefaultsN.DelKey(attr);
1299  }
1300  } else if (vecType == IntVType) {
1302  } else {
1303  return -1;
1304  }
1305  KeyToIndexTypeN.DelKey(attr);
1306  return 0;
1307 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
void DelKey(const TKey &Key)
Definition: hash.h:362
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
Definition: dt.h:1044
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
bool IsKey(const TKey &Key) const
Definition: hash.h:216
void TNEANet::DelEdge ( const int &  EId)

Deletes an edge with edge ID EId from the graph.

Definition at line 594 of file network.cpp.

594  {
595  int i;
596 
597  IAssert(IsEdge(EId));
598  const int SrcNId = GetEdge(EId).GetSrcNId();
599  const int DstNId = GetEdge(EId).GetDstNId();
600  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
601  GetNode(DstNId).InEIdV.DelIfIn(EId);
602  TInt Id(EId);
603  SAttrE.DelSAttrId(Id);
604 
605  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
606  TVec<TInt>& IntVec = VecOfIntVecsE[i];
607  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
608  }
609  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
610  TVec<TStr>& StrVec = VecOfStrVecsE[i];
611  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
612  }
613  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
614  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
615  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
616  }
617 
618  EdgeH.DelKey(EId);
619 }
#define IAssert(Cond)
Definition: bd.h:262
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1151
int GetSrcNId() const
Definition: network.h:1627
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TNode & GetNode(const int &NId)
Definition: network.h:1840
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TIntV OutEIdV
Definition: network.h:1599
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
void DelKey(const TKey &Key)
Definition: hash.h:362
TAttr SAttrE
Definition: network.h:1877
static const int Mn
Definition: dt.h:1048
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
int GetDstNId() const
Definition: network.h:1628
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1044
TEdge & GetEdge(const int &EId)
Definition: network.h:1842
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TIntV InEIdV
Definition: network.h:1599
static const double Mn
Definition: dt.h:1297
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 622 of file network.cpp.

622  {
623  int EId = 0;
624  bool Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
625  IAssert(Edge); // there is at least one edge
626  while (Edge) {
627  DelEdge(EId);
628  Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
629  }
630 }
#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:594
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
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 2278 of file network.h.

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

Definition at line 858 of file network.cpp.

858  {
859  TInt CurrLen;
860  if (!IsNode(NId)) {
861  // AddNode(NId);
862  return -1;
863  }
864  if (KeyToIndexTypeN.IsKey(attr)) {
866  if (!NewVec[NodeH.GetKeyId(NId)].DelIfIn(value)) {
867  return -1;
868  }
869  } else {
870  return -1;
871  }
872  return 0;
873 }
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1151
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 451 of file network.cpp.

451  {
452  int i;
453  TInt Id(NId);
454  SAttrN.DelSAttrId(Id);
455  const TNode& Node = GetNode(NId);
456  for (int out = 0; out < Node.GetOutDeg(); out++) {
457  const int EId = Node.GetOutEId(out);
458  const TEdge& Edge = GetEdge(EId);
459  IAssert(Edge.GetSrcNId() == NId);
460  GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
461  // Delete from Edge Attributes
462  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
463  TVec<TInt>& IntVec = VecOfIntVecsE[i];
464  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
465  }
466  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
467  TVec<TStr>& StrVec = VecOfStrVecsE[i];
468  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
469  }
470  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
471  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
472  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
473  }
474  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
475  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
476  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
477  }
478  EdgeH.DelKey(EId);
479  }
480  for (int in = 0; in < Node.GetInDeg(); in++) {
481  const int EId = Node.GetInEId(in);
482  const TEdge& Edge = GetEdge(EId);
483  IAssert(Edge.GetDstNId() == NId);
484  GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
485  // Delete from Edge Attributes
486  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
487  TVec<TInt>& IntVec = VecOfIntVecsE[i];
488  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
489  }
490  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
491  TVec<TStr>& StrVec = VecOfStrVecsE[i];
492  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
493  }
494  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
495  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
496  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
497  }
498  for (i = 0; i < VecOfIntVecVecsE.Len(); i++) {
499  TVec<TIntV>& IntVecV = VecOfIntVecVecsE[i];
500  IntVecV[EdgeH.GetKeyId(EId)] = TIntV();
501  }
502  EdgeH.DelKey(EId);
503  }
504 
505  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
506  TVec<TInt>& IntVec = VecOfIntVecsN[i];
507  IntVec[NodeH.GetKeyId(NId)] = TInt::Mn;
508  }
509  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
510  TVec<TStr>& StrVec = VecOfStrVecsN[i];
511  StrVec[NodeH.GetKeyId(NId)] = TStr::GetNullStr();
512  }
513  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
514  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
515  FltVec[NodeH.GetKeyId(NId)] = TFlt::Mn;
516  }
517  for (i = 0; i < VecOfIntVecVecsN.Len(); i++) {
518  TVec<TIntV>& IntVecV = VecOfIntVecVecsN[i];
519  IntVecV[NodeH.GetKeyId(NId)] = TIntV();
520  }
521  NodeH.DelKey(NId);
522 }
#define IAssert(Cond)
Definition: bd.h:262
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TNode & GetNode(const int &NId)
Definition: network.h:1840
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TAttr SAttrN
Definition: network.h:1876
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
void DelKey(const TKey &Key)
Definition: hash.h:362
static const int Mn
Definition: dt.h:1048
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1044
TEdge & GetEdge(const int &EId)
Definition: network.h:1842
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVec< TInt > TIntV
Definition: ds.h:1529
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
static const double Mn
Definition: dt.h:1297
void TNEANet::DelNode ( const TNode NodeI)
inline

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

Definition at line 1983 of file network.h.

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

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

Definition at line 1615 of file network.cpp.

1615  {
1616  if (!IsEdge(EId)) {
1617  return -1;
1618  }
1619  return SAttrE.DelSAttrDat(EId, AttrName);
1620 }
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:2198
TAttr SAttrE
Definition: network.h:1877
int TNEANet::DelSAttrDatE ( const TInt EId,
const TInt AttrId 
)

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

Definition at line 1622 of file network.cpp.

1622  {
1623  if (!IsEdge(EId)) {
1624  return -1;
1625  }
1626  return SAttrE.DelSAttrDat(EId, AttrId);
1627 }
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:2198
TAttr SAttrE
Definition: network.h:1877
int TNEANet::DelSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from EdgeI.

Definition at line 2678 of file network.h.

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

Deletes sparse attribute with id AttrId from EdgeI.

Definition at line 2682 of file network.h.

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

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

Definition at line 1489 of file network.cpp.

1489  {
1490  if (!IsNode(NId)) {
1491  return -1;
1492  }
1493  return SAttrN.DelSAttrDat(NId, AttrName);
1494 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
int TNEANet::DelSAttrDatN ( const TInt NId,
const TInt AttrId 
)

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

Definition at line 1496 of file network.cpp.

1496  {
1497  if (!IsNode(NId)) {
1498  return -1;
1499  }
1500  return SAttrN.DelSAttrDat(NId, AttrId);
1501 }
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:1876
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
int TNEANet::DelSAttrDatN ( const TNodeI NodeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from NodeI.

Definition at line 2560 of file network.h.

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

Deletes sparse attribute with id AttrId from NodeI.

Definition at line 2564 of file network.h.

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

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

Definition at line 729 of file network.cpp.

729  {
730  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
731  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
732  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network with Attributes: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
733  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
734  fprintf(OutF, " %*d:", NodePlaces, NodeI.GetId());
735  fprintf(OutF, " in[%d]", NodeI.GetInDeg());
736  for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
737  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
738  //fprintf(OutF, "\n");
739  fprintf(OutF, " out[%d]", NodeI.GetOutDeg());
740  for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
741  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
742  //fprintf(OutF, "\n");
743 
744  // load node attributes
745  TIntV IntAttrN;
746  IntAttrValueNI(NodeI.GetId(), IntAttrN);
747  fprintf(OutF, " nai[%d]", IntAttrN.Len());
748  for (int i = 0; i < IntAttrN.Len(); i++) {
749  fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
750  //fprintf(OutF, "\n");
751 
752  TStrV StrAttrN;
753  StrAttrValueNI(NodeI.GetId(), StrAttrN);
754  fprintf(OutF, " nas[%d]", StrAttrN.Len());
755  for (int i = 0; i < StrAttrN.Len(); i++) {
756  fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
757  //fprintf(OutF, "\n");
758 
759  TFltV FltAttrN;
760  FltAttrValueNI(NodeI.GetId(), FltAttrN);
761  fprintf(OutF, " naf[%d]", FltAttrN.Len());
762  for (int i = 0; i < FltAttrN.Len(); i++) {
763  fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }
764  //fprintf(OutF, "\n");
765  fprintf(OutF, "\n");
766  }
767  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
768  fprintf(OutF, " %*d: %*d -> %*d", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
769 
770  // load edge attributes
771  TIntV IntAttrE;
772  IntAttrValueEI(EdgeI.GetId(), IntAttrE);
773  fprintf(OutF, " eai[%d]", IntAttrE.Len());
774  for (int i = 0; i < IntAttrE.Len(); i++) {
775  fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]());
776  }
777  TStrV StrAttrE;
778  StrAttrValueEI(EdgeI.GetId(), StrAttrE);
779  fprintf(OutF, " eas[%d]", StrAttrE.Len());
780  for (int i = 0; i < StrAttrE.Len(); i++) {
781  fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]());
782  }
783  TFltV FltAttrE;
784  FltAttrValueEI(EdgeI.GetId(), FltAttrE);
785  fprintf(OutF, " eaf[%d]", FltAttrE.Len());
786  for (int i = 0; i < FltAttrE.Len(); i++) {
787  fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]());
788  }
789  fprintf(OutF, "\n");
790  }
791  //fprintf(OutF, "\n");
792 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: network.h:1969
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2067
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:2092
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2112
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2120
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2206
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2208
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2075
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2047
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: network.h:1989
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2179
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: network.h:1987
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 335 of file network.cpp.

335  {
336  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
337  bool IntVDel = EdgeAttrIsIntVDeleted(EId, EdgeHI);
338  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
339  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
340  return IntDel || StrDel || FltDel || IntVDel;
341 }
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:361
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:343
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:349
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:355
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 361 of file network.cpp.

361  {
362  return (EdgeHI.GetDat().Val1 == FltType &&
363  GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
364  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
365 }
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1857
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 343 of file network.cpp.

343  {
344  return (EdgeHI.GetDat().Val1 == IntType &&
345  GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
346  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
347 }
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1853
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 349 of file network.cpp.

349  {
350  return (EdgeHI.GetDat().Val1 == IntVType &&
351  TIntV() == this->VecOfIntVecVecsE.GetVal(
352  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
353 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
const TDat & GetDat() const
Definition: hash.h:72
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TInt > TIntV
Definition: ds.h:1529
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 355 of file network.cpp.

355  {
356  return (EdgeHI.GetDat().Val1 == StrType &&
357  GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
358  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
359 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
const TDat & GetDat() const
Definition: hash.h:72
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1855
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
bool TNEANet::Empty ( ) const
inline

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

Definition at line 2228 of file network.h.

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

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

Definition at line 2166 of file network.h.

2166  {
2167  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2168  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
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 2129 of file network.h.

2129  {
2130  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2131  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:567
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
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 2142 of file network.h.

2142  {
2143  return TAIntVI(VecOfIntVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2144  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANet::EndEAStrI ( const TStr attr) const
inline

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

Definition at line 2154 of file network.h.

2154  {
2155  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2156  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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 2208 of file network.h.

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

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

Definition at line 2027 of file network.h.

2027  {
2028  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
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 1996 of file network.h.

1996  {
1997  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:567
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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 2006 of file network.h.

2006  {
2007  return TAIntVI(VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TVal2 Val2
Definition: ds.h:35
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TAStrI TNEANet::EndNAStrI ( const TStr attr) const
inline

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

Definition at line 2018 of file network.h.

2018  {
2019  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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 1989 of file network.h.

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

Returns a vector of int attr names for node NId.

Definition at line 2116 of file network.h.

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

Definition at line 290 of file network.cpp.

290  {
291  Names = TVec<TStr>();
292  while (!EdgeHI.IsEnd()) {
293  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
294  Names.Add(EdgeHI.GetKey());
295  }
296  EdgeHI++;
297  }
298 }
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:361
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::FltAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2071 of file network.h.

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

Definition at line 108 of file network.cpp.

108  {
109  Names = TVec<TStr>();
110  while (!NodeHI.IsEnd()) {
111  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
112  Names.Add(NodeHI.GetKey());
113  }
114  NodeHI++;
115  }
116 }
const TKey & GetKey() const
Definition: hash.h:71
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:185
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2120 of file network.h.

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

Definition at line 300 of file network.cpp.

300  {
301  Values = TVec<TFlt>();
302  while (!EdgeHI.IsEnd()) {
303  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
304  TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
305  Values.Add(val);
306  }
307  EdgeHI++;
308  }
309 }
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:361
Definition: dt.h:1293
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::FltAttrValueNI ( const TInt NId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2075 of file network.h.

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

Definition at line 118 of file network.cpp.

118  {
119  Values = TVec<TFlt>();
120  while (!NodeHI.IsEnd()) {
121  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
122  TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId)));
123  Values.Add(val);
124  }
125  NodeHI++;
126  }
127 }
Definition: dt.h:1293
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:185
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TInt, TNode > NodeH
Definition: network.h:1862
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
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 1357 of file network.cpp.

1357  {
1358  for (TStrIntPrH::TIter it = KeyToIndexTypeE.BegI(); it < KeyToIndexTypeE.EndI(); it++) {
1359  if (it.GetDat().GetVal1() == IntType) {
1360  IntAttrNames.Add(it.GetKey());
1361  }
1362  if (it.GetDat().GetVal1() == FltType) {
1363  FltAttrNames.Add(it.GetKey());
1364  }
1365  if (it.GetDat().GetVal1() == StrType) {
1366  StrAttrNames.Add(it.GetKey());
1367  }
1368  }
1369 }
TIter BegI() const
Definition: hash.h:171
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TIter EndI() const
Definition: hash.h:176
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
int TNEANet::GetAttrIndE ( const TStr attr)

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

Definition at line 1106 of file network.cpp.

1106  {
1107  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1108 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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 1070 of file network.cpp.

1070  {
1071  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1072 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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 1343 of file network.cpp.

1343  {
1344  for (TStrIntPrH::TIter it = KeyToIndexTypeN.BegI(); it < KeyToIndexTypeN.EndI(); it++) {
1345  if (it.GetDat().GetVal1() == IntType) {
1346  IntAttrNames.Add(it.GetKey());
1347  }
1348  if (it.GetDat().GetVal1() == FltType) {
1349  FltAttrNames.Add(it.GetKey());
1350  }
1351  if (it.GetDat().GetVal1() == StrType) {
1352  StrAttrNames.Add(it.GetKey());
1353  }
1354  }
1355 }
TIter BegI() const
Definition: hash.h:171
TIter EndI() const
Definition: hash.h:176
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
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 2170 of file network.h.

2170  {
2171  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2172  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2133 of file network.h.

2133  {
2134  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2135  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:569
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 2146 of file network.h.

2146  {
2147  return TAIntVI(VecOfIntVecVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2148  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
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 2158 of file network.h.

2158  {
2159  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2160  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
TEdge& TNEANet::GetEdge ( const int &  EId)
inlineprotected

Definition at line 1842 of file network.h.

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

Definition at line 1843 of file network.h.

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

Returns edge attribute value, converted to Str type.

Definition at line 367 of file network.cpp.

367  {
368  if (EdgeHI.GetDat().Val1 == IntType) {
369  return (this->VecOfIntVecsE.GetVal(
370  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
371  } else if(EdgeHI.GetDat().Val1 == StrType) {
372  return this->VecOfStrVecsE.GetVal(
373  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId));
374  } else if (EdgeHI.GetDat().Val1 == FltType) {
375  return (this->VecOfFltVecsE.GetVal(
376  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
377  }
378  return TStr::GetNullStr();
379 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
const TDat & GetDat() const
Definition: hash.h:72
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
int TNEANet::GetEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 2179 of file network.h.

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

Returns an iterator referring to edge with edge ID EId.

Definition at line 2210 of file network.h.

2210 { return TEdgeI(EdgeH.GetI(EId), this); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TIter GetI(const TKey &Key) const
Definition: hash.h:178
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 2212 of file network.h.

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

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

Gets a vector IDs of all edges in the graph.

Definition at line 660 of file network.cpp.

660  {
661  EIdV.Gen(GetEdges(), 0);
662  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
663  EIdV.Add(EdgeH.GetKey(E));
664  }
665 }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
bool FNextKeyId(int &KeyId) const
Definition: hash.h:436
int FFirstKeyId() const
Definition: hash.h:236
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2179
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:495
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
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 2344 of file network.h.

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

Definition at line 1086 of file network.cpp.

1086  {
1087  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1088 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2311 of file network.h.

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

Definition at line 1050 of file network.cpp.

1050  {
1051  return VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1052 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TFlt TNEANet::GetFltAttrDefaultE ( const TStr attribute) const
inlineprotected

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

Definition at line 1857 of file network.h.

1857 { return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
Definition: dt.h:1293
bool IsKey(const TKey &Key) const
Definition: hash.h:216
static const double Mn
Definition: dt.h:1297
TFlt TNEANet::GetFltAttrDefaultN ( const TStr attribute) const
inlineprotected

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

Definition at line 1851 of file network.h.

1851 { return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
Definition: dt.h:1293
bool IsKey(const TKey &Key) const
Definition: hash.h:216
static const double Mn
Definition: dt.h:1297
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 2361 of file network.h.

2361 { 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:2361
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 1098 of file network.cpp.

1098  {
1099  return VecOfFltVecsE[index][EdgeH.GetKeyId(EId)];
1100 }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2333 of file network.h.

2333 { 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:2333
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 1062 of file network.cpp.

1062  {
1063  return VecOfFltVecsN[index][NodeH.GetKeyId(NId)];
1064 }
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TFlt > & TNEANet::GetFltAttrVecE ( const TStr attr)

Gets Vector for the Flt Attribute attr.

Definition at line 1030 of file network.cpp.

1030  {
1031  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
1032 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TVal2 Val2
Definition: ds.h:35
int TNEANet::GetFltKeyIdE ( const int &  EId)

Gets keyid for edge with id EId.

Definition at line 1034 of file network.cpp.

1034  {
1035  return EdgeH.GetKeyId(EId);
1036 }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 1637 of file network.cpp.

1637  {
1638  return SAttrE.GetIdVSAttr(AttrName, IdV);
1639 }
TAttr SAttrE
Definition: network.h:1877
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 1641 of file network.cpp.

1641  {
1642  return SAttrE.GetIdVSAttr(AttrId, IdV);
1643 }
TAttr SAttrE
Definition: network.h:1877
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 1511 of file network.cpp.

1511  {
1512  return SAttrN.GetIdVSAttr(AttrName, IdV);
1513 }
TAttr SAttrN
Definition: network.h:1876
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 1515 of file network.cpp.

1515  {
1516  return SAttrN.GetIdVSAttr(AttrId, IdV);
1517 }
TAttr SAttrN
Definition: network.h:1876
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 2338 of file network.h.

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

Definition at line 1074 of file network.cpp.

1074  {
1075  return VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1076 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2304 of file network.h.

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

Definition at line 1038 of file network.cpp.

1038  {
1039  return VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1040 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TInt TNEANet::GetIntAttrDefaultE ( const TStr attribute) const
inlineprotected

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

Definition at line 1853 of file network.h.

1853 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
static const int Mn
Definition: dt.h:1048
Definition: dt.h:1044
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TInt TNEANet::GetIntAttrDefaultN ( const TStr attribute) const
inlineprotected

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

Definition at line 1847 of file network.h.

1847 { return IntDefaultsN.IsKey(attribute) ? IntDefaultsN.GetDat(attribute) : (TInt) TInt::Mn; }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
static const int Mn
Definition: dt.h:1048
Definition: dt.h:1044
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 2356 of file network.h.

2356 { 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:2356
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 1090 of file network.cpp.

1090  {
1091  return VecOfIntVecsE[index][EdgeH.GetKeyId(EId)];
1092 }
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2323 of file network.h.

2323 { 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:2323
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 1054 of file network.cpp.

1054  {
1055  return VecOfIntVecsN[index][NodeH.GetKeyId(NId)];
1056 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TNode > NodeH
Definition: network.h:1862
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 1102 of file network.cpp.

1102  {
1103  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
1104 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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 1066 of file network.cpp.

1066  {
1067  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
1068 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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 2347 of file network.h.

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

Definition at line 1078 of file network.cpp.

1078  {
1080 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2314 of file network.h.

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

Definition at line 1042 of file network.cpp.

1042  {
1044 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
int TNEANet::GetMxEId ( ) const
inline

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

Definition at line 2176 of file network.h.

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

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

Definition at line 2174 of file network.h.

2174 { return MxNId; }
TInt MxNId
Definition: network.h:1861
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 2030 of file network.h.

2030  {
2031  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
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 1999 of file network.h.

1999  {
2000  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:569
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 2009 of file network.h.

2009  {
2010  return TAIntVI(VecOfIntVecVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
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 2021 of file network.h.

2021  {
2022  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TNodeI TNEANet::GetNI ( const int &  NId) const
inline

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

Definition at line 1991 of file network.h.

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

Gets a vector IDs of all nodes in the graph.

Definition at line 653 of file network.cpp.

653  {
654  NIdV.Gen(GetNodes(), 0);
655  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
656  NIdV.Add(NodeH.GetKey(N));
657  }
658 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: network.h:1969
bool FNextKeyId(int &KeyId) const
Definition: hash.h:436
int FFirstKeyId() const
Definition: hash.h:236
THash< TInt, TNode > NodeH
Definition: network.h:1862
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:495
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
TNode& TNEANet::GetNode ( const int &  NId)
inlineprotected

Definition at line 1840 of file network.h.

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

Definition at line 1841 of file network.h.

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

Returns node attribute value, converted to Str type.

Definition at line 193 of file network.cpp.

193  {
194  if (NodeHI.GetDat().Val1 == IntType) {
195  return (this->VecOfIntVecsN.GetVal(
196  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
197  } else if(NodeHI.GetDat().Val1 == StrType) {
198  return this->VecOfStrVecsN.GetVal(
199  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId));
200  } else if (NodeHI.GetDat().Val1 == FltType) {
201  return (this->VecOfFltVecsN.GetVal(
202  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
203  }
204  return TStr::GetNullStr();
205 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
const TKey & GetKey() const
Definition: hash.h:71
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
const TDat & GetDat() const
Definition: hash.h:72
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TInt, TNode > NodeH
Definition: network.h:1862
int TNEANet::GetNodes ( ) const
inline

Returns the number of nodes in the graph.

Definition at line 1969 of file network.h.

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

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

Definition at line 2221 of file network.h.

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

Returns an ID of a random edge in the graph.

Definition at line 2219 of file network.h.

2219 { return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
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:402
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
TNodeI TNEANet::GetRndNI ( TRnd Rnd = TInt::Rnd)
inline

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

Definition at line 2217 of file network.h.

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

Returns an ID of a random node in the graph.

Definition at line 2215 of file network.h.

2215 { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TNode > NodeH
Definition: network.h:1862
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:402
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
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 1573 of file network.cpp.

1573  {
1574  if (!IsEdge(EId)) {
1575  return -1;
1576  }
1577  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1578 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 1580 of file network.cpp.

1580  {
1581  if (!IsEdge(EId)) {
1582  return -1;
1583  }
1584  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1585 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 2636 of file network.h.

2636  {
2637  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
2638  }
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:1573
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 2640 of file network.h.

2640  {
2641  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
2642  }
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:1573
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 1587 of file network.cpp.

1587  {
1588  if (!IsEdge(EId)) {
1589  return -1;
1590  }
1591  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1592 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 1594 of file network.cpp.

1594  {
1595  if (!IsEdge(EId)) {
1596  return -1;
1597  }
1598  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1599 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 2650 of file network.h.

2650  {
2651  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
2652  }
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:1573
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 2654 of file network.h.

2654  {
2655  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
2656  }
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:1573
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 1601 of file network.cpp.

1601  {
1602  if (!IsEdge(EId)) {
1603  return -1;
1604  }
1605  return SAttrE.GetSAttrDat(EId, AttrName, Val);
1606 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 1608 of file network.cpp.

1608  {
1609  if (!IsEdge(EId)) {
1610  return -1;
1611  }
1612  return SAttrE.GetSAttrDat(EId, AttrId, Val);
1613 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 2664 of file network.h.

2664  {
2665  return GetSAttrDatE(EdgeI.GetId(), AttrName, ValX);
2666  }
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:1573
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 2668 of file network.h.

2668  {
2669  return GetSAttrDatE(EdgeI.GetId(), AttrId, ValX);
2670  }
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:1573
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 1447 of file network.cpp.

1447  {
1448  if (!IsNode(NId)) {
1449  return -1;
1450  }
1451  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1452 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 1454 of file network.cpp.

1454  {
1455  if (!IsNode(NId)) {
1456  return -1;
1457  }
1458  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1459 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 2518 of file network.h.

2518  {
2519  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2520  }
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:1447
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 2522 of file network.h.

2522  {
2523  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
2524  }
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:1447
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 1461 of file network.cpp.

1461  {
1462  if (!IsNode(NId)) {
1463  return -1;
1464  }
1465  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1466 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 1468 of file network.cpp.

1468  {
1469  if (!IsNode(NId)) {
1470  return -1;
1471  }
1472  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1473 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 2532 of file network.h.

2532  {
2533  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2534  }
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:1447
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 2536 of file network.h.

2536  {
2537  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
2538  }
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:1447
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 1475 of file network.cpp.

1475  {
1476  if (!IsNode(NId)) {
1477  return -1;
1478  }
1479  return SAttrN.GetSAttrDat(NId, AttrName, Val);
1480 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 1482 of file network.cpp.

1482  {
1483  if (!IsNode(NId)) {
1484  return -1;
1485  }
1486  return SAttrN.GetSAttrDat(NId, AttrId, Val);
1487 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 2546 of file network.h.

2546  {
2547  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
2548  }
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:1447
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 2550 of file network.h.

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

Gets id and type for attribute with name Name.

Definition at line 1649 of file network.cpp.

1649  {
1650  return SAttrE.GetSAttrId(Name, AttrId, AttrType);
1651 }
TAttr SAttrE
Definition: network.h:1877
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 1523 of file network.cpp.

1523  {
1524  return SAttrN.GetSAttrId(Name, AttrId, AttrType);
1525 }
TAttr SAttrN
Definition: network.h:1876
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 1653 of file network.cpp.

1653  {
1654  return SAttrE.GetSAttrName(AttrId, Name, AttrType);
1655 }
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:1877
int TNEANet::GetSAttrNameN ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 1527 of file network.cpp.

1527  {
1528  return SAttrN.GetSAttrName(AttrId, Name, AttrType);
1529 }
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:1876
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 1629 of file network.cpp.

1629  {
1630  if (!IsEdge(EId)) {
1631  return -1;
1632  }
1633  SAttrE.GetSAttrV(EId, AttrType, AttrV);
1634  return 0;
1635 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
TAttr SAttrE
Definition: network.h:1877
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 2688 of file network.h.

2688  {
2689  return GetSAttrVE(EdgeI.GetId(), AttrType, AttrV);
2690  }
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:1629
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 1503 of file network.cpp.

1503  {
1504  if (!IsNode(NId)) {
1505  return -1;
1506  }
1507  SAttrN.GetSAttrV(NId, AttrType, AttrV);
1508  return 0;
1509 }
TAttr SAttrN
Definition: network.h:1876
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:1985
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 2571 of file network.h.

2571  {
2572  return GetSAttrVN(NodeI.GetId(), AttrType, AttrV);
2573  }
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:1503
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 1334 of file network.cpp.

1334  {
1335  PNEANet Net = TNEANet::New();
1336  for (int i = 0; i < 5; i++) { Net->AddNode(i); }
1337  Net->AddEdge(0,1); Net->AddEdge(0,2);
1338  Net->AddEdge(0,3); Net->AddEdge(0,4);
1339  Net->AddEdge(1,2); Net->AddEdge(1,2);
1340  return Net;
1341 }
Definition: bd.h:196
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
Definition: network.h:1940
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 2341 of file network.h.

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

Definition at line 1082 of file network.cpp.

1082  {
1083  return VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EdgeH.GetKeyId(EId)];
1084 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2308 of file network.h.

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

Definition at line 1046 of file network.cpp.

1046  {
1047  return VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NodeH.GetKeyId(NId)];
1048 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1862
TStr TNEANet::GetStrAttrDefaultE ( const TStr attribute) const
inlineprotected

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

Definition at line 1855 of file network.h.

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

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

Definition at line 1849 of file network.h.

1849 { return StrDefaultsN.IsKey(attribute) ? StrDefaultsN.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 2366 of file network.h.

2366 { 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:2366
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 1094 of file network.cpp.

1094  {
1095  return VecOfStrVecsE[index][EdgeH.GetKeyId(EId)];
1096 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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 2328 of file network.h.

2328 { 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:2328
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 1058 of file network.cpp.

1058  {
1059  return VecOfStrVecsN[index][NodeH.GetKeyId(NId)];
1060 }
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TNode > NodeH
Definition: network.h:1862
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 1371 of file network.cpp.

1371  {
1372  TNode Node = GetNode(NI.GetId());
1373  TIntV OutEIdV = Node.OutEIdV;
1374  TFlt total = 0;
1375  int len = Node.OutEIdV.Len();
1376  for (int i = 0; i < len; i++) {
1377  total += GetFltAttrDatE(Node.OutEIdV[i], attr);
1378  }
1379  return total;
1380 }
TNode & GetNode(const int &NId)
Definition: network.h:1840
TFlt GetFltAttrDatE(const TEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: network.h:2344
Definition: dt.h:1293
void TNEANet::GetWeightOutEdgesV ( TFltV OutWeights,
const TFltV AttrVal 
)

Fills OutWeights with the outgoing weight from each node.

Definition at line 1382 of file network.cpp.

1382  {
1383  for (TEdgeI it = BegEI(); it < EndEI(); it++) {
1384  int EId = it.GetId();
1385  int SrcId = it.GetSrcNId();
1386  OutWeights[SrcId] +=AttrVal[GetFltKeyIdE(EId)];
1387  }
1388 }
int GetFltKeyIdE(const int &EId)
Gets keyid for edge with id EId.
Definition: network.cpp:1034
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2206
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2208
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 3 of file network.cpp.

3  {
4  return HasGraphFlag(TNEANet::TNet, Flag);
5 }
#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:1591
void TNEANet::IntAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 2088 of file network.h.

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

Definition at line 227 of file network.cpp.

227  {
228  Names = TVec<TStr>();
229  while (!EdgeHI.IsEnd()) {
230  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
231  Names.Add(EdgeHI.GetKey());
232  }
233  EdgeHI++;
234  }
235 }
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:343
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2043 of file network.h.

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

Definition at line 45 of file network.cpp.

45  {
46  Names = TVec<TStr>();
47  while (!NodeHI.IsEnd()) {
48  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
49  Names.Add(NodeHI.GetKey());
50  }
51  NodeHI++;
52  }
53 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
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:161
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2092 of file network.h.

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

Definition at line 237 of file network.cpp.

237  {
238  Values = TVec<TInt>();
239  while (!EdgeHI.IsEnd()) {
240  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
241  TInt val = (this->VecOfIntVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
242  Values.Add(val);
243  }
244  EdgeHI++;
245  }
246 }
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:343
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
Definition: dt.h:1044
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntAttrValueNI ( const TInt NId,
TIntV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2047 of file network.h.

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

Definition at line 55 of file network.cpp.

55  {
56  Values = TVec<TInt>();
57  while (!NodeHI.IsEnd()) {
58  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
59  TInt val = this->VecOfIntVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
60  Values.Add(val);
61  }
62  NodeHI++;
63  }
64 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
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:161
THash< TInt, TNode > NodeH
Definition: network.h:1862
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntVAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 2098 of file network.h.

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

Definition at line 248 of file network.cpp.

248  {
249  Names = TVec<TStr>();
250  while (!EdgeHI.IsEnd()) {
251  if (EdgeHI.GetDat().Val1 == IntVType) {
252  Names.Add(EdgeHI.GetKey());
253  }
254  EdgeHI++;
255  }
256 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntVAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2053 of file network.h.

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

Definition at line 66 of file network.cpp.

66  {
67  Names = TVec<TStr>();
68  while (!NodeHI.IsEnd()) {
69  if (NodeHI.GetDat().Val1 == IntVType) {
70  Names.Add(NodeHI.GetKey());
71  }
72  NodeHI++;
73  }
74 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntVAttrValueEI ( const TInt EId,
TVec< TIntV > &  Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 2102 of file network.h.

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

Definition at line 258 of file network.cpp.

258  {
259  Values = TVec<TIntV>();
260  while (!EdgeHI.IsEnd()) {
261  if (EdgeHI.GetDat().Val1 == IntVType) {
262  TIntV val = (this->VecOfIntVecVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
263  Values.Add(val);
264  }
265  EdgeHI++;
266  }
267 }
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::IntVAttrValueNI ( const TInt NId,
TVec< TIntV > &  Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2057 of file network.h.

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

Definition at line 76 of file network.cpp.

76  {
77  Values = TVec<TIntV>();
78  while (!NodeHI.IsEnd()) {
79  if (NodeHI.GetDat().Val1 == IntVType) {
80  TIntV val = this->VecOfIntVecVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
81  Values.Add(val);
82  }
83  NodeHI++;
84  }
85 }
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
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 311 of file network.cpp.

311  {
312  bool IntDel = IsIntAttrDeletedE(EId, attr);
313  bool IntVDel = IsIntVAttrDeletedE(EId, attr);
314  bool StrDel = IsStrAttrDeletedE(EId, attr);
315  bool FltDel = IsFltAttrDeletedE(EId, attr);
316  return IntDel || StrDel || FltDel || IntVDel;
317 }
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:331
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:319
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:327
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:323
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 129 of file network.cpp.

129  {
130  bool IntDel = IsIntAttrDeletedN(NId, attr);
131  bool StrDel = IsStrAttrDeletedN(NId, attr);
132  bool FltDel = IsFltAttrDeletedN(NId, attr);
133  bool IntVDel = IsIntVAttrDeletedN(NId, attr);
134  return IntDel || StrDel || FltDel || IntVDel;
135 }
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:145
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:149
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:137
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:141
bool TNEANet::IsEdge ( const int &  EId) const
inline

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

Definition at line 2198 of file network.h.

2198 { return EdgeH.IsKey(EId); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 2200 of file network.h.

2200 { 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:2198
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 632 of file network.cpp.

632  {
633  const TNode& SrcNode = GetNode(SrcNId);
634  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
635  const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
636  if (DstNId == Edge.GetDstNId()) {
637  EId = Edge.GetId();
638  return true;
639  }
640  }
641  if (! IsDir) {
642  for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
643  const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
644  if (DstNId == Edge.GetSrcNId()) {
645  EId = Edge.GetId();
646  return true;
647  }
648  }
649  }
650  return false;
651 }
int GetId() const
Definition: network.h:1626
TNode & GetNode(const int &NId)
Definition: network.h:1840
TEdge & GetEdge(const int &EId)
Definition: network.h:1842
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 331 of file network.cpp.

331  {
332  return EdgeAttrIsFltDeleted(EId, KeyToIndexTypeE.GetI(attr));
333 }
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:361
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TIter GetI(const TKey &Key) const
Definition: hash.h:178
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 149 of file network.cpp.

149  {
150  return NodeAttrIsFltDeleted(NId, KeyToIndexTypeN.GetI(attr));
151 }
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:185
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TNEANet::IsFltAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1390 of file network.cpp.

1390  {
1391  return (KeyToIndexTypeE.IsKey(attr) &&
1392  KeyToIndexTypeE.GetDat(attr).Val1 == FltType);
1393 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 319 of file network.cpp.

319  {
320  return EdgeAttrIsIntDeleted(EId, KeyToIndexTypeE.GetI(attr));
321 }
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:343
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TIter GetI(const TKey &Key) const
Definition: hash.h:178
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 137 of file network.cpp.

137  {
138  return NodeAttrIsIntDeleted(NId, KeyToIndexTypeN.GetI(attr));
139 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
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:161
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TNEANet::IsIntAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1395 of file network.cpp.

1395  {
1396  return (KeyToIndexTypeE.IsKey(attr) &&
1397  KeyToIndexTypeE.GetDat(attr).Val1 == IntType);
1398 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 323 of file network.cpp.

323  {
324  return EdgeAttrIsIntVDeleted(EId, KeyToIndexTypeE.GetI(attr));
325 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
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:349
TIter GetI(const TKey &Key) const
Definition: hash.h:178
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 141 of file network.cpp.

141  {
142  return NodeAttrIsIntVDeleted(NId, KeyToIndexTypeN.GetI(attr));
143 }
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:169
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TNEANet::IsNode ( const int &  NId) const
inline

Tests whether ID NId is a node.

Definition at line 1985 of file network.h.

1985 { return NodeH.IsKey(NId); }
THash< TInt, TNode > NodeH
Definition: network.h:1862
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 676 of file network.cpp.

676  {
677  bool RetVal = true;
678  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
679  const TNode& Node = NodeH[N];
680  if (! Node.OutEIdV.IsSorted()) {
681  const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
682  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
683  }
684  if (! Node.InEIdV.IsSorted()) {
685  const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
686  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
687  }
688  // check out-edge ids
689  int prevEId = -1;
690  for (int e = 0; e < Node.GetOutDeg(); e++) {
691  if (! IsEdge(Node.GetOutEId(e))) {
692  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetOutEId(e), Node.GetId());
693  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
694  }
695  if (e > 0 && prevEId == Node.GetOutEId(e)) {
696  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
697  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
698  }
699  prevEId = Node.GetOutEId(e);
700  }
701  // check in-edge ids
702  prevEId = -1;
703  for (int e = 0; e < Node.GetInDeg(); e++) {
704  if (! IsEdge(Node.GetInEId(e))) {
705  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetInEId(e), Node.GetId());
706  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
707  }
708  if (e > 0 && prevEId == Node.GetInEId(e)) {
709  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
710  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
711  }
712  prevEId = Node.GetInEId(e);
713  }
714  }
715  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
716  const TEdge& Edge = EdgeH[E];
717  if (! IsNode(Edge.GetSrcNId())) {
718  const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
719  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
720  }
721  if (! IsNode(Edge.GetDstNId())) {
722  const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
723  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
724  }
725  }
726  return RetVal;
727 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2198
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
bool FNextKeyId(int &KeyId) const
Definition: hash.h:436
int FFirstKeyId() const
Definition: hash.h:236
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:1985
THash< TInt, TNode > NodeH
Definition: network.h:1862
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 327 of file network.cpp.

327  {
328  return EdgeAttrIsStrDeleted(EId, KeyToIndexTypeE.GetI(attr));
329 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
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:355
TIter GetI(const TKey &Key) const
Definition: hash.h:178
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 145 of file network.cpp.

145  {
146  return NodeAttrIsStrDeleted(NId, KeyToIndexTypeN.GetI(attr));
147 }
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:177
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TNEANet::IsStrAttrE ( const TStr attr)

Checks if there is an edge attribute with name attr.

Definition at line 1400 of file network.cpp.

1400  {
1401  return (KeyToIndexTypeE.IsKey(attr) &&
1402  KeyToIndexTypeE.GetDat(attr).Val1 == StrType);
1403 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 1946 of file network.h.

1946 { return PNEANet(new TNEANet(SIn)); }
TNEANet()
Definition: network.h:1880
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1570
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 1948 of file network.h.

1948  {
1949  PNEANet Graph = PNEANet(new TNEANet());
1950  Graph->MxNId.Load(SIn); Graph->MxEId.Load(SIn);
1951  Graph->NodeH.Load(SIn); Graph->EdgeH.Load(SIn);
1952  Graph->KeyToIndexTypeN.Load(SIn); Graph->KeyToIndexTypeE.Load(SIn);
1953  Graph->IntDefaultsN.Load(SIn); Graph->IntDefaultsE.Load(SIn);
1954  Graph->StrDefaultsN.Load(SIn); Graph->StrDefaultsE.Load(SIn);
1955  Graph->FltDefaultsN.Load(SIn); Graph->FltDefaultsE.Load(SIn);
1956  Graph->VecOfIntVecsN.Load(SIn); Graph->VecOfIntVecsE.Load(SIn);
1957  Graph->VecOfStrVecsN.Load(SIn); Graph->VecOfStrVecsE.Load(SIn);
1958  Graph->VecOfFltVecsN.Load(SIn); Graph->VecOfFltVecsE.Load(SIn);
1959  return Graph;
1960  }
TNEANet()
Definition: network.h:1880
Definition: bd.h:196
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1570
static PNEANet TNEANet::New ( )
inlinestatic

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

Definition at line 1940 of file network.h.

1940 { return PNEANet(new TNEANet()); }
TNEANet()
Definition: network.h:1880
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1570
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 1944 of file network.h.

1944 { return PNEANet(new TNEANet(Nodes, Edges)); }
TNEANet()
Definition: network.h:1880
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1570
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 153 of file network.cpp.

153  {
154  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
155  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
156  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
157  bool IntVDel = NodeAttrIsIntVDeleted(NId, NodeHI);
158  return IntDel || StrDel || FltDel || IntVDel;
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:177
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:169
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:185
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:161
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 185 of file network.cpp.

185  {
186  if (NodeHI.GetDat().Val1 != FltType) {
187  return false;
188  }
189  return (GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
190  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
191 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TInt, TNode > NodeH
Definition: network.h:1862
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Gets Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1851
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 161 of file network.cpp.

161  {
162  if (NodeHI.GetDat().Val1 != IntType) {
163  return false;
164  }
165  return (GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
166  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
167 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
const TKey & GetKey() const
Definition: hash.h:71
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TNode > NodeH
Definition: network.h:1862
TInt GetIntAttrDefaultN(const TStr &attribute) const
Gets Int node attribute val. If not a proper attr, return default.
Definition: network.h:1847
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 169 of file network.cpp.

169  {
170  if (NodeHI.GetDat().Val1 != IntVType) {
171  return false;
172  }
173  return (TIntV() == this->VecOfIntVecVecsN.GetVal(
174  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
175 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
const TKey & GetKey() const
Definition: hash.h:71
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TInt > TIntV
Definition: ds.h:1529
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
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 177 of file network.cpp.

177  {
178  if (NodeHI.GetDat().Val1 != StrType) {
179  return false;
180  }
181  return (GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
182  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
183 }
const TKey & GetKey() const
Definition: hash.h:71
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
const TDat & GetDat() const
Definition: hash.h:72
TStr GetStrAttrDefaultN(const TStr &attribute) const
Gets Str node attribute val. If not a proper attr, return default.
Definition: network.h:1849
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TNode > NodeH
Definition: network.h:1862
TNEANet& TNEANet::operator= ( const TNEANet Graph)
inline

Definition at line 1964 of file network.h.

1964  { if (this!=&Graph) {
1965  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH; }
1966  return *this; }
TInt MxNId
Definition: network.h:1861
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TInt MxEId
Definition: network.h:1861
THash< TInt, TNode > NodeH
Definition: network.h:1862
void TNEANet::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

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

Definition at line 2237 of file network.h.

2237  {
2238  if (Nodes>0) { NodeH.Gen(Nodes/2); } if (Edges>0) { EdgeH.Gen(Edges/2); } }
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
void Gen(const int &ExpectVals)
Definition: hash.h:180
THash< TInt, TNode > NodeH
Definition: network.h:1862
void TNEANet::Save ( TSOut SOut) const
inline

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

Definition at line 1918 of file network.h.

1918  {
1919  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
1921  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
1922  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
1923  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
1924  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
1925  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
1926  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut);
1927  VecOfIntVecVecsN.Save(SOut); VecOfIntVecVecsE.Save(SOut);
1928  SAttrN.Save(SOut); SAttrE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
void Save(TSOut &SOut) const
Definition: dt.h:1060
void Save(TSOut &SOut) const
Definition: hash.h:141
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
void Save(TSOut &SOut) const
Definition: ds.h:903
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:25
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
void TNEANet::Save_V1 ( TSOut SOut) const
inline

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

Definition at line 1930 of file network.h.

1930  {
1931  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
1933  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
1934  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
1935  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
1936  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
1937  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
1938  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
void Save(TSOut &SOut) const
Definition: dt.h:1060
void Save(TSOut &SOut) const
Definition: hash.h:141
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
void Save(TSOut &SOut) const
Definition: ds.h:903
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TInt MxEId
Definition: network.h:1861
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
void TNEANet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 2108 of file network.h.

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

Definition at line 269 of file network.cpp.

269  {
270  Names = TVec<TStr>();
271  while (!EdgeHI.IsEnd()) {
272  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
273  Names.Add(EdgeHI.GetKey());
274  }
275  EdgeHI++;
276  }
277 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
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:355
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::StrAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 2063 of file network.h.

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

Definition at line 87 of file network.cpp.

87  {
88  Names = TVec<TStr>();
89  while (!NodeHI.IsEnd()) {
90  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
91  Names.Add(NodeHI.GetKey());
92  }
93  NodeHI++;
94  }
95 }
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:177
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2112 of file network.h.

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

Definition at line 279 of file network.cpp.

279  {
280  Values = TVec<TStr>();
281  while (!EdgeHI.IsEnd()) {
282  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
283  TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
284  Values.Add(val);
285  }
286  EdgeHI++;
287  }
288 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
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:355
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TNEANet::StrAttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2067 of file network.h.

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

Definition at line 97 of file network.cpp.

97  {
98  Values = TVec<TStr>();
99  while (!NodeHI.IsEnd()) {
100  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
101  TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
102  Values.Add(val);
103  }
104  NodeHI++;
105  }
106 }
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:177
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
Definition: dt.h:412
THash< TInt, TNode > NodeH
Definition: network.h:1862
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574

Friends And Related Function Documentation

friend class TPt< TNEANet >
friend

Definition at line 2711 of file network.h.

Member Data Documentation

TCRef TNEANet::CRef

Definition at line 1859 of file network.h.

THash<TInt, TEdge> TNEANet::EdgeH
protected

Definition at line 1863 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsE
protected

Definition at line 1869 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsN
protected

Definition at line 1869 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsE
protected

Definition at line 1867 of file network.h.

THash<TStr, TInt> TNEANet::IntDefaultsN
protected

Definition at line 1867 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeE
protected

Definition at line 1865 of file network.h.

TStrIntPrH TNEANet::KeyToIndexTypeN
protected

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

Definition at line 1865 of file network.h.

TInt TNEANet::MxEId
protected

Definition at line 1861 of file network.h.

TInt TNEANet::MxNId
protected

Definition at line 1861 of file network.h.

THash<TInt, TNode> TNEANet::NodeH
protected

Definition at line 1862 of file network.h.

TAttr TNEANet::SAttrE
protected

Definition at line 1877 of file network.h.

TAttr TNEANet::SAttrN
protected

Definition at line 1876 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsE
protected

Definition at line 1868 of file network.h.

THash<TStr, TStr> TNEANet::StrDefaultsN
protected

Definition at line 1868 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsE
protected

Definition at line 1872 of file network.h.

TVec<TFltV> TNEANet::VecOfFltVecsN
protected

Definition at line 1872 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsE
protected

Definition at line 1870 of file network.h.

TVec<TIntV> TNEANet::VecOfIntVecsN
protected

Definition at line 1870 of file network.h.

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

Definition at line 1873 of file network.h.

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

Definition at line 1873 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsE
protected

Definition at line 1871 of file network.h.

TVec<TStrV> TNEANet::VecOfStrVecsN
protected

Definition at line 1871 of file network.h.


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