SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
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>

Collaboration diagram for TNEANet:

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  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. 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 &NodeId)
 Adds a node of ID NodeI.GetId() to the graph. More...
 
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...
 
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 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 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...
 
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 &NodeId, 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 &NodeId, 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 &NodeId, 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 AddIntAttrDatE (const TEdgeI &EdgeId, 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 &EdgeId, 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 &EdgeId, 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)
 
TInt GetIntAttrDatN (const TNodeI &NodeId, 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 &NodeId, 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 &NodeId, const TStr &attr)
 Gets the value of flt attr from the node attr value vector. More...
 
TFlt GetFltAttrDatN (const int &NId, const TStr &attr)
 
int GetIntAttrIndN (const TStr &attr)
 Gets the index of the node attr value vector specified by str attr. More...
 
TInt GetIntAttrIndDatN (const TNodeI &NodeId, const int &index)
 Gets the value of node int attr specified by the attr index. More...
 
TInt GetIntAttrIndDatN (const int &NId, const int &index)
 
TInt GetIntAttrDatE (const TEdgeI &EdgeId, 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 &EdgeId, 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 &EdgeId, const TStr &attr)
 Gets the value of flt attr from the edge attr value vector. More...
 
TFlt GetFltAttrDatE (const int &EId, const TStr &attr)
 
int GetIntAttrIndE (const TStr &attr)
 Gets the index of the edge attr value vector specified by str attr. More...
 
TInt GetIntAttrIndDatE (const TEdgeI &EdgeId, const int &index)
 Gets the value of edge int attr specified by the attr index. More...
 
TInt GetIntAttrIndDatE (const int &EId, const int &index)
 
int DelAttrDatN (const TNodeI &NodeId, const TStr &attr)
 Deletes the node attribute for NodeId. More...
 
int DelAttrDatN (const int &NId, const TStr &attr)
 
int DelAttrDatE (const TEdgeI &EdgeId, const TStr &attr)
 Deletes the edge attribute for NodeId. 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 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 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 NodeAttrIsDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 
bool NodeAttrIsIntDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 
bool NodeAttrIsStrDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 
bool NodeAttrIsFltDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 
bool EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 
bool EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 
bool EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 
bool EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 
TStr GetNodeAttrValue (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 
TStr GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 

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 GetSmallGraph ()
 Returns a small multigraph on 5 nodes and 6 edges. More...
 

Private Types

enum  { IntType, StrType, FltType }
 

Private 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
 Get Int node attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultN (const TStr &attribute) const
 Get Str node attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultN (const TStr &attribute) const
 Get Flt node attribute val. If not a proper attr, return default. More...
 
TInt GetIntAttrDefaultE (const TStr &attribute) const
 Get Int edge attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultE (const TStr &attribute) const
 Get Str edge attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultE (const TStr &attribute) const
 Get Flt edge attribute val. If not a proper attr, return default. More...
 

Private Attributes

TCRef CRef
 
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
 

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 1587 of file network.h.

Member Typedef Documentation

Definition at line 1590 of file network.h.

Definition at line 1589 of file network.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
IntType 
StrType 
FltType 

Definition at line 1840 of file network.h.

Constructor & Destructor Documentation

TNEANet::TNEANet ( )
inline

Definition at line 1842 of file network.h.

Referenced by Load(), and New().

1842  : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
1846  VecOfFltVecsN(), VecOfFltVecsE() { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TCRef CRef
Definition: network.h:1827
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the caller graph for this function:

TNEANet::TNEANet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

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

Definition at line 1848 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::Reserve().

1848  : CRef(),
1853  { Reserve(Nodes, Edges); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: network.h:2106
TCRef CRef
Definition: network.h:1827
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TNEANet::TNEANet ( const TNEANet Graph)
inline

Definition at line 1854 of file network.h.

1854  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
1855  NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(), KeyToIndexTypeE(),
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829
TNEANet::TNEANet ( TSIn SIn)
inline

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

Definition at line 1860 of file network.h.

1860  : MxNId(SIn), MxEId(SIn), NodeH(SIn), EdgeH(SIn),
1862  StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
1864  VecOfFltVecsN(SIn), VecOfFltVecsE(SIn) { }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829

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

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::AddSorted(), EdgeH, FltDefaultsE, TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), GetIntAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), THash< TKey, TDat, THashFunc >::GetKeyV(), GetNode(), TStr::GetNullStr(), GetStrAttrDefaultE(), IAssertR, TNEANet::TNode::InEIdV, TVec< TVal, TSizeTy >::Ins(), IntDefaultsE, IsEdge(), IsNode(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, TMath::Mx(), MxEId, NodeH, TNEANet::TNode::OutEIdV, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

375  {
376  int i;
377 
378  if (EId == -1) { EId = MxEId; MxEId++; }
379  else { MxEId = TMath::Mx(EId+1, MxEId()); }
380  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
381  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
382  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
383  GetNode(SrcNId).OutEIdV.AddSorted(EId);
384  GetNode(DstNId).InEIdV.AddSorted(EId);
385 
386  // update attribute columns
387  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
388  TVec<TInt>& IntVec = VecOfIntVecsE[i];
389  IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
390  }
391  TVec<TStr> DefIntVec = TVec<TStr>();
392  IntDefaultsE.GetKeyV(DefIntVec);
393  for (i = 0; i < DefIntVec.Len(); i++) {
394  TStr attr = DefIntVec[i];
395  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
396  IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
397  }
398 
399  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
400  TVec<TStr>& StrVec = VecOfStrVecsE[i];
401  StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
402  }
403  TVec<TStr> DefStrVec = TVec<TStr>();
404  IntDefaultsE.GetKeyV(DefStrVec);
405  for (i = 0; i < DefStrVec.Len(); i++) {
406  TStr attr = DefStrVec[i];
407  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
408  StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
409  }
410 
411  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
412  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
413  FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
414  }
415  TVec<TStr> DefFltVec = TVec<TStr>();
416  FltDefaultsE.GetKeyV(DefFltVec);
417  for (i = 0; i < DefFltVec.Len(); i++) {
418  TStr attr = DefFltVec[i];
419  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
420  FltVec[NodeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
421  }
422  return EId;
423 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TNode & GetNode(const int &NId)
Definition: network.h:1808
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1820
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
TIntV OutEIdV
Definition: network.h:1595
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1027
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
static const int Mn
Definition: dt.h:1045
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1822
static TStr GetNullStr()
Definition: dt.cpp:1626
TInt MxEId
Definition: network.h:1828
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1824
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:438
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
TIntV InEIdV
Definition: network.h:1595
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
static const double Mn
Definition: dt.h:1293

Here is the call graph for this function:

int TNEANet::AddEdge ( const TEdgeI EdgeI)
inline

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

Definition at line 2058 of file network.h.

References AddEdge(), TNEANet::TEdgeI::GetDstNId(), TNEANet::TEdgeI::GetId(), and TNEANet::TEdgeI::GetSrcNId().

Referenced by AddEdge().

2058 { 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:375

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatE ( const TEdgeI EdgeId,
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 2152 of file network.h.

References AddFltAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddFltAttrDatE().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 730 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

730  {
731  int i;
732  TInt CurrLen;
733 
734  if (!IsEdge(EId)) {
735  //AddEdge(EId);
736  return -1;
737  }
738  if (KeyToIndexTypeE.IsKey(attr)) {
740  NewVec[EdgeH.GetKeyId(EId)] = value;
741  } else {
742  CurrLen = VecOfFltVecsE.Len();
743  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
744  TVec<TFlt> NewVec = TVec<TFlt>();
745  for (i = 0; i < MxEId; i++) {
746  NewVec.Ins(i, GetFltAttrDefaultE(attr));
747  }
748  NewVec[EdgeH.GetKeyId(EId)] = value;
749  VecOfFltVecsE.Add(NewVec);
750  }
751  return 0;
752 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1824
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

Here is the call graph for this function:

int TNEANet::AddFltAttrDatN ( const TNodeI NodeId,
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 2136 of file network.h.

References AddFltAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddFltAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 660 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

660  {
661  int i;
662  TInt CurrLen;
663 
664  if (!IsNode(NId)) {
665  // AddNode(NId);
666  return -1;
667  }
668  if (KeyToIndexTypeN.IsKey(attr)) {
670  NewVec[NodeH.GetKeyId(NId)] = value;
671  } else {
672  CurrLen = VecOfFltVecsN.Len();
673  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
674  TVec<TFlt> NewVec = TVec<TFlt>();
675  for (i = 0; i < MxNId; i++) {
676  NewVec.Ins(i, GetFltAttrDefaultN(attr));
677  }
678  NewVec[NodeH.GetKeyId(NId)] = value;
679  VecOfFltVecsN.Add(NewVec);
680  }
681  return 0;
682 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1828
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1818
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 920 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsE, FltType, TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, VecOfFltVecsE, and VecOfStrVecsE.

920  {
921  int i;
922  TInt CurrLen;
923  TVec<TFlt> NewVec;
924  CurrLen = VecOfStrVecsE.Len();
925  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
926  NewVec = TVec<TFlt>();
927  for (i = 0; i < MxEId; i++) {
928  NewVec.Ins(i, defaultValue);
929  }
930  VecOfFltVecsE.Add(NewVec);
931  if (!FltDefaultsE.IsKey(attr)) {
932  FltDefaultsE.AddDat(attr, defaultValue);
933  } else {
934  return -1;
935  }
936  return 0;
937 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 861 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsN, FltType, TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, MxNId, VecOfFltVecsN, and VecOfStrVecsN.

861  {
862  // TODO(nkhadke): add error checking
863  int i;
864  TInt CurrLen;
865  TVec<TFlt> NewVec;
866  CurrLen = VecOfStrVecsN.Len();
867  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
868  NewVec = TVec<TFlt>();
869  for (i = 0; i < MxNId; i++) {
870  NewVec.Ins(i, defaultValue);
871  }
872  VecOfFltVecsN.Add(NewVec);
873  if (!FltDefaultsN.IsKey(attr)) {
874  FltDefaultsN.AddDat(attr, defaultValue);
875  } else {
876  return -1;
877  }
878  return 0;
879 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddIntAttrDatE ( const TEdgeI EdgeId,
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 2142 of file network.h.

References AddIntAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddIntAttrDatE().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 684 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), GetIntAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IntType, IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

684  {
685  int i;
686  TInt CurrLen;
687  if (!IsEdge(EId)) {
688  //AddEdge(EId);
689  return -1;
690  }
691  if (KeyToIndexTypeE.IsKey(attr)) {
693  NewVec[EdgeH.GetKeyId(EId)] = value;
694  } else {
695  CurrLen = VecOfIntVecsE.Len();
696  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
697  TVec<TInt> NewVec = TVec<TInt>();
698  for (i = 0; i < MxEId; i++) {
699  NewVec.Ins(i, GetIntAttrDefaultE(attr));
700  }
701  NewVec[EdgeH.GetKeyId(EId)] = value;
702  VecOfIntVecsE.Add(NewVec);
703  }
704  return 0;
705 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1820
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
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

Here is the call graph for this function:

int TNEANet::AddIntAttrDatN ( const TNodeI NodeId,
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 2126 of file network.h.

References AddIntAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddIntAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddIntAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 614 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDat(), GetIntAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IntType, THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

614  {
615  int i;
616  TInt CurrLen;
617  if (!IsNode(NId)) {
618  // AddNode(NId);
619  return -1;
620  }
621  if (KeyToIndexTypeN.IsKey(attr)) {
623  NewVec[NodeH.GetKeyId(NId)] = value;
624  } else {
625  CurrLen = VecOfIntVecsN.Len();
626  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
627  TVec<TInt> NewVec = TVec<TInt>();
628  for (i = 0; i < MxNId; i++) {
629  NewVec.Ins(i, GetIntAttrDefaultN(attr));
630  }
631  NewVec[NodeH.GetKeyId(NId)] = value;
632  VecOfIntVecsN.Add(NewVec);
633  }
634  return 0;
635 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1828
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: network.h:1814
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 881 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), IntDefaultsE, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, and VecOfIntVecsE.

881  {
882  // TODO(nkhadke): add error checking
883  int i;
884  TInt CurrLen;
885  TVec<TInt> NewVec;
886  CurrLen = VecOfIntVecsE.Len();
887  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
888  NewVec = TVec<TInt>();
889  for (i = 0; i < MxEId; i++) {
890  NewVec.Ins(i, defaultValue);
891  }
892  VecOfIntVecsE.Add(NewVec);
893  if (!IntDefaultsE.IsKey(attr)) {
894  IntDefaultsE.AddDat(attr, defaultValue);
895  } else {
896  return -1;
897  }
898  return 0;
899 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddIntAttrN ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int node attribute to the hashmap.

Definition at line 823 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), IntDefaultsN, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, MxNId, and VecOfIntVecsN.

823  {
824  int i;
825  TInt CurrLen;
826  TVec<TInt> NewVec;
827  CurrLen = VecOfIntVecsN.Len();
828  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
829  NewVec = TVec<TInt>();
830  for (i = 0; i < MxNId; i++) {
831  NewVec.Ins(i, defaultValue);
832  }
833  VecOfIntVecsN.Add(NewVec);
834  if (!IntDefaultsN.IsKey(attr)) {
835  IntDefaultsN.AddDat(attr, defaultValue);
836  } else {
837  return -1;
838  }
839  return 0;
840 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1828
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

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

References THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsN, TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), GetIntAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), THash< TKey, TDat, THashFunc >::GetKeyV(), TStr::GetNullStr(), GetStrAttrDefaultN(), IAssertR, TVec< TVal, TSizeTy >::Ins(), IntDefaultsN, IsNode(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, TMath::Mx(), MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

269  {
270  int i;
271  if (NId == -1) {
272  NId = MxNId; MxNId++;
273  } else {
274  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
275  MxNId = TMath::Mx(NId+1, MxNId());
276  }
277  // update attribute columns
278  NodeH.AddDat(NId, TNode(NId));
279  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
280  TVec<TInt>& IntVec = VecOfIntVecsN[i];
281  IntVec.Ins(NodeH.GetKeyId(NId), TInt::Mn);
282  }
283  TVec<TStr> DefIntVec = TVec<TStr>();
284  IntDefaultsN.GetKeyV(DefIntVec);
285  for (i = 0; i < DefIntVec.Len(); i++) {
286  TStr attr = DefIntVec[i];
287  TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
288  IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
289  }
290  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
291  TVec<TStr>& StrVec = VecOfStrVecsN[i];
292  StrVec.Ins(NodeH.GetKeyId(NId), TStr::GetNullStr());
293  }
294  TVec<TStr> DefStrVec = TVec<TStr>();
295  IntDefaultsN.GetKeyV(DefStrVec);
296  for (i = 0; i < DefStrVec.Len(); i++) {
297  TStr attr = DefStrVec[i];
298  TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
299  StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
300  }
301  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
302  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
303  FltVec.Ins(NodeH.GetKeyId(NId), TFlt::Mn);
304  }
305  TVec<TStr> DefFltVec = TVec<TStr>();
306  FltDefaultsN.GetKeyV(DefFltVec);
307  for (i = 0; i < DefFltVec.Len(); i++) {
308  TStr attr = DefFltVec[i];
309  TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
310  FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
311  }
312  return NId;
313 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
#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:535
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
static const int Mn
Definition: dt.h:1045
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: network.h:1816
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:438
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1818
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: network.h:1814
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
static const double Mn
Definition: dt.h:1293

Here is the call graph for this function:

int TNEANet::AddNode ( const TNodeI NodeId)
inline

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

Definition at line 1898 of file network.h.

References AddNode(), and TNEANet::TNodeI::GetId().

Referenced by AddNode().

1898 { return AddNode(NodeId.GetId()); }
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
Definition: network.cpp:269

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatE ( const TEdgeI EdgeId,
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 2147 of file network.h.

References AddStrAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddStrAttrDatE().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 707 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultE(), TVec< TVal, TSizeTy >::Ins(), IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, StrType, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

707  {
708  int i;
709  TInt CurrLen;
710  if (!IsEdge(EId)) {
711  //AddEdge(EId);
712  return -1;
713  }
714  if (KeyToIndexTypeE.IsKey(attr)) {
716  NewVec[EdgeH.GetKeyId(EId)] = value;
717  } else {
718  CurrLen = VecOfStrVecsE.Len();
719  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
720  TVec<TStr> NewVec = TVec<TStr>();
721  for (i = 0; i < MxEId; i++) {
722  NewVec.Ins(i, GetStrAttrDefaultE(attr));
723  }
724  NewVec[EdgeH.GetKeyId(EId)] = value;
725  VecOfStrVecsE.Add(NewVec);
726  }
727  return 0;
728 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1822
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
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

Here is the call graph for this function:

int TNEANet::AddStrAttrDatN ( const TNodeI NodeId,
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 2131 of file network.h.

References AddStrAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddStrAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatN ( const int &  NId,
const TStr value,
const TStr attr 
)

Definition at line 637 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultN(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, MxNId, NodeH, StrType, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

637  {
638  int i;
639  TInt CurrLen;
640  if (!IsNode(NId)) {
641  // AddNode(NId);
642  return -1;
643  }
644  if (KeyToIndexTypeN.IsKey(attr)) {
646  NewVec[NodeH.GetKeyId(NId)] = value;
647  } else {
648  CurrLen = VecOfStrVecsN.Len();
649  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
650  TVec<TStr> NewVec = TVec<TStr>();
651  for (i = 0; i < MxNId; i++) {
652  NewVec.Ins(i, GetStrAttrDefaultN(attr));
653  }
654  NewVec[NodeH.GetKeyId(NId)] = value;
655  VecOfStrVecsN.Add(NewVec);
656  }
657  return 0;
658 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1828
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: network.h:1816
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TVal2 Val2
Definition: ds.h:35
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 901 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, MxEId, StrDefaultsE, StrType, and VecOfStrVecsE.

901  {
902  int i;
903  TInt CurrLen;
904  TVec<TStr> NewVec;
905  CurrLen = VecOfStrVecsE.Len();
906  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
907  NewVec = TVec<TStr>();
908  for (i = 0; i < MxEId; i++) {
909  NewVec.Ins(i, defaultValue);
910  }
911  VecOfStrVecsE.Add(NewVec);
912  if (!StrDefaultsE.IsKey(attr)) {
913  StrDefaultsE.AddDat(attr, defaultValue);
914  } else {
915  return -1;
916  }
917  return 0;
918 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
TInt MxEId
Definition: network.h:1828
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

int TNEANet::AddStrAttrN ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str node attribute to the hashmap.

Definition at line 842 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, MxNId, StrDefaultsN, StrType, and VecOfStrVecsN.

842  {
843  int i;
844  TInt CurrLen;
845  TVec<TStr> NewVec;
846  CurrLen = VecOfStrVecsN.Len();
847  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
848  NewVec = TVec<TStr>();
849  for (i = 0; i < MxNId; i++) {
850  NewVec.Ins(i, defaultValue);
851  }
852  VecOfStrVecsN.Add(NewVec);
853  if (!StrDefaultsN.IsKey(attr)) {
854  StrDefaultsN.AddDat(attr, defaultValue);
855  } else {
856  return -1;
857  }
858  return 0;
859 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TInt MxNId
Definition: network.h:1828
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
Definition: dt.h:1041
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196

Here is the call graph for this function:

void TNEANet::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 1976 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

1976  {
1977  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:1976
TIter BegI() const
Definition: hash.h:171
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832

Here is the call graph for this function:

void TNEANet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 147 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsDeleted(), THashKeyDatI< TKey, TDat >::GetKey(), and THashKeyDatI< TKey, TDat >::IsEnd().

147  {
148  Names = TVec<TStr>();
149  while (!EdgeHI.IsEnd()) {
150  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
151  Names.Add(EdgeHI.GetKey());
152  }
153  EdgeHI++;
154  }
155 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:230
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:559

Here is the call graph for this function:

void TNEANet::AttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of attr names for node NId.

Definition at line 1943 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

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

Here is the call graph for this function:

void TNEANet::AttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 25 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsDeleted().

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
Definition: network.cpp:108
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:559

Here is the call graph for this function:

void TNEANet::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 1980 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

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

Here is the call graph for this function:

void TNEANet::AttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 157 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsDeleted(), GetNodeAttrValue(), and THashKeyDatI< TKey, TDat >::IsEnd().

157  {
158  Values = TVec<TStr>();
159  while (!EdgeHI.IsEnd()) {
160  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
161  Values.Add(GetNodeAttrValue(EId, EdgeHI));
162  }
163  EdgeHI++;
164  }
165 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:230
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
Definition: network.cpp:133
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

void TNEANet::AttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 1947 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

1947  {
1948  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:1947
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832

Here is the call graph for this function:

void TNEANet::AttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 35 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), GetNodeAttrValue(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsDeleted().

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
Definition: network.cpp:108
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
Definition: network.cpp:133
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

TAFltI TNEANet::BegEAFltI ( const TStr attr) const
inline

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

Definition at line 2032 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

2032  {
2033  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2034  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAIntI TNEANet::BegEAIntI ( const TStr attr) const
inline

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

Definition at line 2009 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

2009  {
2010  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
2011  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAStrI TNEANet::BegEAStrI ( const TStr attr) const
inline

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

Definition at line 2021 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

2021  {
2022  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this); }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TEdgeI TNEANet::BegEI ( ) const
inline

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

Definition at line 2076 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH.

Referenced by Dump().

2076 { return TEdgeI(EdgeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:171
THash< TInt, TEdge > EdgeH
Definition: network.h:1830

Here is the call graph for this function:

Here is the caller graph for this function:

TAFltI TNEANet::BegNAFltI ( const TStr attr) const
inline

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

Definition at line 1933 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

1933  {
1934  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:1832
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAIntI TNEANet::BegNAIntI ( const TStr attr) const
inline

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

Definition at line 1914 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

1914  {
1915  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAStrI TNEANet::BegNAStrI ( const TStr attr) const
inline

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

Definition at line 1923 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

1923  {
1924 
1925  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:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TNodeI TNEANet::BegNI ( ) const
inline

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

Definition at line 1908 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump().

1908 { return TNodeI(NodeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:171
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::Clr ( )
inline

Deletes all nodes and edges from the graph.

Definition at line 2100 of file network.h.

References THash< TKey, TDat, THashFunc >::Clr(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, FltDefaultsE, FltDefaultsN, IntDefaultsE, IntDefaultsN, KeyToIndexTypeE, KeyToIndexTypeN, TNodeEdgeNet< TNodeData, TEdgeData >::MxEId, TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, StrDefaultsE, StrDefaultsN, VecOfFltVecsE, VecOfFltVecsN, VecOfIntVecsE, VecOfIntVecsN, VecOfStrVecsE, and VecOfStrVecsN.

2100  { MxNId=0; MxEId=0; NodeH.Clr(); EdgeH.Clr(),
2103  VecOfIntVecsN.Clr(), VecOfIntVecsE.Clr(), VecOfStrVecsN.Clr(), VecOfStrVecsE.Clr(),
2104  VecOfFltVecsN.Clr(), VecOfFltVecsE.Clr();}
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:315
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

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

References THash< TKey, TDat, THashFunc >::Defrag(), EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNEANet::TNode::InEIdV, THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN(), NodeH, TNEANet::TNode::OutEIdV, and TVec< TVal, TSizeTy >::Pack().

495  {
496  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
497  TNode& Node = NodeH[kid];
498  Node.InEIdV.Pack(); Node.OutEIdV.Pack();
499  }
500  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
501  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
502 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:191
void Defrag()
Definition: hash.h:509
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
bool FNextKeyId(int &KeyId) const
Definition: hash.h:432
int FFirstKeyId() const
Definition: hash.h:232
THash< TInt, TNode > NodeH
Definition: network.h:1829
void Pack()
Definition: hash.h:243

Here is the call graph for this function:

int TNEANet::DelAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

Deletes the edge attribute for NodeId.

Definition at line 2192 of file network.h.

References DelAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by DelAttrDatE().

2192 { return DelAttrDatE(EdgeId.GetId(), attr); }
int DelAttrDatE(const TEdgeI &EdgeId, const TStr &attr)
Deletes the edge attribute for NodeId.
Definition: network.h:2192

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::DelAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 808 of file network.cpp.

References EdgeH, FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), GetIntAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultE(), IntType, KeyToIndexTypeE, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

808  {
809  // TODO(nkhadke): add error checking
810  TInt vecType = KeyToIndexTypeE(attr).Val1;
811  if (vecType == IntType) {
813  } else if (vecType == StrType) {
815  } else if (vecType == FltType) {
817  } else {
818  return -1;
819  }
820  return 0;
821 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1820
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1822
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1824
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

int TNEANet::DelAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

Deletes the node attribute for NodeId.

Definition at line 2189 of file network.h.

References DelAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by DelAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::DelAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 794 of file network.cpp.

References FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), GetIntAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultN(), IntType, KeyToIndexTypeN, NodeH, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

794  {
795  TInt vecType = KeyToIndexTypeN(attr).Val1;
796  if (vecType == IntType) {
798  } else if (vecType == StrType) {
800  } else if (vecType == FltType) {
802  } else {
803  return -1;
804  }
805  return 0;
806 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: network.h:1816
Definition: dt.h:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1818
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: network.h:1814

Here is the call graph for this function:

int TNEANet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 963 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), FltDefaultsE, FltType, THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsE, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, StrDefaultsE, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

963  {
964  TInt vecType = KeyToIndexTypeE(attr).Val1;
965  if (vecType == IntType) {
967  if (IntDefaultsE.IsKey(attr)) {
968  IntDefaultsE.DelKey(attr);
969  }
970  } else if (vecType == StrType) {
972  if (StrDefaultsE.IsKey(attr)) {
973  StrDefaultsE.DelKey(attr);
974  }
975  } else if (vecType == FltType) {
977  if (FltDefaultsE.IsKey(attr)) {
978  FltDefaultsE.DelKey(attr);
979  }
980  } else {
981  return -1;
982  }
983  KeyToIndexTypeE.DelKey(attr);
984  return 0;
985 }
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
void DelKey(const TKey &Key)
Definition: hash.h:358
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
Definition: dt.h:1041
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

int TNEANet::DelAttrN ( const TStr attr)

Removes all the values for node attr.

Definition at line 939 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), FltDefaultsN, FltType, THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsN, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, StrDefaultsN, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

939  {
940  TInt vecType = KeyToIndexTypeN(attr).Val1;
941  if (vecType == IntType) {
943  if (IntDefaultsN.IsKey(attr)) {
944  IntDefaultsN.DelKey(attr);
945  }
946  } else if (vecType == StrType) {
948  if (StrDefaultsN.IsKey(attr)) {
949  StrDefaultsN.DelKey(attr);
950  }
951  } else if (vecType == FltType) {
953  if (FltDefaultsN.IsKey(attr)) {
954  FltDefaultsN.DelKey(attr);
955  }
956  } else {
957  return -1;
958  }
959  KeyToIndexTypeN.DelKey(attr);
960  return 0;
961 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
void DelKey(const TKey &Key)
Definition: hash.h:358
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
Definition: dt.h:1041
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

void TNEANet::DelEdge ( const int &  EId)

Deletes an edge with edge ID EId from the graph.

Definition at line 425 of file network.cpp.

References TVec< TVal, TSizeTy >::DelIfIn(), THash< TKey, TDat, THashFunc >::DelKey(), EdgeH, TNEANet::TEdge::GetDstNId(), GetEdge(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetNode(), TStr::GetNullStr(), TNEANet::TEdge::GetSrcNId(), IAssert, TNEANet::TNode::InEIdV, TVec< TVal, TSizeTy >::Ins(), IsEdge(), TInt::Mn, TFlt::Mn, TNEANet::TNode::OutEIdV, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

Referenced by DelEdge().

425  {
426  int i;
427 
428  IAssert(IsEdge(EId));
429  const int SrcNId = GetEdge(EId).GetSrcNId();
430  const int DstNId = GetEdge(EId).GetDstNId();
431  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
432  GetNode(DstNId).InEIdV.DelIfIn(EId);
433  EdgeH.DelKey(EId);
434 
435  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
436  TVec<TInt>& IntVec = VecOfIntVecsE[i];
437  IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
438  }
439  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
440  TVec<TStr>& StrVec = VecOfStrVecsE[i];
441  StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
442  }
443  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
444  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
445  FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
446  }
447 }
#define IAssert(Cond)
Definition: bd.h:262
bool DelIfIn(const TVal &Val)
Removes the first occurrence of element Val.
Definition: ds.h:1115
int GetSrcNId() const
Definition: network.h:1623
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TNode & GetNode(const int &NId)
Definition: network.h:1808
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
TIntV OutEIdV
Definition: network.h:1595
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
void DelKey(const TKey &Key)
Definition: hash.h:358
static const int Mn
Definition: dt.h:1045
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
int GetDstNId() const
Definition: network.h:1624
static TStr GetNullStr()
Definition: dt.cpp:1626
TEdge & GetEdge(const int &EId)
Definition: network.h:1810
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
TIntV InEIdV
Definition: network.h:1595
static const double Mn
Definition: dt.h:1293

Here is the call graph for this function:

Here is the caller graph for this function:

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

References DelEdge(), IAssert, and IsEdge().

450  {
451  int EId = 0;
452  bool Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
453  IAssert(Edge); // there is at least one edge
454  while (Edge) {
455  DelEdge(EId);
456  Edge = IsEdge(SrcNId, DstNId, EId, IsDir);
457  }
458 }
#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:425
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068

Here is the call graph for this function:

void TNEANet::DelNode ( const int &  NId)

Deletes node of ID NId from the graph.

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

Definition at line 315 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), EdgeH, TNEANet::TEdge::GetDstNId(), GetEdge(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetNode(), TStr::GetNullStr(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), TNEANet::TEdge::GetSrcNId(), IAssert, TInt::Mn, TFlt::Mn, NodeH, VecOfFltVecsE, VecOfFltVecsN, VecOfIntVecsE, VecOfIntVecsN, VecOfStrVecsE, and VecOfStrVecsN.

315  {
316  int i;
317 
318  const TNode& Node = GetNode(NId);
319  for (int out = 0; out < Node.GetOutDeg(); out++) {
320  const int EId = Node.GetOutEId(out);
321  const TEdge& Edge = GetEdge(EId);
322  IAssert(Edge.GetSrcNId() == NId);
323  GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
324  // Delete from Edge Attributes
325  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
326  TVec<TInt>& IntVec = VecOfIntVecsE[i];
327  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
328  }
329  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
330  TVec<TStr>& StrVec = VecOfStrVecsE[i];
331  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
332  }
333  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
334  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
335  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
336  }
337  EdgeH.DelKey(EId);
338  }
339  for (int in = 0; in < Node.GetInDeg(); in++) {
340  const int EId = Node.GetInEId(in);
341  const TEdge& Edge = GetEdge(EId);
342  IAssert(Edge.GetDstNId() == NId);
343  GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
344  // Delete from Edge Attributes
345  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
346  TVec<TInt>& IntVec = VecOfIntVecsE[i];
347  IntVec[EdgeH.GetKeyId(EId)] = TInt::Mn;
348  }
349  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
350  TVec<TStr>& StrVec = VecOfStrVecsE[i];
351  StrVec[EdgeH.GetKeyId(EId)] = TStr::GetNullStr();
352  }
353  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
354  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
355  FltVec[EdgeH.GetKeyId(EId)] = TFlt::Mn;
356  }
357  EdgeH.DelKey(EId);
358  }
359 
360  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
361  TVec<TInt>& IntVec = VecOfIntVecsN[i];
362  IntVec[NodeH.GetKeyId(NId)] = TInt::Mn;
363  }
364  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
365  TVec<TStr>& StrVec = VecOfStrVecsN[i];
366  StrVec[NodeH.GetKeyId(NId)] = TStr::GetNullStr();
367  }
368  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
369  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
370  FltVec[NodeH.GetKeyId(NId)] = TFlt::Mn;
371  }
372  NodeH.DelKey(NId);
373 }
#define IAssert(Cond)
Definition: bd.h:262
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TNode & GetNode(const int &NId)
Definition: network.h:1808
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
void DelKey(const TKey &Key)
Definition: hash.h:358
static const int Mn
Definition: dt.h:1045
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
static TStr GetNullStr()
Definition: dt.cpp:1626
TEdge & GetEdge(const int &EId)
Definition: network.h:1810
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TInt, TNode > NodeH
Definition: network.h:1829
static const double Mn
Definition: dt.h:1293

Here is the call graph for this function:

void TNEANet::DelNode ( const TNode NodeI)
inline

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

Definition at line 1904 of file network.h.

References DelNode(), and TNEANet::TNode::GetId().

Referenced by DelNode().

1904 { DelNode(NodeI.GetId()); }
void DelNode(const int &NId)
Deletes node of ID NId from the graph.
Definition: network.cpp:315

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::Dump ( FILE *  OutF = stdout) const

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

Definition at line 557 of file network.cpp.

References BegEI(), BegNI(), EndEI(), EndNI(), FltAttrValueEI(), FltAttrValueNI(), GetEdges(), GetNodes(), IntAttrValueEI(), IntAttrValueNI(), TVec< TVal, TSizeTy >::Len(), StrAttrValueEI(), and StrAttrValueNI().

557  {
558  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
559  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
560  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
561  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
562  fprintf(OutF, " %*d]\n", NodePlaces, NodeI.GetId());
563  // load node attributes
564  TIntV IntAttrN;
565  IntAttrValueNI(NodeI.GetId(), IntAttrN);
566  fprintf(OutF, " nai[%d]", IntAttrN.Len());
567  for (int i = 0; i < IntAttrN.Len(); i++) {
568  fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
569  TStrV StrAttrN;
570  StrAttrValueNI(NodeI.GetId(), StrAttrN);
571  fprintf(OutF, " nas[%d]", StrAttrN.Len());
572  for (int i = 0; i < StrAttrN.Len(); i++) {
573  fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
574  TFltV FltAttrN;
575  FltAttrValueNI(NodeI.GetId(), FltAttrN);
576  fprintf(OutF, " naf[%d]", FltAttrN.Len());
577  for (int i = 0; i < FltAttrN.Len(); i++) {
578  fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }
579 
580  fprintf(OutF, " in[%d]", NodeI.GetInDeg());
581  for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
582  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
583  fprintf(OutF, "\n");
584  fprintf(OutF, " out[%d]", NodeI.GetOutDeg());
585  for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
586  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
587  fprintf(OutF, "\n");
588  }
589  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
590  fprintf(OutF, " %*d] %*d -> %*d\n", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
591 
592  // load edge attributes
593  TIntV IntAttrE;
594  IntAttrValueEI(EdgeI.GetId(), IntAttrE);
595  fprintf(OutF, " eai[%d]", IntAttrE.Len());
596  for (int i = 0; i < IntAttrE.Len(); i++) {
597  fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]()); }
598  TStrV StrAttrE;
599  StrAttrValueEI(EdgeI.GetId(), StrAttrE);
600  fprintf(OutF, " eas[%d]", StrAttrE.Len());
601  for (int i = 0; i < StrAttrE.Len(); i++) {
602  fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]()); }
603  TFltV FltAttrE;
604  FltAttrValueEI(EdgeI.GetId(), FltAttrE);
605  fprintf(OutF, " eaf[%d]", FltAttrE.Len());
606  for (int i = 0; i < FltAttrE.Len(); i++) {
607  fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]()); }
608  }
609  fprintf(OutF, "\n");
610 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: network.h:1890
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:1963
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: network.h:1988
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:1996
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:2004
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: network.h:2076
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: network.h:2078
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:1971
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: network.h:1955
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: network.h:1910
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2049
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: network.h:1908

Here is the call graph for this function:

bool TNEANet::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 230 of file network.cpp.

References EdgeAttrIsFltDeleted(), EdgeAttrIsIntDeleted(), and EdgeAttrIsStrDeleted().

Referenced by AttrNameEI(), and AttrValueEI().

230  {
231  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
232  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
233  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
234  return IntDel || StrDel || FltDel;
235 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:249
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:237
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:243

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 249 of file network.cpp.

References EdgeH, FltType, THashKeyDatI< TKey, TDat >::GetDat(), GetFltAttrDefaultE(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), and VecOfFltVecsE.

Referenced by EdgeAttrIsDeleted(), FltAttrNameEI(), and FltAttrValueEI().

249  {
250  return (EdgeHI.GetDat().Val1 == FltType &&
251  GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
252  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
253 }
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: network.h:1824

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 237 of file network.cpp.

References EdgeH, THashKeyDatI< TKey, TDat >::GetDat(), GetIntAttrDefaultE(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), IntType, and VecOfIntVecsE.

Referenced by EdgeAttrIsDeleted(), IntAttrNameEI(), and IntAttrValueEI().

237  {
238  return (EdgeHI.GetDat().Val1 == IntType &&
239  GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
240  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
241 }
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: network.h:1820
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:420

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 243 of file network.cpp.

References EdgeH, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultE(), StrType, and VecOfStrVecsE.

Referenced by EdgeAttrIsDeleted(), StrAttrNameEI(), and StrAttrValueEI().

243  {
244  return (EdgeHI.GetDat().Val1 == StrType &&
245  GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
246  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
247 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
const TDat & GetDat() const
Definition: hash.h:72
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: network.h:1822
int GetKeyId(const TKey &Key) const
Definition: hash.h:420

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::Empty ( ) const
inline

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

Definition at line 2098 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetNodes().

2098 { return GetNodes()==0; }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: network.h:1890

Here is the call graph for this function:

TAFltI TNEANet::EndEAFltI ( const TStr attr) const
inline

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

Definition at line 2036 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

2036  {
2037  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2038  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAIntI TNEANet::EndEAIntI ( const TStr attr) const
inline

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

Definition at line 2013 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

2013  {
2014  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2015  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAStrI TNEANet::EndEAStrI ( const TStr attr) const
inline

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

Definition at line 2024 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

2024  {
2025  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
2026  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TEdgeI TNEANet::EndEI ( ) const
inline

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

Definition at line 2078 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::EndI().

Referenced by Dump().

2078 { return TEdgeI(EdgeH.EndI(), this); }
TIter EndI() const
Definition: hash.h:176
THash< TInt, TEdge > EdgeH
Definition: network.h:1830

Here is the call graph for this function:

Here is the caller graph for this function:

TAFltI TNEANet::EndNAFltI ( const TStr attr) const
inline

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

Definition at line 1936 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

1936  {
1937  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:1832
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAIntI TNEANet::EndNAIntI ( const TStr attr) const
inline

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

Definition at line 1917 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

1917  {
1918  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TAStrI TNEANet::EndNAStrI ( const TStr attr) const
inline

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

Definition at line 1927 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

1927  {
1928  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:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TNodeI TNEANet::EndNI ( ) const
inline

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

Definition at line 1910 of file network.h.

References THash< TKey, TDat, THashFunc >::EndI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump().

1910 { return TNodeI(NodeH.EndI(), this); }
TIter EndI() const
Definition: hash.h:176
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 2000 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

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

Here is the call graph for this function:

void TNEANet::FltAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 209 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsFltDeleted(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), and THashKeyDatI< TKey, TDat >::IsEnd().

209  {
210  Names = TVec<TStr>();
211  while (!EdgeHI.IsEnd()) {
212  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
213  Names.Add(EdgeHI.GetKey());
214  }
215  EdgeHI++;
216  }
217 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:249
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:559

Here is the call graph for this function:

void TNEANet::FltAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 1967 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

1967  {
1968  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:1967
TIter BegI() const
Definition: hash.h:171
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832

Here is the call graph for this function:

void TNEANet::FltAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 87 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsFltDeleted().

87  {
88  Names = TVec<TStr>();
89  while (!NodeHI.IsEnd()) {
90  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
91  Names.Add(NodeHI.GetKey());
92  }
93  NodeHI++;
94  }
95 }
const TKey & GetKey() const
Definition: hash.h:71
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:127
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:559

Here is the call graph for this function:

void TNEANet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 2004 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

Referenced by Dump().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TFltV Values 
) const

Definition at line 219 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsFltDeleted(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::IsEnd(), and VecOfFltVecsE.

219  {
220  Values = TVec<TFlt>();
221  while (!EdgeHI.IsEnd()) {
222  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
223  TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
224  Values.Add(val);
225  }
226  EdgeHI++;
227  }
228 }
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:249
Definition: dt.h:1289
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
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:559

Here is the call graph for this function:

void TNEANet::FltAttrValueNI ( const TInt NId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 1971 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TFltV Values 
) const

Definition at line 97 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsFltDeleted(), NodeH, and VecOfFltVecsN.

97  {
98  Values = TVec<TFlt>();
99  while (!NodeHI.IsEnd()) {
100  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
101  TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId)));
102  Values.Add(val);
103  }
104  NodeHI++;
105  }
106 }
Definition: dt.h:1289
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:127
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:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TInt, TNode > NodeH
Definition: network.h:1829
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

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 2040 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

2040  {
2041  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2042  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

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 2017 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

2017  {
2018  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2019  }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

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 2028 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

2028  {
2029  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
2030  }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TEdge& TNEANet::GetEdge ( const int &  EId)
inlineprivate

Definition at line 1810 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetDat().

Referenced by DelEdge(), DelNode(), IsEdge(), and TNEANet::TNodeI::IsInNId().

1810 { return EdgeH.GetDat(EId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830

Here is the call graph for this function:

Here is the caller graph for this function:

const TEdge& TNEANet::GetEdge ( const int &  EId) const
inlineprivate

Definition at line 1811 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetDat().

1811 { return EdgeH.GetDat(EId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830

Here is the call graph for this function:

TStr TNEANet::GetEdgeAttrValue ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 255 of file network.cpp.

References EdgeH, FltType, THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), TStr::GetNullStr(), TStr::GetStr(), IntType, KeyToIndexTypeE, StrType, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

255  {
256  if (EdgeHI.GetDat().Val1 == IntType) {
257  return (this->VecOfIntVecsE.GetVal(
258  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
259  } else if(EdgeHI.GetDat().Val1 == StrType) {
260  return this->VecOfStrVecsE.GetVal(
261  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId));
262  } else if (EdgeHI.GetDat().Val1 == FltType) {
263  return (this->VecOfFltVecsE.GetVal(
264  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
265  }
266  return TStr::GetNullStr();
267 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
const TKey & GetKey() const
Definition: hash.h:71
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
const TDat & GetDat() const
Definition: hash.h:72
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:420

Here is the call graph for this function:

int TNEANet::GetEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 2049 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::Len().

Referenced by Dump(), and GetEIdV().

2049 { return EdgeH.Len(); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int Len() const
Definition: hash.h:186

Here is the call graph for this function:

Here is the caller graph for this function:

TEdgeI TNEANet::GetEI ( const int &  EId) const
inline

Returns an iterator referring to edge with edge ID EId.

Definition at line 2080 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetI().

2080 { return TEdgeI(EdgeH.GetI(EId), this); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TIter GetI(const TKey &Key) const
Definition: hash.h:178

Here is the call graph for this function:

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 2082 of file network.h.

References GetEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetEId().

Referenced by GetEI().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 2074 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge().

2074 { 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:2068

Here is the call graph for this function:

void TNEANet::GetEIdV ( TIntV EIdV) const

Gets a vector IDs of all edges in the graph.

Definition at line 488 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), GetEdges(), and THash< TKey, TDat, THashFunc >::GetKey().

488  {
489  EIdV.Gen(GetEdges(), 0);
490  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
491  EIdV.Add(EdgeH.GetKey(E));
492  }
493 }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
bool FNextKeyId(int &KeyId) const
Definition: hash.h:432
int FFirstKeyId() const
Definition: hash.h:232
int GetEdges() const
Returns the number of edges in the graph.
Definition: network.h:2049
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:486
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 2179 of file network.h.

References GetFltAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by GetFltAttrDatE().

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

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 790 of file network.cpp.

References EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

790  {
792 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 2163 of file network.h.

References GetFltAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by GetFltAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 770 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

770  {
772 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 1824 of file network.h.

References FltDefaultsE, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and TFlt::Mn.

Referenced by AddEdge(), AddFltAttrDatE(), DelAttrDatE(), and EdgeAttrIsFltDeleted().

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

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 1818 of file network.h.

References FltDefaultsN, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and TFlt::Mn.

Referenced by AddFltAttrDatN(), AddNode(), DelAttrDatN(), and NodeAttrIsFltDeleted().

1818 { return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
Definition: dt.h:1289
bool IsKey(const TKey &Key) const
Definition: hash.h:216
static const double Mn
Definition: dt.h:1293

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 2173 of file network.h.

References TNEANet::TEdgeI::GetId(), and GetIntAttrDatE().

Referenced by GetIntAttrDatE().

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

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 774 of file network.cpp.

References EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

774  {
776 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TInt TNEANet::GetIntAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 2156 of file network.h.

References TNEANet::TNodeI::GetId(), and GetIntAttrDatN().

Referenced by GetIntAttrDatN().

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

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 754 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

754  {
756 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TInt TNEANet::GetIntAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 1820 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsE, THash< TKey, TDat, THashFunc >::IsKey(), and TInt::Mn.

Referenced by AddEdge(), AddIntAttrDatE(), DelAttrDatE(), and EdgeAttrIsIntDeleted().

1820 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
static const int Mn
Definition: dt.h:1045
Definition: dt.h:1041
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 1814 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsN, THash< TKey, TDat, THashFunc >::IsKey(), and TInt::Mn.

Referenced by AddIntAttrDatN(), AddNode(), DelAttrDatN(), and NodeAttrIsIntDeleted().

1814 { 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:1045
Definition: dt.h:1041
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrIndDatE ( const TEdgeI EdgeId,
const int &  index 
)
inline

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

Definition at line 2185 of file network.h.

References TNEANet::TEdgeI::GetId(), and GetIntAttrIndDatE().

Referenced by GetIntAttrIndDatE().

2185 { return GetIntAttrIndDatE(EdgeId.GetId(), index); }
TInt GetIntAttrIndDatE(const TEdgeI &EdgeId, const int &index)
Gets the value of edge int attr specified by the attr index.
Definition: network.h:2185

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrIndDatE ( const int &  EId,
const int &  index 
)

Definition at line 778 of file network.cpp.

References EdgeH, THash< TKey, TDat, THashFunc >::GetKeyId(), and VecOfIntVecsE.

778  {
779  return VecOfIntVecsE[index][EdgeH.GetKeyId(EId)];
780 }
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int GetKeyId(const TKey &Key) const
Definition: hash.h:420

Here is the call graph for this function:

TInt TNEANet::GetIntAttrIndDatN ( const TNodeI NodeId,
const int &  index 
)
inline

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

Definition at line 2169 of file network.h.

References TNEANet::TNodeI::GetId(), and GetIntAttrIndDatN().

Referenced by GetIntAttrIndDatN().

2169 { return GetIntAttrIndDatN(NodeId.GetId(), index); }
TInt GetIntAttrIndDatN(const TNodeI &NodeId, const int &index)
Gets the value of node int attr specified by the attr index.
Definition: network.h:2169

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrIndDatN ( const int &  NId,
const int &  index 
)

Definition at line 758 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetKeyId(), NodeH, and VecOfIntVecsN.

758  {
759  return VecOfIntVecsN[index][NodeH.GetKeyId(NId)];
760 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

int TNEANet::GetIntAttrIndE ( const TStr attr)

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

Definition at line 782 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, and TPair< TVal1, TVal2 >::Val2.

782  {
783  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
784 }
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

int TNEANet::GetIntAttrIndN ( const TStr attr)

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

Definition at line 762 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, and TPair< TVal1, TVal2 >::Val2.

762  {
763  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
764 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

int TNEANet::GetMxEId ( ) const
inline

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

Definition at line 2046 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::MxEId.

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

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

Definition at line 2044 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::MxNId.

2044 { return MxNId; }
TInt MxNId
Definition: network.h:1828
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 1939 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

1939  {
1940  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:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

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 1920 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

1920  {
1921  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

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 1930 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

1930  {
1931  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:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TNodeI TNEANet::GetNI ( const int &  NId) const
inline

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

Definition at line 1912 of file network.h.

References THash< TKey, TDat, THashFunc >::GetI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

1912 { return TNodeI(NodeH.GetI(NId), this); }
THash< TInt, TNode > NodeH
Definition: network.h:1829
TIter GetI(const TKey &Key) const
Definition: hash.h:178

Here is the call graph for this function:

void TNEANet::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the graph.

Definition at line 481 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), THash< TKey, TDat, THashFunc >::GetKey(), GetNodes(), and NodeH.

481  {
482  NIdV.Gen(GetNodes(), 0);
483  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
484  NIdV.Add(NodeH.GetKey(N));
485  }
486 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: network.h:1890
bool FNextKeyId(int &KeyId) const
Definition: hash.h:432
int FFirstKeyId() const
Definition: hash.h:232
THash< TInt, TNode > NodeH
Definition: network.h:1829
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:486
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210

Here is the call graph for this function:

TNode& TNEANet::GetNode ( const int &  NId)
inlineprivate

Definition at line 1808 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by AddEdge(), DelEdge(), DelNode(), and IsEdge().

1808 { return NodeH.GetDat(NId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

Here is the caller graph for this function:

const TNode& TNEANet::GetNode ( const int &  NId) const
inlineprivate

Definition at line 1809 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

1809 { return NodeH.GetDat(NId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TStr TNEANet::GetNodeAttrValue ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 133 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), TStr::GetNullStr(), TStr::GetStr(), IntType, KeyToIndexTypeN, NodeH, StrType, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

Referenced by AttrValueEI(), and AttrValueNI().

133  {
134  if (NodeHI.GetDat().Val1 == IntType) {
135  return (this->VecOfIntVecsN.GetVal(
136  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
137  } else if(NodeHI.GetDat().Val1 == StrType) {
138  return this->VecOfStrVecsN.GetVal(
139  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId));
140  } else if (NodeHI.GetDat().Val1 == FltType) {
141  return (this->VecOfFltVecsN.GetVal(
142  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
143  }
144  return TStr::GetNullStr();
145 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
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:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
const TDat & GetDat() const
Definition: hash.h:72
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::GetNodes ( ) const
inline

Returns the number of nodes in the graph.

Definition at line 1890 of file network.h.

References THash< TKey, TDat, THashFunc >::Len(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump(), and GetNIdV().

1890 { return NodeH.Len(); }
THash< TInt, TNode > NodeH
Definition: network.h:1829
int Len() const
Definition: hash.h:186

Here is the call graph for this function:

Here is the caller graph for this function:

TEdgeI TNEANet::GetRndEI ( TRnd Rnd = TInt::Rnd)
inline

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

Definition at line 2091 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetRndEId().

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

Here is the call graph for this function:

int TNEANet::GetRndEId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random edge in the graph.

Definition at line 2089 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::GetKey(), and THash< TKey, TDat, THashFunc >::GetRndKeyId().

2089 { return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
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:398
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210

Here is the call graph for this function:

TNodeI TNEANet::GetRndNI ( TRnd Rnd = TInt::Rnd)
inline

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

Definition at line 2087 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetNI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetRndNId().

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

Here is the call graph for this function:

int TNEANet::GetRndNId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random node in the graph.

Definition at line 2085 of file network.h.

References THash< TKey, TDat, THashFunc >::GetKey(), THash< TKey, TDat, THashFunc >::GetRndKeyId(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

2085 { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
THash< TInt, TNode > NodeH
Definition: network.h:1829
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:398
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210

Here is the call graph for this function:

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

References New().

988  {
989  PNEANet Net = TNEANet::New();
990  for (int i = 0; i < 5; i++) { Net->AddNode(i); }
991  Net->AddEdge(0,1); Net->AddEdge(0,2);
992  Net->AddEdge(0,3); Net->AddEdge(0,4);
993  Net->AddEdge(1,2); Net->AddEdge(1,2);
994  return Net;
995 }
Definition: bd.h:196
static PNEANet New()
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
Definition: network.h:1876

Here is the call graph for this function:

TStr TNEANet::GetStrAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 2176 of file network.h.

References TNEANet::TEdgeI::GetId(), and GetStrAttrDatE().

Referenced by GetStrAttrDatE().

2176 { return GetStrAttrDatE(EdgeId.GetId(), attr); }
TStr GetStrAttrDatE(const TEdgeI &EdgeId, const TStr &attr)
Gets the value of str attr from the edge attr value vector.
Definition: network.h:2176

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 786 of file network.cpp.

References EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

786  {
788 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35

Here is the call graph for this function:

TStr TNEANet::GetStrAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 2160 of file network.h.

References TNEANet::TNodeI::GetId(), and GetStrAttrDatN().

Referenced by GetStrAttrDatN().

2160 { return GetStrAttrDatN(NodeId.GetId(), attr); }
TStr GetStrAttrDatN(const TNodeI &NodeId, const TStr &attr)
Gets the value of str attr from the node attr value vector.
Definition: network.h:2160

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 766 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), KeyToIndexTypeN, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

766  {
768 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TVal2 Val2
Definition: ds.h:35
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

TStr TNEANet::GetStrAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 1822 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), THash< TKey, TDat, THashFunc >::IsKey(), and StrDefaultsE.

Referenced by AddEdge(), AddStrAttrDatE(), DelAttrDatE(), and EdgeAttrIsStrDeleted().

1822 { 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:1835
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 1816 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), THash< TKey, TDat, THashFunc >::IsKey(), and StrDefaultsN.

Referenced by AddNode(), AddStrAttrDatN(), DelAttrDatN(), and NodeAttrIsStrDeleted().

1816 { 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:1835
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

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.

References HasGraphFlag.

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:38
Directed multigraph with node edge attributes.
Definition: network.h:1587
void TNEANet::IntAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 1984 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

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

Here is the call graph for this function:

void TNEANet::IntAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 167 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsIntDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), IntType, and THashKeyDatI< TKey, TDat >::IsEnd().

167  {
168  Names = TVec<TStr>();
169  while (!EdgeHI.IsEnd()) {
170  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
171  Names.Add(EdgeHI.GetKey());
172  }
173  EdgeHI++;
174  }
175 }
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:237
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:559

Here is the call graph for this function:

void TNEANet::IntAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 1951 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

1951  {
1952  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:1951
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832

Here is the call graph for this function:

void TNEANet::IntAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 45 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsIntDeleted().

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
Definition: network.cpp:115
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

void TNEANet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 1988 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

Referenced by Dump().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::IntAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TIntV Values 
) const

Definition at line 177 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsIntDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), and VecOfIntVecsE.

177  {
178  Values = TVec<TInt>();
179  while (!EdgeHI.IsEnd()) {
180  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
181  TInt val = (this->VecOfIntVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
182  Values.Add(val);
183  }
184  EdgeHI++;
185  }
186 }
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: network.cpp:237
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
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:1041
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

void TNEANet::IntAttrValueNI ( const TInt NId,
TIntV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 1955 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::IntAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TIntV Values 
) const

Definition at line 55 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsIntDeleted(), NodeH, and VecOfIntVecsN.

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:1837
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:1041
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:115
THash< TInt, TNode > NodeH
Definition: network.h:1829
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

bool TNEANet::IsEdge ( const int &  EId) const
inline

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

Definition at line 2068 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::IsKey().

Referenced by AddEdge(), AddFltAttrDatE(), AddIntAttrDatE(), AddStrAttrDatE(), DelEdge(), and IsOk().

2068 { return EdgeH.IsKey(EId); }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

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 2070 of file network.h.

References IsEdge().

Referenced by IsEdge().

2070 { 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:2068

Here is the call graph for this function:

Here is the caller graph for this function:

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

References TNEANet::TEdge::GetDstNId(), GetEdge(), TNEANet::TEdge::GetId(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), GetNode(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), and TNEANet::TEdge::GetSrcNId().

460  {
461  const TNode& SrcNode = GetNode(SrcNId);
462  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
463  const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
464  if (DstNId == Edge.GetDstNId()) {
465  EId = Edge.GetId();
466  return true;
467  }
468  }
469  if (! IsDir) {
470  for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
471  const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
472  if (DstNId == Edge.GetSrcNId()) {
473  EId = Edge.GetId();
474  return true;
475  }
476  }
477  }
478  return false;
479 }
int GetId() const
Definition: network.h:1622
TNode & GetNode(const int &NId)
Definition: network.h:1808
TEdge & GetEdge(const int &EId)
Definition: network.h:1810

Here is the call graph for this function:

bool TNEANet::IsNode ( const int &  NId) const
inline

Tests whether ID NId is a node.

Definition at line 1906 of file network.h.

References THash< TKey, TDat, THashFunc >::IsKey(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by AddEdge(), AddFltAttrDatN(), AddIntAttrDatN(), AddNode(), AddStrAttrDatN(), and IsOk().

1906 { return NodeH.IsKey(NId); }
THash< TInt, TNode > NodeH
Definition: network.h:1829
bool IsKey(const TKey &Key) const
Definition: hash.h:216

Here is the call graph for this function:

Here is the caller graph for this function:

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

References TStr::CStr(), EAssertR, EdgeH, ErrNotify(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNEANet::TEdge::GetDstNId(), TNEANet::TNode::GetId(), TNEANet::TEdge::GetId(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), TNEANet::TEdge::GetSrcNId(), TNEANet::TNode::InEIdV, IsEdge(), IsNode(), TVec< TVal, TSizeTy >::IsSorted(), NodeH, and TNEANet::TNode::OutEIdV.

504  {
505  bool RetVal = true;
506  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
507  const TNode& Node = NodeH[N];
508  if (! Node.OutEIdV.IsSorted()) {
509  const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
510  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
511  }
512  if (! Node.InEIdV.IsSorted()) {
513  const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
514  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
515  }
516  // check out-edge ids
517  int prevEId = -1;
518  for (int e = 0; e < Node.GetOutDeg(); e++) {
519  if (! IsEdge(Node.GetOutEId(e))) {
520  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetOutEId(e), Node.GetId());
521  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
522  }
523  if (e > 0 && prevEId == Node.GetOutEId(e)) {
524  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
525  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
526  }
527  prevEId = Node.GetOutEId(e);
528  }
529  // check in-edge ids
530  prevEId = -1;
531  for (int e = 0; e < Node.GetInDeg(); e++) {
532  if (! IsEdge(Node.GetInEId(e))) {
533  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetInEId(e), Node.GetId());
534  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
535  }
536  if (e > 0 && prevEId == Node.GetInEId(e)) {
537  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
538  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
539  }
540  prevEId = Node.GetInEId(e);
541  }
542  }
543  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
544  const TEdge& Edge = EdgeH[E];
545  if (! IsNode(Edge.GetSrcNId())) {
546  const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
547  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
548  }
549  if (! IsNode(Edge.GetDstNId())) {
550  const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
551  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
552  }
553  }
554  return RetVal;
555 }
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: network.h:2068
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
bool FNextKeyId(int &KeyId) const
Definition: hash.h:432
int FFirstKeyId() const
Definition: hash.h:232
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:1906
THash< TInt, TNode > NodeH
Definition: network.h:1829
char * CStr()
Definition: dt.h:476

Here is the call graph for this function:

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 1882 of file network.h.

References TNEANet().

1882 { return PNEANet(new TNEANet(SIn)); }
TNEANet()
Definition: network.h:1842
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1566

Here is the call graph for this function:

static PNEANet TNEANet::New ( )
inlinestatic

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

Definition at line 1876 of file network.h.

References TNEANet().

Referenced by GetSmallGraph().

1876 { return PNEANet(new TNEANet()); }
TNEANet()
Definition: network.h:1842
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1566

Here is the call graph for this function:

Here is the caller graph for this function:

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 Graph = TNEANet::New(Nodes, Edges).

Definition at line 1880 of file network.h.

References TNEANet().

1880 { return PNEANet(new TNEANet(Nodes, Edges)); }
TNEANet()
Definition: network.h:1842
TPt< TNEANet > PNEANet
Pointer to a directed attribute multigraph (TNEANet)
Definition: network.h:1566

Here is the call graph for this function:

bool TNEANet::NodeAttrIsDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 108 of file network.cpp.

References NodeAttrIsFltDeleted(), NodeAttrIsIntDeleted(), and NodeAttrIsStrDeleted().

Referenced by AttrNameNI(), and AttrValueNI().

108  {
109  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
110  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
111  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
112  return IntDel || StrDel || FltDel;
113 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:121
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:127
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:115

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsFltDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 127 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), GetFltAttrDefaultN(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), NodeH, and VecOfFltVecsN.

Referenced by FltAttrNameNI(), FltAttrValueNI(), and NodeAttrIsDeleted().

127  {
128  return (NodeHI.GetDat().Val1 == FltType &&
129  GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
130  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
131 }
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:420
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TInt, TNode > NodeH
Definition: network.h:1829
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: network.h:1818

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsIntDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 115 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), GetIntAttrDefaultN(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), IntType, NodeH, and VecOfIntVecsN.

Referenced by IntAttrNameNI(), IntAttrValueNI(), and NodeAttrIsDeleted().

115  {
116  return (NodeHI.GetDat().Val1 == IntType &&
117  GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
118  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
119 }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
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:420
THash< TInt, TNode > NodeH
Definition: network.h:1829
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: network.h:1814

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsStrDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 121 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultN(), NodeH, StrType, and VecOfStrVecsN.

Referenced by NodeAttrIsDeleted(), StrAttrNameNI(), and StrAttrValueNI().

121  {
122  return (NodeHI.GetDat().Val1 == StrType &&
123  GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
124  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
125 }
const TKey & GetKey() const
Definition: hash.h:71
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
const TDat & GetDat() const
Definition: hash.h:72
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: network.h:1816
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

Here is the caller graph for this function:

TNEANet& TNEANet::operator= ( const TNEANet Graph)
inline

Definition at line 1885 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, EdgeH, TNodeEdgeNet< TNodeData, TEdgeData >::MxEId, MxEId, TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, MxNId, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, and NodeH.

1885  { if (this!=&Graph) {
1886  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH; }
1887  return *this; }
TInt MxNId
Definition: network.h:1828
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TInt MxEId
Definition: network.h:1828
THash< TInt, TNode > NodeH
Definition: network.h:1829
void TNEANet::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

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

Definition at line 2106 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::Gen(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

2106  {
2107  if (Nodes>0) { NodeH.Gen(Nodes/2); } if (Edges>0) { EdgeH.Gen(Edges/2); } }
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
void Gen(const int &ExpectVals)
Definition: hash.h:180
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

void TNEANet::Save ( TSOut SOut) const
inline

Saves the graph to a (binary) stream SOut.

Definition at line 1866 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, FltDefaultsE, FltDefaultsN, IntDefaultsE, IntDefaultsN, KeyToIndexTypeE, KeyToIndexTypeN, TNodeEdgeNet< TNodeData, TEdgeData >::MxEId, TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, THash< TKey, TDat, THashFunc >::Save(), TInt::Save(), StrDefaultsE, StrDefaultsN, VecOfFltVecsE, VecOfFltVecsN, VecOfIntVecsE, VecOfIntVecsN, VecOfStrVecsE, and VecOfStrVecsN.

1866  {
1867  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
1869  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
1870  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
1871  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
1872  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
1873  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
1874  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut); }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1837
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1836
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1834
void Save(TSOut &SOut) const
Definition: dt.h:1057
void Save(TSOut &SOut) const
Definition: hash.h:141
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1832
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1836
TInt MxNId
Definition: network.h:1828
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1837
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
THash< TInt, TEdge > EdgeH
Definition: network.h:1830
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1839
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1835
TInt MxEId
Definition: network.h:1828
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1835
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1839
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1834
THash< TInt, TNode > NodeH
Definition: network.h:1829

Here is the call graph for this function:

void TNEANet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 1992 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

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

Here is the call graph for this function:

void TNEANet::StrAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 188 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsStrDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and StrType.

188  {
189  Names = TVec<TStr>();
190  while (!EdgeHI.IsEnd()) {
191  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
192  Names.Add(EdgeHI.GetKey());
193  }
194  EdgeHI++;
195  }
196 }
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
Definition: network.cpp:243
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

void TNEANet::StrAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 1959 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

1959  {
1960  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:1959
TIter BegI() const
Definition: hash.h:171
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832

Here is the call graph for this function:

void TNEANet::StrAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 66 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsStrDeleted(), and StrType.

66  {
67  Names = TVec<TStr>();
68  while (!NodeHI.IsEnd()) {
69  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
70  Names.Add(NodeHI.GetKey());
71  }
72  NodeHI++;
73  }
74 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:121
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:559

Here is the call graph for this function:

void TNEANet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 1996 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

Referenced by Dump().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::StrAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 198 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsStrDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::IsEnd(), StrType, and VecOfStrVecsE.

198  {
199  Values = TVec<TStr>();
200  while (!EdgeHI.IsEnd()) {
201  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
202  TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
203  Values.Add(val);
204  }
205  EdgeHI++;
206  }
207 }
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1838
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
Definition: network.cpp:243
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

void TNEANet::StrAttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 1963 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump().

1963  {
1964  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:1963
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1832

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::StrAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 76 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsStrDeleted(), NodeH, StrType, and VecOfStrVecsN.

76  {
77  Values = TVec<TStr>();
78  while (!NodeHI.IsEnd()) {
79  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
80  TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
81  Values.Add(val);
82  }
83  NodeHI++;
84  }
85 }
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: network.cpp:121
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1838
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:420
Definition: dt.h:412
THash< TInt, TNode > NodeH
Definition: network.h:1829
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the call graph for this function:

Friends And Related Function Documentation

friend class TPt< TNEANet >
friend

Definition at line 2243 of file network.h.

Member Data Documentation

TCRef TNEANet::CRef
private

Definition at line 1827 of file network.h.

THash<TStr, TFlt> TNEANet::FltDefaultsE
private

Definition at line 1836 of file network.h.

Referenced by AddEdge(), AddFltAttrE(), Clr(), DelAttrE(), GetFltAttrDefaultE(), and Save().

THash<TStr, TFlt> TNEANet::FltDefaultsN
private

Definition at line 1836 of file network.h.

Referenced by AddFltAttrN(), AddNode(), Clr(), DelAttrN(), GetFltAttrDefaultN(), and Save().

THash<TStr, TInt> TNEANet::IntDefaultsE
private

Definition at line 1834 of file network.h.

Referenced by AddEdge(), AddIntAttrE(), Clr(), DelAttrE(), GetIntAttrDefaultE(), and Save().

THash<TStr, TInt> TNEANet::IntDefaultsN
private

Definition at line 1834 of file network.h.

Referenced by AddIntAttrN(), AddNode(), Clr(), DelAttrN(), GetIntAttrDefaultN(), and Save().

TInt TNEANet::MxEId
private
TInt TNEANet::MxNId
private
THash<TStr, TStr> TNEANet::StrDefaultsE
private

Definition at line 1835 of file network.h.

Referenced by AddStrAttrE(), Clr(), DelAttrE(), GetStrAttrDefaultE(), and Save().

THash<TStr, TStr> TNEANet::StrDefaultsN
private

Definition at line 1835 of file network.h.

Referenced by AddStrAttrN(), Clr(), DelAttrN(), GetStrAttrDefaultN(), and Save().


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