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

Directed multigraph with node edge attributes. More...

#include <networkmp.h>

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 TNEANetMP TNet
 
typedef TPt< TNEANetMPPNet
 

Public Member Functions

 TNEANetMP ()
 
 TNEANetMP (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a graph of nodes and edges. More...
 
 TNEANetMP (const TNEANetMP &Graph)
 
 TNEANetMP (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...
 
TNEANetMPoperator= (const TNEANetMP &Graph)
 
int GetNodes () const
 Returns the number of nodes in the graph. More...
 
void SetNodes (const int &Length)
 Sets 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 AddNodeWithEdges (const TInt &NId, TIntV &InEIdV, TIntV &OutEIdV)
 Adds a node along with its neighbor edges. More...
 
bool IsNode (const int &NId) const
 If the node of ID NId does not exist the function aborts. 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 Reserved () const
 Returns the number of nodes reserved in the network. More...
 
int ReservedE () const
 Returns the number of edges reserved in the network. More...
 
int GetEdges () const
 Returns the number of edges in the graph. More...
 
void SetEdges (const int &Length)
 Sets the number of edges in the graph. More...
 
void SetMxEId (const TInt &Id)
 Sets the MaxEId. Used since AddEdgeUnchecked doesn't affect EId for efficiency. 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 AddEdgeUnchecked (const TInt &EId, const int SrcNId, const int DstNId)
 Adds an edge without checking its adjacent nodes' neighborhood. 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 ReserveAttr (const int &NIntAttr, const int &NFltAttr, const int &NStrAttr, const int &EIntAttr, const int &EFltAttr, const int &EStrAttr)
 Reserves memory for dense attributes. More...
 
void Defrag (const bool &OnlyNodeLinks=false)
 
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...
 
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
 
TFlt GetWeightOutEdges (const TNodeI &NI, const TStr &attr)
 
bool IsFltAttrE (const TStr &attr)
 
bool IsIntAttrE (const TStr &attr)
 
bool IsStrAttrE (const TStr &attr)
 
TVec< TFlt > & GetFltAttrVecE (const TStr &attr)
 
int GetFltKeyIdE (const int &EId)
 
void GetWeightOutEdgesV (TFltV &OutWeights, const TFltV &AttrVal)
 

Static Public Member Functions

static PNEANetMP New ()
 Static cons returns pointer to graph. Ex: PNEANetMP Graph=TNEANetMP::New(). More...
 
static PNEANetMP 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 PNEANetMP Load (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. 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
 
THashMP< TInt, TNodeNodeH
 
THashMP< TInt, TEdgeEdgeH
 
TStrIntPrH KeyToIndexTypeN
 KeyToIndexType[N|E]: Key->(Type,Index). More...
 
TStrIntPrH KeyToIndexTypeE
 
THashMP< TStr, TIntIntDefaultsN
 
THashMP< TStr, TIntIntDefaultsE
 
THashMP< TStr, TStrStrDefaultsN
 
THashMP< TStr, TStrStrDefaultsE
 
THashMP< TStr, TFltFltDefaultsN
 
THashMP< TStr, TFltFltDefaultsE
 
TVec< TIntVVecOfIntVecsN
 
TVec< TIntVVecOfIntVecsE
 
TVec< TStrVVecOfStrVecsN
 
TVec< TStrVVecOfStrVecsE
 
TVec< TFltVVecOfFltVecsN
 
TVec< TFltVVecOfFltVecsE
 

Friends

class TPt< TNEANetMP >
 

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 27 of file networkmp.h.

Member Typedef Documentation

Definition at line 30 of file networkmp.h.

Definition at line 29 of file networkmp.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
IntType 
StrType 
FltType 

Definition at line 280 of file networkmp.h.

Constructor & Destructor Documentation

TNEANetMP::TNEANetMP ( )
inline

Definition at line 282 of file networkmp.h.

282  : CRef(), MxNId(0), MxEId(0), NodeH(), EdgeH(),
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TCRef CRef
Definition: networkmp.h:267
TNEANetMP::TNEANetMP ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

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

Definition at line 288 of file networkmp.h.

288  : CRef(),
293  { Reserve(Nodes, Edges); }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a graph of Nodes nodes and Edges edges.
Definition: networkmp.h:560
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TCRef CRef
Definition: networkmp.h:267
TNEANetMP::TNEANetMP ( const TNEANetMP Graph)
inline

Definition at line 294 of file networkmp.h.

294  : MxNId(Graph.MxNId), MxEId(Graph.MxEId),
295  NodeH(Graph.NodeH), EdgeH(Graph.EdgeH), KeyToIndexTypeN(), KeyToIndexTypeE(),
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TNEANetMP::TNEANetMP ( TSIn SIn)
inline

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

Definition at line 300 of file networkmp.h.

300  : MxNId(SIn), MxEId(SIn), NodeH(SIn), EdgeH(SIn),
302  StrDefaultsN(SIn), StrDefaultsE(SIn), FltDefaultsN(SIn), FltDefaultsE(SIn),
304  VecOfFltVecsN(SIn), VecOfFltVecsE(SIn) { }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278

Member Function Documentation

int TNEANetMP::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 388 of file networkmp.cpp.

388  {
389  int i;
390 
391  if (EId == -1) { EId = MxEId; MxEId++; }
392  else { MxEId = TMath::Mx(EId+1, MxEId()); }
393  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
394  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
395  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
396  GetNode(SrcNId).OutEIdV.AddSorted(EId);
397  GetNode(DstNId).InEIdV.AddSorted(EId);
398 
399  // update attribute columns
400  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
401  TVec<TInt>& IntVec = VecOfIntVecsE[i];
402  IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
403  }
404  TVec<TStr> DefIntVec = TVec<TStr>();
405  IntDefaultsE.GetKeyV(DefIntVec);
406  for (i = 0; i < DefIntVec.Len(); i++) {
407  TStr attr = DefIntVec[i];
408  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
409  IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
410  }
411 
412  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
413  TVec<TStr>& StrVec = VecOfStrVecsE[i];
414  StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
415  }
416  TVec<TStr> DefStrVec = TVec<TStr>();
417  IntDefaultsE.GetKeyV(DefStrVec);
418  for (i = 0; i < DefStrVec.Len(); i++) {
419  TStr attr = DefStrVec[i];
420  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
421  StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
422  }
423 
424  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
425  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
426  FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
427  }
428  TVec<TStr> DefFltVec = TVec<TStr>();
429  FltDefaultsE.GetKeyV(DefFltVec);
430  for (i = 0; i < DefFltVec.Len(); i++) {
431  TStr attr = DefFltVec[i];
432  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
433  FltVec[NodeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
434  }
435  return EId;
436 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:260
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hashmp.h:490
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1117
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
static const int Mn
Definition: dt.h:1141
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TNode & GetNode(const int &NId)
Definition: networkmp.h:248
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:264
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:262
static TStr GetNullStr()
Definition: dt.cpp:1626
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: networkmp.h:522
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
static const double Mn
Definition: dt.h:1390
int TNEANetMP::AddEdge ( const TEdgeI EdgeI)
inline

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

Definition at line 510 of file networkmp.h.

510 { 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: networkmp.cpp:388
void TNEANetMP::AddEdgeUnchecked ( const TInt EId,
const int  SrcNId,
const int  DstNId 
)

Adds an edge without checking its adjacent nodes' neighborhood.

Definition at line 438 of file networkmp.cpp.

438  {
439  int Idx = abs((EId.GetPrimHashCd()) % ReservedE());
440  int KeyId = EdgeH.AddKey13(Idx, EId);
441  MxEId = TMath::Mx(EId+1, MxEId());
442  EdgeH[KeyId] = TEdge(EId, SrcNId, DstNId);
443 }
int GetPrimHashCd() const
Definition: dt.h:1171
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TInt MxEId
Definition: networkmp.h:268
int ReservedE() const
Returns the number of edges reserved in the network.
Definition: networkmp.h:494
int AddKey13(const int &Idx, const TKey &Key)
Definition: hashmp.h:358
int TNEANetMP::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 616 of file networkmp.h.

616 { 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: networkmp.h:616
int TNEANetMP::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 758 of file networkmp.cpp.

758  {
759  int i;
760  TInt CurrLen;
761 
762  if (!IsEdge(EId)) {
763  //AddEdge(EId);
764  return -1;
765  }
766  if (KeyToIndexTypeE.IsKey(attr)) {
768  NewVec[EdgeH.GetKeyId(EId)] = value;
769  } else {
770  CurrLen = VecOfFltVecsE.Len();
771  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
772  TVec<TFlt> NewVec = TVec<TFlt>();
773  for (i = 0; i < MxEId; i++) {
774  NewVec.Ins(i, GetFltAttrDefaultE(attr));
775  }
776  NewVec[EdgeH.GetKeyId(EId)] = value;
777  VecOfFltVecsE.Add(NewVec);
778  }
779  return 0;
780 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TInt MxEId
Definition: networkmp.h:268
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:264
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: networkmp.h:522
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::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 600 of file networkmp.h.

600 { 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: networkmp.h:600
int TNEANetMP::AddFltAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 686 of file networkmp.cpp.

686  {
687  int i;
688  TInt CurrLen;
689 
690  if (!IsNode(NId)) {
691  // AddNode(NId);
692  return -1;
693  }
694  if (KeyToIndexTypeN.IsKey(attr)) {
696  NewVec[NodeH.GetKeyId(NId)] = value;
697  } else {
698  CurrLen = VecOfFltVecsN.Len();
699  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
700  TVec<TFlt> NewVec = TVec<TFlt>();
701  for (i = 0; i < MxNId; i++) {
702  NewVec.Ins(i, GetFltAttrDefaultN(attr));
703  }
704  NewVec[NodeH.GetKeyId(NId)] = value;
705  VecOfFltVecsN.Add(NewVec);
706  }
707  return 0;
708 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
TInt MxNId
Definition: networkmp.h:268
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: networkmp.h:258
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 956 of file networkmp.cpp.

956  {
957  int i;
958  TInt CurrLen;
959  TVec<TFlt> NewVec;
960  CurrLen = VecOfStrVecsE.Len();
961  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
962  NewVec = TVec<TFlt>();
963  for (i = 0; i < MxEId; i++) {
964  NewVec.Ins(i, defaultValue);
965  }
966  VecOfFltVecsE.Add(NewVec);
967  if (!FltDefaultsE.IsKey(attr)) {
968  FltDefaultsE.AddDat(attr, defaultValue);
969  } else {
970  return -1;
971  }
972  return 0;
973 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 897 of file networkmp.cpp.

897  {
898  // TODO(nkhadke): add error checking
899  int i;
900  TInt CurrLen;
901  TVec<TFlt> NewVec;
902  CurrLen = VecOfStrVecsN.Len();
903  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
904  NewVec = TVec<TFlt>();
905  for (i = 0; i < MxNId; i++) {
906  NewVec.Ins(i, defaultValue);
907  }
908  VecOfFltVecsN.Add(NewVec);
909  if (!FltDefaultsN.IsKey(attr)) {
910  FltDefaultsN.AddDat(attr, defaultValue);
911  } else {
912  return -1;
913  }
914  return 0;
915 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
TInt MxNId
Definition: networkmp.h:268
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
int TNEANetMP::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 606 of file networkmp.h.

606 { 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: networkmp.h:606
int TNEANetMP::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 711 of file networkmp.cpp.

711  {
712  int i;
713  TInt CurrLen;
714  if (!IsEdge(EId)) {
715  //AddEdge(EId);
716  return -1;
717  }
718  if (KeyToIndexTypeE.IsKey(attr)) {
720  NewVec[EdgeH.GetKeyId(EId)] = value;
721  } else {
722  CurrLen = VecOfIntVecsE.Len();
723  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
724  TVec<TInt> NewVec = TVec<TInt>();
725  for (i = 0; i < MxEId; i++) {
726  NewVec.Ins(i, (TInt) TInt::Mn);
727  }
728  NewVec[EdgeH.GetKeyId(EId)] = value;
729  VecOfIntVecsE.Add(NewVec);
730  }
731  return 0;
732 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
static const int Mn
Definition: dt.h:1141
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: networkmp.h:522
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::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 590 of file networkmp.h.

590 { 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: networkmp.h:590
int TNEANetMP::AddIntAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 640 of file networkmp.cpp.

640  {
641  int i;
642  TInt CurrLen;
643  if (!IsNode(NId)) {
644  // AddNode(NId);
645  return -1;
646  }
647  if (KeyToIndexTypeN.IsKey(attr)) {
649  NewVec[NodeH.GetKeyId(NId)] = value;
650  } else {
651  CurrLen = VecOfIntVecsN.Len();
652  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
653  TVec<TInt> NewVec = TVec<TInt>();
654  for (i = 0; i < MxNId; i++) {
655  NewVec.Ins(i, (TInt) TInt::Mn);
656  }
657  NewVec[NodeH.GetKeyId(NId)] = value;
658  VecOfIntVecsN.Add(NewVec);
659  }
660  return 0;
661 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: networkmp.h:268
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static const int Mn
Definition: dt.h:1141
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 917 of file networkmp.cpp.

917  {
918  // TODO(nkhadke): add error checking
919  int i;
920  TInt CurrLen;
921  TVec<TInt> NewVec;
922  CurrLen = VecOfIntVecsE.Len();
923  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
924  NewVec = TVec<TInt>();
925  for (i = 0; i < MxEId; i++) {
926  NewVec.Ins(i, defaultValue);
927  }
928  VecOfIntVecsE.Add(NewVec);
929  if (!IntDefaultsE.IsKey(attr)) {
930  IntDefaultsE.AddDat(attr, defaultValue);
931  } else {
932  return -1;
933  }
934  return 0;
935 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::AddIntAttrN ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int node attribute to the hashmap.

Definition at line 859 of file networkmp.cpp.

859  {
860  int i;
861  TInt CurrLen;
862  TVec<TInt> NewVec;
863  CurrLen = VecOfIntVecsN.Len();
864  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
865  NewVec = TVec<TInt>();
866  for (i = 0; i < MxNId; i++) {
867  NewVec.Ins(i, defaultValue);
868  }
869  VecOfIntVecsN.Add(NewVec);
870  if (!IntDefaultsN.IsKey(attr)) {
871  IntDefaultsN.AddDat(attr, defaultValue);
872  } else {
873  return -1;
874  }
875  return 0;
876 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::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 271 of file networkmp.cpp.

271  {
272  int i;
273  if (NId == -1) {
274  NId = MxNId; MxNId++;
275  } else {
276  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
277  MxNId = TMath::Mx(NId+1, MxNId());
278  }
279  // update attribute columns
280  NodeH.AddDat(NId, TNode(NId));
281  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
282  TVec<TInt>& IntVec = VecOfIntVecsN[i];
283  IntVec.Ins(NodeH.GetKeyId(NId), TInt::Mn);
284  }
285  TVec<TStr> DefIntVec = TVec<TStr>();
286  IntDefaultsN.GetKeyV(DefIntVec);
287  for (i = 0; i < DefIntVec.Len(); i++) {
288  TStr attr = DefIntVec[i];
289  TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
290  IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
291  }
292  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
293  TVec<TStr>& StrVec = VecOfStrVecsN[i];
294  StrVec.Ins(NodeH.GetKeyId(NId), TStr::GetNullStr());
295  }
296  TVec<TStr> DefStrVec = TVec<TStr>();
297  IntDefaultsN.GetKeyV(DefStrVec);
298  for (i = 0; i < DefStrVec.Len(); i++) {
299  TStr attr = DefStrVec[i];
300  TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
301  StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
302  }
303  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
304  TVec<TFlt>& FltVec = VecOfFltVecsN[i];
305  FltVec.Ins(NodeH.GetKeyId(NId), TFlt::Mn);
306  }
307  TVec<TStr> DefFltVec = TVec<TStr>();
308  FltDefaultsN.GetKeyV(DefFltVec);
309  for (i = 0; i < DefFltVec.Len(); i++) {
310  TStr attr = DefFltVec[i];
311  TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
312  FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
313  }
314  return NId;
315 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: networkmp.h:256
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hashmp.h:490
TInt MxNId
Definition: networkmp.h:268
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: networkmp.h:254
static const int Mn
Definition: dt.h:1141
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
static TStr GetNullStr()
Definition: dt.cpp:1626
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: networkmp.h:258
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal2 Val2
Definition: ds.h:35
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
static const double Mn
Definition: dt.h:1390
int TNEANetMP::AddNode ( const TNodeI NodeId)
inline

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

Definition at line 340 of file networkmp.h.

340 { return AddNode(NodeId.GetId()); }
int AddNode(int NId=-1)
Adds a node of ID NId to the graph.
Definition: networkmp.cpp:271
void TNEANetMP::AddNodeWithEdges ( const TInt NId,
TIntV InEIdV,
TIntV OutEIdV 
)

Adds a node along with its neighbor edges.

Definition at line 319 of file networkmp.cpp.

319  {
320  int NodeIdx = abs((NId.GetPrimHashCd()) % Reserved());
321  int NodeKeyId = NodeH.AddKey13(NodeIdx, NId);
322  MxNId = TMath::Mx(NId+1, MxNId());
323  NodeH[NodeKeyId] = TNode(NId);
324  NodeH[NodeKeyId].InEIdV.MoveFrom(InEIdV);
325  NodeH[NodeKeyId].OutEIdV.MoveFrom(OutEIdV);
326 }
int GetPrimHashCd() const
Definition: dt.h:1171
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt MxNId
Definition: networkmp.h:268
int Reserved() const
Returns the number of nodes reserved in the network.
Definition: networkmp.h:492
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int AddKey13(const int &Idx, const TKey &Key)
Definition: hashmp.h:358
int TNEANetMP::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 611 of file networkmp.h.

611 { 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: networkmp.h:611
int TNEANetMP::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 735 of file networkmp.cpp.

735  {
736  int i;
737  TInt CurrLen;
738  if (!IsEdge(EId)) {
739  //AddEdge(EId);
740  return -1;
741  }
742  if (KeyToIndexTypeE.IsKey(attr)) {
744  NewVec[EdgeH.GetKeyId(EId)] = value;
745  } else {
746  CurrLen = VecOfStrVecsE.Len();
747  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
748  TVec<TStr> NewVec = TVec<TStr>();
749  for (i = 0; i < MxEId; i++) {
750  NewVec.Ins(i, (TStr) TStr::GetNullStr());
751  }
752  NewVec[EdgeH.GetKeyId(EId)] = value;
753  VecOfStrVecsE.Add(NewVec);
754  }
755  return 0;
756 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
Definition: dt.h:412
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: networkmp.h:522
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::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 595 of file networkmp.h.

595 { 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: networkmp.h:595
int TNEANetMP::AddStrAttrDatN ( const int &  NId,
const TStr value,
const TStr attr 
)

Definition at line 663 of file networkmp.cpp.

663  {
664  int i;
665  TInt CurrLen;
666  if (!IsNode(NId)) {
667  // AddNode(NId);
668  return -1;
669  }
670  if (KeyToIndexTypeN.IsKey(attr)) {
672  NewVec[NodeH.GetKeyId(NId)] = value;
673  } else {
674  CurrLen = VecOfStrVecsN.Len();
675  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
676  TVec<TStr> NewVec = TVec<TStr>();
677  for (i = 0; i < MxNId; i++) {
678  NewVec.Ins(i, (TStr) TStr::GetNullStr() );
679  }
680  NewVec[NodeH.GetKeyId(NId)] = value;
681  VecOfStrVecsN.Add(NewVec);
682  }
683  return 0;
684 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TInt MxNId
Definition: networkmp.h:268
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
Definition: dt.h:412
TVal2 Val2
Definition: ds.h:35
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
int TNEANetMP::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 937 of file networkmp.cpp.

937  {
938  int i;
939  TInt CurrLen;
940  TVec<TStr> NewVec;
941  CurrLen = VecOfStrVecsE.Len();
942  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
943  NewVec = TVec<TStr>();
944  for (i = 0; i < MxEId; i++) {
945  NewVec.Ins(i, defaultValue);
946  }
947  VecOfStrVecsE.Add(NewVec);
948  if (!StrDefaultsE.IsKey(attr)) {
949  StrDefaultsE.AddDat(attr, defaultValue);
950  } else {
951  return -1;
952  }
953  return 0;
954 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TNEANetMP::AddStrAttrN ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str node attribute to the hashmap.

Definition at line 878 of file networkmp.cpp.

878  {
879  int i;
880  TInt CurrLen;
881  TVec<TStr> NewVec;
882  CurrLen = VecOfStrVecsN.Len();
883  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
884  NewVec = TVec<TStr>();
885  for (i = 0; i < MxNId; i++) {
886  NewVec.Ins(i, defaultValue);
887  }
888  VecOfStrVecsN.Add(NewVec);
889  if (!StrDefaultsN.IsKey(attr)) {
890  StrDefaultsN.AddDat(attr, defaultValue);
891  } else {
892  return -1;
893  }
894  return 0;
895 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TDat & AddDat(const TKey &Key)
Definition: hashmp.h:181
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
void TNEANetMP::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 419 of file networkmp.h.

419  {
420  AttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void AttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of attr names for edge EId.
Definition: networkmp.h:419
void TNEANetMP::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 149 of file networkmp.cpp.

149  {
150  Names = TVec<TStr>();
151  while (!EdgeHI.IsEnd()) {
152  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
153  Names.Add(EdgeHI.GetKey());
154  }
155  EdgeHI++;
156  }
157 }
const TKey & GetKey() const
Definition: hash.h:80
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:232
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::AttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of attr names for node NId.

Definition at line 386 of file networkmp.h.

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

Definition at line 27 of file networkmp.cpp.

27  {
28  Names = TVec<TStr>();
29  while (!NodeHI.IsEnd()) {
30  if (!NodeAttrIsDeleted(NId, NodeHI)) {
31  Names.Add(NodeHI.GetKey());
32  }
33  NodeHI++;
34  }
35 }
const TKey & GetKey() const
Definition: hash.h:80
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:110
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 423 of file networkmp.h.

423  {
424  AttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void AttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for edge EId.
Definition: networkmp.h:423
void TNEANetMP::AttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 159 of file networkmp.cpp.

159  {
160  Values = TVec<TStr>();
161  while (!EdgeHI.IsEnd()) {
162  if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
163  Values.Add(GetNodeAttrValue(EId, EdgeHI));
164  }
165  EdgeHI++;
166  }
167 }
TStr GetNodeAttrValue(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:135
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:232
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::AttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 390 of file networkmp.h.

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

Definition at line 37 of file networkmp.cpp.

37  {
38  Values = TVec<TStr>();
39  while (!NodeHI.IsEnd()) {
40  if (!NodeAttrIsDeleted(NId, NodeHI)) {
41  Values.Add(GetNodeAttrValue(NId, NodeHI));
42  }
43  NodeHI++;
44  }
45 }
TStr GetNodeAttrValue(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:135
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:110
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TAFltI TNEANetMP::BegEAFltI ( const TStr attr) const
inline

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

Definition at line 475 of file networkmp.h.

475  {
476  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
477  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANetMP::BegEAIntI ( const TStr attr) const
inline

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

Definition at line 452 of file networkmp.h.

452  {
453  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
454  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANetMP::BegEAStrI ( const TStr attr) const
inline

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

Definition at line 464 of file networkmp.h.

464  {
465  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this); }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TVal2 Val2
Definition: ds.h:35
TEdgeI TNEANetMP::BegEI ( ) const
inline

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

Definition at line 530 of file networkmp.h.

530 { return TEdgeI(EdgeH.BegI(), this); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TIter BegI() const
Definition: hashmp.h:153
TAFltI TNEANetMP::BegNAFltI ( const TStr attr) const
inline

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

Definition at line 376 of file networkmp.h.

376  {
377  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANetMP::BegNAIntI ( const TStr attr) const
inline

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

Definition at line 358 of file networkmp.h.

358  {
359  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANetMP::BegNAStrI ( const TStr attr) const
inline

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

Definition at line 367 of file networkmp.h.

367  {
368  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TNodeI TNEANetMP::BegNI ( ) const
inline

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

Definition at line 352 of file networkmp.h.

352 { return TNodeI(NodeH.BegI(), this); }
TIter BegI() const
Definition: hashmp.h:153
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::Clr ( )
inline

Deletes all nodes and edges from the graph.

Definition at line 554 of file networkmp.h.

554  { MxNId=0; MxEId=0; NodeH.Clr(); EdgeH.Clr(),
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361
void Clr(const bool &DoDel=true)
Definition: hashmp.h:474
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
void TNEANetMP::Defrag ( const bool &  OnlyNodeLinks = false)

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 515 of file networkmp.cpp.

515  {
516  #if 0
517  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
518  TNode& Node = NodeH[kid];
519  Node.InEIdV.Pack(); Node.OutEIdV.Pack();
520  }
521  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
522  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
523  #endif
524 }
void Pack()
Definition: hashmp.h:218
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
bool FNextKeyId(int &KeyId) const
Definition: hashmp.h:484
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int FFirstKeyId() const
Definition: hashmp.h:207
int TNEANetMP::DelAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

Deletes the edge attribute for NodeId.

Definition at line 656 of file networkmp.h.

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

Definition at line 844 of file networkmp.cpp.

844  {
845  // TODO(nkhadke): add error checking
846  TInt vecType = KeyToIndexTypeE(attr).Val1;
847  if (vecType == IntType) {
849  } else if (vecType == StrType) {
851  } else if (vecType == FltType) {
853  } else {
854  return -1;
855  }
856  return 0;
857 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:260
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:264
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:262
Definition: dt.h:1137
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
int TNEANetMP::DelAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

Deletes the node attribute for NodeId.

Definition at line 653 of file networkmp.h.

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

Definition at line 830 of file networkmp.cpp.

830  {
831  TInt vecType = KeyToIndexTypeN(attr).Val1;
832  if (vecType == IntType) {
834  } else if (vecType == StrType) {
836  } else if (vecType == FltType) {
838  } else {
839  return -1;
840  }
841  return 0;
842 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: networkmp.h:256
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: networkmp.h:254
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: networkmp.h:258
Definition: dt.h:1137
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
void TNEANetMP::Dump ( FILE *  OutF = stdout) const

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

Definition at line 579 of file networkmp.cpp.

579  {
580  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
581  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
582  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
583  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
584  fprintf(OutF, " %*d]\n", NodePlaces, NodeI.GetId());
585  // load node attributes
586  TIntV IntAttrN;
587  IntAttrValueNI(NodeI.GetId(), IntAttrN);
588  fprintf(OutF, " nai[%d]", IntAttrN.Len());
589  for (int i = 0; i < IntAttrN.Len(); i++) {
590  fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
591  TStrV StrAttrN;
592  StrAttrValueNI(NodeI.GetId(), StrAttrN);
593  fprintf(OutF, " nas[%d]", StrAttrN.Len());
594  for (int i = 0; i < StrAttrN.Len(); i++) {
595  fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
596  TFltV FltAttrN;
597  FltAttrValueNI(NodeI.GetId(), FltAttrN);
598  fprintf(OutF, " naf[%d]", FltAttrN.Len());
599  for (int i = 0; i < FltAttrN.Len(); i++) {
600  fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }
601 
602  fprintf(OutF, " in[%d]", NodeI.GetInDeg());
603  for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
604  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
605  fprintf(OutF, "\n");
606  fprintf(OutF, " out[%d]", NodeI.GetOutDeg());
607  for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
608  fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
609  fprintf(OutF, "\n");
610  }
611  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
612  fprintf(OutF, " %*d] %*d -> %*d", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());
613 
614  // load edge attributes
615  TIntV IntAttrE;
616  IntAttrValueEI(EdgeI.GetId(), IntAttrE);
617  fprintf(OutF, " eai[%d]", IntAttrE.Len());
618  for (int i = 0; i < IntAttrE.Len(); i++) {
619  fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]());
620  }
621  TStrV StrAttrE;
622  StrAttrValueEI(EdgeI.GetId(), StrAttrE);
623  fprintf(OutF, " eas[%d]", StrAttrE.Len());
624  for (int i = 0; i < StrAttrE.Len(); i++) {
625  fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]());
626  }
627  TFltV FltAttrE;
628  FltAttrValueEI(EdgeI.GetId(), FltAttrE);
629  fprintf(OutF, " eaf[%d]", FltAttrE.Len());
630  for (int i = 0; i < FltAttrE.Len(); i++) {
631  fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]());
632  }
633  fprintf(OutF, "\n");
634  }
635  fprintf(OutF, "\n");
636 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: networkmp.h:330
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:439
int GetEdges() const
Returns the number of edges in the graph.
Definition: networkmp.h:497
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: networkmp.h:530
void StrAttrValueNI(const TInt &NId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:406
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the graph.
Definition: networkmp.h:354
void FltAttrValueNI(const TInt &NId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:414
TNodeI BegNI() const
Returns an iterator referring to the first node in the graph.
Definition: networkmp.h:352
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: networkmp.h:532
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: networkmp.h:431
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:447
void IntAttrValueNI(const TInt &NId, TIntV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:398
bool TNEANetMP::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 232 of file networkmp.cpp.

232  {
233  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
234  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
235  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
236  return IntDel || StrDel || FltDel;
237 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:245
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:239
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:251
bool TNEANetMP::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 251 of file networkmp.cpp.

251  {
252  return (EdgeHI.GetDat().Val1 == FltType &&
253  GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
254  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
255 }
const TKey & GetKey() const
Definition: hash.h:80
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Get Flt edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:264
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 239 of file networkmp.cpp.

239  {
240  return (EdgeHI.GetDat().Val1 == IntType &&
241  GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
242  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
243 }
TInt GetIntAttrDefaultE(const TStr &attribute) const
Get Int edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:260
const TKey & GetKey() const
Definition: hash.h:80
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 245 of file networkmp.cpp.

245  {
246  return (EdgeHI.GetDat().Val1 == StrType &&
247  GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
248  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId)));
249 }
const TKey & GetKey() const
Definition: hash.h:80
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
const TDat & GetDat() const
Definition: hash.h:81
TStr GetStrAttrDefaultE(const TStr &attribute) const
Get Str edge attribute val. If not a proper attr, return default.
Definition: networkmp.h:262
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::Empty ( ) const
inline

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

Definition at line 552 of file networkmp.h.

552 { return GetNodes()==0; }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: networkmp.h:330
TAFltI TNEANetMP::EndEAFltI ( const TStr attr) const
inline

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

Definition at line 479 of file networkmp.h.

479  {
480  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
481  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANetMP::EndEAIntI ( const TStr attr) const
inline

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

Definition at line 456 of file networkmp.h.

456  {
457  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
458  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANetMP::EndEAStrI ( const TStr attr) const
inline

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

Definition at line 467 of file networkmp.h.

467  {
468  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
469  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TVal2 Val2
Definition: ds.h:35
TEdgeI TNEANetMP::EndEI ( ) const
inline

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

Definition at line 532 of file networkmp.h.

532 { return TEdgeI(EdgeH.EndI(), this); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TIter EndI() const
Definition: hashmp.h:156
TAFltI TNEANetMP::EndNAFltI ( const TStr attr) const
inline

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

Definition at line 379 of file networkmp.h.

379  {
380  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TAIntI TNEANetMP::EndNAIntI ( const TStr attr) const
inline

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

Definition at line 361 of file networkmp.h.

361  {
362  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TAStrI TNEANetMP::EndNAStrI ( const TStr attr) const
inline

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

Definition at line 370 of file networkmp.h.

370  {
371  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TNodeI TNEANetMP::EndNI ( ) const
inline

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

Definition at line 354 of file networkmp.h.

354 { return TNodeI(NodeH.EndI(), this); }
TIter EndI() const
Definition: hashmp.h:156
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::FltAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 443 of file networkmp.h.

443  {
444  FltAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void FltAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: networkmp.h:443
void TNEANetMP::FltAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 211 of file networkmp.cpp.

211  {
212  Names = TVec<TStr>();
213  while (!EdgeHI.IsEnd()) {
214  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
215  Names.Add(EdgeHI.GetKey());
216  }
217  EdgeHI++;
218  }
219 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:251
void TNEANetMP::FltAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 410 of file networkmp.h.

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

Definition at line 89 of file networkmp.cpp.

89  {
90  Names = TVec<TStr>();
91  while (!NodeHI.IsEnd()) {
92  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
93  Names.Add(NodeHI.GetKey());
94  }
95  NodeHI++;
96  }
97 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:129
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 447 of file networkmp.h.

447  {
448  FltAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:447
void TNEANetMP::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TFltV Values 
) const

Definition at line 221 of file networkmp.cpp.

221  {
222  Values = TVec<TFlt>();
223  while (!EdgeHI.IsEnd()) {
224  if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
225  TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
226  Values.Add(val);
227  }
228  EdgeHI++;
229  }
230 }
Definition: dt.h:1386
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:251
void TNEANetMP::FltAttrValueNI ( const TInt NId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 414 of file networkmp.h.

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

Definition at line 99 of file networkmp.cpp.

99  {
100  Values = TVec<TFlt>();
101  while (!NodeHI.IsEnd()) {
102  if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
103  TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId)));
104  Values.Add(val);
105  }
106  NodeHI++;
107  }
108 }
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
Definition: dt.h:1386
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:129
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TAFltI TNEANetMP::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 483 of file networkmp.h.

483  {
484  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
485  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAIntI TNEANetMP::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 460 of file networkmp.h.

460  {
461  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
462  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAStrI TNEANetMP::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 471 of file networkmp.h.

471  {
472  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EdgeH.GetKeyId(EId)), attr, true, this);
473  }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TEdge& TNEANetMP::GetEdge ( const int &  EId)
inlineprivate

Definition at line 250 of file networkmp.h.

250 { return EdgeH.GetDat(EId); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
const TEdge& TNEANetMP::GetEdge ( const int &  EId) const
inlineprivate

Definition at line 251 of file networkmp.h.

251 { return EdgeH.GetDat(EId); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TStr TNEANetMP::GetEdgeAttrValue ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 257 of file networkmp.cpp.

257  {
258  if (EdgeHI.GetDat().Val1 == IntType) {
259  return (this->VecOfIntVecsE.GetVal(
260  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
261  } else if(EdgeHI.GetDat().Val1 == StrType) {
262  return this->VecOfStrVecsE.GetVal(
263  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId));
264  } else if (EdgeHI.GetDat().Val1 == FltType) {
265  return (this->VecOfFltVecsE.GetVal(
266  this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EdgeH.GetKeyId(EId))).GetStr();
267  }
268  return TStr::GetNullStr();
269 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
const TDat & GetDat() const
Definition: hash.h:81
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
static TStr GetNullStr()
Definition: dt.cpp:1626
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
int TNEANetMP::GetEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 497 of file networkmp.h.

497 { return EdgeH.Len(); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
int Len() const
Definition: hashmp.h:165
TEdgeI TNEANetMP::GetEI ( const int &  EId) const
inline

Returns an iterator referring to edge with edge ID EId.

Definition at line 534 of file networkmp.h.

534 { return TEdgeI(EdgeH.GetI(EId), this); }
TIter GetI(const TKey &Key) const
Definition: hashmp.h:158
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TEdgeI TNEANetMP::GetEI ( const int &  SrcNId,
const int &  DstNId 
) const
inline

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

Definition at line 536 of file networkmp.h.

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

528 { 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: networkmp.h:522
void TNEANetMP::GetEIdV ( TIntV EIdV) const

Gets a vector IDs of all edges in the graph.

Definition at line 508 of file networkmp.cpp.

508  {
509  EIdV.Gen(GetEdges(), 0);
510  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
511  EIdV.Add(EdgeH.GetKey(E));
512  }
513 }
int GetEdges() const
Returns the number of edges in the graph.
Definition: networkmp.h:497
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
bool FNextKeyId(int &KeyId) const
Definition: hashmp.h:484
int FFirstKeyId() const
Definition: hashmp.h:207
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
const TKey & GetKey(const int &KeyId) const
Definition: hashmp.h:185
TFlt TNEANetMP::GetFltAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 643 of file networkmp.h.

643 { 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: networkmp.h:643
TFlt TNEANetMP::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 826 of file networkmp.cpp.

826  {
828 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TFlt TNEANetMP::GetFltAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 627 of file networkmp.h.

627 { 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: networkmp.h:627
TFlt TNEANetMP::GetFltAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 806 of file networkmp.cpp.

806  {
808 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TFlt TNEANetMP::GetFltAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 264 of file networkmp.h.

264 { return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }
Definition: dt.h:1386
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
static const double Mn
Definition: dt.h:1390
TFlt TNEANetMP::GetFltAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 258 of file networkmp.h.

258 { return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }
Definition: dt.h:1386
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
static const double Mn
Definition: dt.h:1390
TVec< TFlt > & TNEANetMP::GetFltAttrVecE ( const TStr attr)

Definition at line 782 of file networkmp.cpp.

782  {
784 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
TVal2 Val2
Definition: ds.h:35
int TNEANetMP::GetFltKeyIdE ( const int &  EId)

Definition at line 786 of file networkmp.cpp.

786  {
787  return EdgeH.GetKeyId(EId);
788 }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TInt TNEANetMP::GetIntAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 637 of file networkmp.h.

637 { 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: networkmp.h:637
TInt TNEANetMP::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 810 of file networkmp.cpp.

810  {
812 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TInt TNEANetMP::GetIntAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 620 of file networkmp.h.

620 { 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: networkmp.h:620
TInt TNEANetMP::GetIntAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 790 of file networkmp.cpp.

790  {
792 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TInt TNEANetMP::GetIntAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 260 of file networkmp.h.

260 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
static const int Mn
Definition: dt.h:1141
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
Definition: dt.h:1137
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TInt TNEANetMP::GetIntAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 254 of file networkmp.h.

254 { return IntDefaultsN.IsKey(attribute) ? IntDefaultsN.GetDat(attribute) : (TInt) TInt::Mn; }
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
static const int Mn
Definition: dt.h:1141
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
Definition: dt.h:1137
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TInt TNEANetMP::GetIntAttrIndDatE ( const TEdgeI EdgeId,
const int &  index 
)
inline

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

Definition at line 649 of file networkmp.h.

649 { 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: networkmp.h:649
TInt TNEANetMP::GetIntAttrIndDatE ( const int &  EId,
const int &  index 
)

Definition at line 814 of file networkmp.cpp.

814  {
815  return VecOfIntVecsE[index][EdgeH.GetKeyId(EId)];
816 }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TInt TNEANetMP::GetIntAttrIndDatN ( const TNodeI NodeId,
const int &  index 
)
inline

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

Definition at line 633 of file networkmp.h.

633 { 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: networkmp.h:633
TInt TNEANetMP::GetIntAttrIndDatN ( const int &  NId,
const int &  index 
)

Definition at line 794 of file networkmp.cpp.

794  {
795  return VecOfIntVecsN[index][NodeH.GetKeyId(NId)];
796 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
int TNEANetMP::GetIntAttrIndE ( const TStr attr)

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

Definition at line 818 of file networkmp.cpp.

818  {
819  return KeyToIndexTypeE.GetDat(attr).Val2.Val;
820 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
int TNEANetMP::GetIntAttrIndN ( const TStr attr)

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

Definition at line 798 of file networkmp.cpp.

798  {
799  return KeyToIndexTypeN.GetDat(attr).Val2.Val;
800 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
int TNEANetMP::GetMxEId ( ) const
inline

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

Definition at line 489 of file networkmp.h.

489 { return MxEId; }
TInt MxEId
Definition: networkmp.h:268
int TNEANetMP::GetMxNId ( ) const
inline

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

Definition at line 487 of file networkmp.h.

487 { return MxNId; }
TInt MxNId
Definition: networkmp.h:268
TAFltI TNEANetMP::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 382 of file networkmp.h.

382  {
383  return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAIntI TNEANetMP::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 364 of file networkmp.h.

364  {
365  return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAStrI TNEANetMP::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 373 of file networkmp.h.

373  {
374  return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NodeH.GetKeyId(NId)), attr, false, this); }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TNodeI TNEANetMP::GetNI ( const int &  NId) const
inline

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

Definition at line 356 of file networkmp.h.

356 { return TNodeI(NodeH.GetI(NId), this); }
TIter GetI(const TKey &Key) const
Definition: hashmp.h:158
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the graph.

Definition at line 501 of file networkmp.cpp.

501  {
502  NIdV.Gen(GetNodes(), 0);
503  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
504  NIdV.Add(NodeH.GetKey(N));
505  }
506 }
int GetNodes() const
Returns the number of nodes in the graph.
Definition: networkmp.h:330
bool FNextKeyId(int &KeyId) const
Definition: hashmp.h:484
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int FFirstKeyId() const
Definition: hashmp.h:207
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
const TKey & GetKey(const int &KeyId) const
Definition: hashmp.h:185
TNode& TNEANetMP::GetNode ( const int &  NId)
inlineprivate

Definition at line 248 of file networkmp.h.

248 { return NodeH.GetDat(NId); }
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
const TNode& TNEANetMP::GetNode ( const int &  NId) const
inlineprivate

Definition at line 249 of file networkmp.h.

249 { return NodeH.GetDat(NId); }
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TStr TNEANetMP::GetNodeAttrValue ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 135 of file networkmp.cpp.

135  {
136  if (NodeHI.GetDat().Val1 == IntType) {
137  return (this->VecOfIntVecsN.GetVal(
138  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
139  } else if(NodeHI.GetDat().Val1 == StrType) {
140  return this->VecOfStrVecsN.GetVal(
141  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId));
142  } else if (NodeHI.GetDat().Val1 == FltType) {
143  return (this->VecOfFltVecsN.GetVal(
144  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId))).GetStr();
145  }
146  return TStr::GetNullStr();
147 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
static TStr GetNullStr()
Definition: dt.cpp:1626
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
int TNEANetMP::GetNodes ( ) const
inline

Returns the number of nodes in the graph.

Definition at line 330 of file networkmp.h.

330 { return NodeH.Len(); }
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int Len() const
Definition: hashmp.h:165
TEdgeI TNEANetMP::GetRndEI ( TRnd Rnd = TInt::Rnd)
inline

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

Definition at line 545 of file networkmp.h.

545 { return GetEI(GetRndEId(Rnd)); }
TEdgeI GetEI(const int &EId) const
Returns an iterator referring to edge with edge ID EId.
Definition: networkmp.h:534
int GetRndEId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random edge in the graph.
Definition: networkmp.h:543
int TNEANetMP::GetRndEId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random edge in the graph.

Definition at line 543 of file networkmp.h.

543 { return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
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: hashmp.h:558
const TKey & GetKey(const int &KeyId) const
Definition: hashmp.h:185
TNodeI TNEANetMP::GetRndNI ( TRnd Rnd = TInt::Rnd)
inline

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

Definition at line 541 of file networkmp.h.

541 { return GetNI(GetRndNId(Rnd)); }
int GetRndNId(TRnd &Rnd=TInt::Rnd)
Returns an ID of a random node in the graph.
Definition: networkmp.h:539
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
Definition: networkmp.h:356
int TNEANetMP::GetRndNId ( TRnd Rnd = TInt::Rnd)
inline

Returns an ID of a random node in the graph.

Definition at line 539 of file networkmp.h.

539 { return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }
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: hashmp.h:558
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
const TKey & GetKey(const int &KeyId) const
Definition: hashmp.h:185
TStr TNEANetMP::GetStrAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
)
inline

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

Definition at line 640 of file networkmp.h.

640 { 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: networkmp.h:640
TStr TNEANetMP::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 822 of file networkmp.cpp.

822  {
824 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TStr TNEANetMP::GetStrAttrDatN ( const TNodeI NodeId,
const TStr attr 
)
inline

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

Definition at line 624 of file networkmp.h.

624 { 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: networkmp.h:624
TStr TNEANetMP::GetStrAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 802 of file networkmp.cpp.

802  {
804 }
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVal2 Val2
Definition: ds.h:35
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TStr TNEANetMP::GetStrAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 262 of file networkmp.h.

262 { return StrDefaultsE.IsKey(attribute) ? StrDefaultsE.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TStr TNEANetMP::GetStrAttrDefaultN ( const TStr attribute) const
inlineprivate

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

Definition at line 256 of file networkmp.h.

256 { return StrDefaultsN.IsKey(attribute) ? StrDefaultsN.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
const TDat & GetDat(const TKey &Key) const
Definition: hashmp.h:195
TFlt TNEANetMP::GetWeightOutEdges ( const TNodeI NI,
const TStr attr 
)

Definition at line 1023 of file networkmp.cpp.

1023  {
1024  TNode Node = GetNode(NI.GetId());
1025  TIntV OutEIdV = Node.OutEIdV;
1026  TFlt total = 0;
1027  int len = Node.OutEIdV.Len();
1028  for (int i = 0; i < len; i++) {
1029  total += GetFltAttrDatE(Node.OutEIdV[i], attr);
1030  }
1031  return total;
1032 }
TFlt GetFltAttrDatE(const TEdgeI &EdgeId, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: networkmp.h:643
Definition: dt.h:1386
TNode & GetNode(const int &NId)
Definition: networkmp.h:248
void TNEANetMP::GetWeightOutEdgesV ( TFltV OutWeights,
const TFltV AttrVal 
)

Definition at line 1034 of file networkmp.cpp.

1034  {
1035  for (TEdgeI it = BegEI(); it < EndEI(); it++) {
1036  int EId = it.GetId();
1037  int SrcId = it.GetSrcNId();
1038  OutWeights[SrcId] +=AttrVal[GetFltKeyIdE(EId)];
1039  }
1040 }
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the graph.
Definition: networkmp.h:530
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the graph.
Definition: networkmp.h:532
int GetFltKeyIdE(const int &EId)
Definition: networkmp.cpp:786
bool TNEANetMP::HasFlag ( const TGraphFlag Flag) const

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

Definition at line 5 of file networkmp.cpp.

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

Returns a vector of int attr names for edge EId.

Definition at line 427 of file networkmp.h.

427  {
428  IntAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void IntAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
Definition: networkmp.h:427
void TNEANetMP::IntAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 169 of file networkmp.cpp.

169  {
170  Names = TVec<TStr>();
171  while (!EdgeHI.IsEnd()) {
172  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
173  Names.Add(EdgeHI.GetKey());
174  }
175  EdgeHI++;
176  }
177 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:239
void TNEANetMP::IntAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 394 of file networkmp.h.

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

Definition at line 47 of file networkmp.cpp.

47  {
48  Names = TVec<TStr>();
49  while (!NodeHI.IsEnd()) {
50  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
51  Names.Add(NodeHI.GetKey());
52  }
53  NodeHI++;
54  }
55 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:117
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 431 of file networkmp.h.

431  {
432  IntAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: networkmp.h:431
void TNEANetMP::IntAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TIntV Values 
) const

Definition at line 179 of file networkmp.cpp.

179  {
180  Values = TVec<TInt>();
181  while (!EdgeHI.IsEnd()) {
182  if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
183  TInt val = (this->VecOfIntVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
184  Values.Add(val);
185  }
186  EdgeHI++;
187  }
188 }
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
Definition: dt.h:1137
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:239
void TNEANetMP::IntAttrValueNI ( const TInt NId,
TIntV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 398 of file networkmp.h.

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

Definition at line 57 of file networkmp.cpp.

57  {
58  Values = TVec<TInt>();
59  while (!NodeHI.IsEnd()) {
60  if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
61  TInt val = this->VecOfIntVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
62  Values.Add(val);
63  }
64  NodeHI++;
65  }
66 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:117
Definition: dt.h:1137
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::IsEdge ( const int &  EId) const
inline

Tests whether an edge with edge ID EId exists in 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 522 of file networkmp.h.

522 { return EdgeH.IsKey(EId); }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
bool TNEANetMP::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 524 of file networkmp.h.

524 { 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: networkmp.h:522
bool TNEANetMP::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 480 of file networkmp.cpp.

480  {
481  const TNode& SrcNode = GetNode(SrcNId);
482  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
483  const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
484  if (DstNId == Edge.GetDstNId()) {
485  EId = Edge.GetId();
486  return true;
487  }
488  }
489  if (! IsDir) {
490  for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
491  const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
492  if (DstNId == Edge.GetSrcNId()) {
493  EId = Edge.GetId();
494  return true;
495  }
496  }
497  }
498  return false;
499 }
TEdge & GetEdge(const int &EId)
Definition: networkmp.h:250
int GetId() const
Definition: networkmp.h:62
TNode & GetNode(const int &NId)
Definition: networkmp.h:248
bool TNEANetMP::IsFltAttrE ( const TStr attr)

Definition at line 1042 of file networkmp.cpp.

1042  {
1043  return (KeyToIndexTypeE.IsKey(attr) &&
1044  KeyToIndexTypeE.GetDat(attr).Val1 == FltType);
1045 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANetMP::IsIntAttrE ( const TStr attr)

Definition at line 1047 of file networkmp.cpp.

1047  {
1048  return (KeyToIndexTypeE.IsKey(attr) &&
1049  KeyToIndexTypeE.GetDat(attr).Val1 == IntType);
1050 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool TNEANetMP::IsNode ( const int &  NId) const
inline

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

Tests whether ID NId is a node.

Definition at line 350 of file networkmp.h.

350 { return NodeH.IsKey(NId); }
bool IsKey(const TKey &Key) const
Definition: hashmp.h:191
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
bool TNEANetMP::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 526 of file networkmp.cpp.

526  {
527  bool RetVal = true;
528  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
529  const TNode& Node = NodeH[N];
530  if (! Node.OutEIdV.IsSorted()) {
531  const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
532  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
533  }
534  if (! Node.InEIdV.IsSorted()) {
535  const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
536  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
537  }
538  // check out-edge ids
539  int prevEId = -1;
540  for (int e = 0; e < Node.GetOutDeg(); e++) {
541  if (! IsEdge(Node.GetOutEId(e))) {
542  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetOutEId(e), Node.GetId());
543  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
544  }
545  if (e > 0 && prevEId == Node.GetOutEId(e)) {
546  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
547  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
548  }
549  prevEId = Node.GetOutEId(e);
550  }
551  // check in-edge ids
552  prevEId = -1;
553  for (int e = 0; e < Node.GetInDeg(); e++) {
554  if (! IsEdge(Node.GetInEId(e))) {
555  const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.", Node.GetInEId(e), Node.GetId());
556  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
557  }
558  if (e > 0 && prevEId == Node.GetInEId(e)) {
559  const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
560  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
561  }
562  prevEId = Node.GetInEId(e);
563  }
564  }
565  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
566  const TEdge& Edge = EdgeH[E];
567  if (! IsNode(Edge.GetSrcNId())) {
568  const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
569  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
570  }
571  if (! IsNode(Edge.GetDstNId())) {
572  const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
573  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
574  }
575  }
576  return RetVal;
577 }
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
bool IsNode(const int &NId) const
If the node of ID NId does not exist the function aborts.
Definition: networkmp.h:350
bool FNextKeyId(int &KeyId) const
Definition: hashmp.h:484
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
int FFirstKeyId() const
Definition: hashmp.h:207
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: networkmp.h:522
char * CStr()
Definition: dt.h:479
bool TNEANetMP::IsStrAttrE ( const TStr attr)

Definition at line 1052 of file networkmp.cpp.

1052  {
1053  return (KeyToIndexTypeE.IsKey(attr) &&
1054  KeyToIndexTypeE.GetDat(attr).Val1 == StrType);
1055 }
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static PNEANetMP TNEANetMP::Load ( TSIn SIn)
inlinestatic

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

Definition at line 322 of file networkmp.h.

322 { return PNEANetMP(new TNEANetMP(SIn)); }
TPt< TNEANetMP > PNEANetMP
Pointer to a directed attribute multigraph (TNEANetMP)
Definition: networkmp.h:6
static PNEANetMP TNEANetMP::New ( )
inlinestatic

Static cons returns pointer to graph. Ex: PNEANetMP Graph=TNEANetMP::New().

Definition at line 316 of file networkmp.h.

316 { return PNEANetMP(new TNEANetMP()); }
TPt< TNEANetMP > PNEANetMP
Pointer to a directed attribute multigraph (TNEANetMP)
Definition: networkmp.h:6
static PNEANetMP TNEANetMP::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: PNEANetMP Graph = TNEANetMP::New(Nodes, Edges).

Definition at line 320 of file networkmp.h.

320 { return PNEANetMP(new TNEANetMP(Nodes, Edges)); }
TPt< TNEANetMP > PNEANetMP
Pointer to a directed attribute multigraph (TNEANetMP)
Definition: networkmp.h:6
bool TNEANetMP::NodeAttrIsDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 110 of file networkmp.cpp.

110  {
111  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
112  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
113  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
114  return IntDel || StrDel || FltDel;
115 }
bool NodeAttrIsFltDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:129
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:123
bool NodeAttrIsIntDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:117
bool TNEANetMP::NodeAttrIsFltDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 129 of file networkmp.cpp.

129  {
130  return (NodeHI.GetDat().Val1 == FltType &&
131  GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
132  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
133 }
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
TFlt GetFltAttrDefaultN(const TStr &attribute) const
Get Flt node attribute val. If not a proper attr, return default.
Definition: networkmp.h:258
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::NodeAttrIsIntDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 117 of file networkmp.cpp.

117  {
118  return (NodeHI.GetDat().Val1 == IntType &&
119  GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
120  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
121 }
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
const TKey & GetKey() const
Definition: hash.h:80
TInt GetIntAttrDefaultN(const TStr &attribute) const
Get Int node attribute val. If not a proper attr, return default.
Definition: networkmp.h:254
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
bool TNEANetMP::NodeAttrIsStrDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 123 of file networkmp.cpp.

123  {
124  return (NodeHI.GetDat().Val1 == StrType &&
125  GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
126  this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NodeH.GetKeyId(NId)));
127 }
TStr GetStrAttrDefaultN(const TStr &attribute) const
Get Str node attribute val. If not a proper attr, return default.
Definition: networkmp.h:256
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
TNEANetMP& TNEANetMP::operator= ( const TNEANetMP Graph)
inline

Definition at line 325 of file networkmp.h.

325  { if (this!=&Graph) {
326  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH; }
327  return *this; }
TInt MxNId
Definition: networkmp.h:268
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
TInt MxEId
Definition: networkmp.h:268
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

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

Definition at line 560 of file networkmp.h.

560  {
561  if (Nodes>0) { NodeH.Gen(Nodes); } if (Edges>0) { EdgeH.Gen(Edges); } }
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
void Gen(const int &ExpectVals)
Definition: hashmp.h:160
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::ReserveAttr ( const int &  NIntAttr,
const int &  NFltAttr,
const int &  NStrAttr,
const int &  EIntAttr,
const int &  EFltAttr,
const int &  EStrAttr 
)
inline

Reserves memory for dense attributes.

Definition at line 563 of file networkmp.h.

564  {
565  if (NIntAttr > 0) { IntDefaultsN.Gen(NIntAttr); }
566  if (NFltAttr > 0) { FltDefaultsN.Gen(NFltAttr); }
567  if (NStrAttr > 0) { StrDefaultsN.Gen(NStrAttr); }
568  if (EIntAttr > 0) { IntDefaultsE.Gen(EIntAttr); }
569  if (EFltAttr > 0) { FltDefaultsE.Gen(EFltAttr); }
570  if (EStrAttr > 0) { StrDefaultsE.Gen(EStrAttr); }
571  }
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
void Gen(const int &ExpectVals)
Definition: hashmp.h:160
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
int TNEANetMP::Reserved ( ) const
inline

Returns the number of nodes reserved in the network.

Definition at line 492 of file networkmp.h.

492 {return NodeH.GetReservedKeyIds();}
int GetReservedKeyIds() const
Definition: hashmp.h:169
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
int TNEANetMP::ReservedE ( ) const
inline

Returns the number of edges reserved in the network.

Definition at line 494 of file networkmp.h.

494 {return EdgeH.GetReservedKeyIds();}
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
int GetReservedKeyIds() const
Definition: hashmp.h:169
void TNEANetMP::Save ( TSOut SOut) const
inline

Saves the graph to a (binary) stream SOut.

Definition at line 306 of file networkmp.h.

306  {
307  MxNId.Save(SOut); MxEId.Save(SOut); NodeH.Save(SOut); EdgeH.Save(SOut);
309  IntDefaultsN.Save(SOut); IntDefaultsE.Save(SOut);
310  StrDefaultsN.Save(SOut); StrDefaultsE.Save(SOut);
311  FltDefaultsN.Save(SOut); FltDefaultsE.Save(SOut);
312  VecOfIntVecsN.Save(SOut); VecOfIntVecsE.Save(SOut);
313  VecOfStrVecsN.Save(SOut); VecOfStrVecsE.Save(SOut);
314  VecOfFltVecsN.Save(SOut); VecOfFltVecsE.Save(SOut); }
void Save(TSOut &SOut) const
Definition: hashmp.h:129
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TVec< TIntV > VecOfIntVecsN
Definition: networkmp.h:277
void Save(TSOut &SOut) const
Definition: dt.h:1153
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: networkmp.h:272
void Save(TSOut &SOut) const
Definition: hash.h:183
TVec< TFltV > VecOfFltVecsN
Definition: networkmp.h:279
THashMP< TStr, TStr > StrDefaultsN
Definition: networkmp.h:275
TInt MxNId
Definition: networkmp.h:268
THashMP< TStr, TInt > IntDefaultsN
Definition: networkmp.h:274
void Save(TSOut &SOut) const
Definition: ds.h:954
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
THashMP< TStr, TStr > StrDefaultsE
Definition: networkmp.h:275
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
TInt MxEId
Definition: networkmp.h:268
TVec< TIntV > VecOfIntVecsE
Definition: networkmp.h:277
THashMP< TStr, TInt > IntDefaultsE
Definition: networkmp.h:274
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
TVec< TFltV > VecOfFltVecsE
Definition: networkmp.h:279
THashMP< TStr, TFlt > FltDefaultsE
Definition: networkmp.h:276
THashMP< TStr, TFlt > FltDefaultsN
Definition: networkmp.h:276
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278
void TNEANetMP::SetEdges ( const int &  Length)
inline

Sets the number of edges in the graph.

Definition at line 499 of file networkmp.h.

499 { EdgeH.SetLen(Length); }
void SetLen(const int &Length)
Definition: hashmp.h:166
THashMP< TInt, TEdge > EdgeH
Definition: networkmp.h:270
void TNEANetMP::SetMxEId ( const TInt Id)
inline

Sets the MaxEId. Used since AddEdgeUnchecked doesn't affect EId for efficiency.

Definition at line 501 of file networkmp.h.

501 { MxEId = Id; }
TInt MxEId
Definition: networkmp.h:268
void TNEANetMP::SetNodes ( const int &  Length)
inline

Sets the number of nodes in the graph.

Definition at line 332 of file networkmp.h.

332 { NodeH.SetLen(Length); }
void SetLen(const int &Length)
Definition: hashmp.h:166
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
void TNEANetMP::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 435 of file networkmp.h.

435  {
436  StrAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void StrAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of str attr names for node NId.
Definition: networkmp.h:435
void TNEANetMP::StrAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 190 of file networkmp.cpp.

190  {
191  Names = TVec<TStr>();
192  while (!EdgeHI.IsEnd()) {
193  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
194  Names.Add(EdgeHI.GetKey());
195  }
196  EdgeHI++;
197  }
198 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:245
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::StrAttrNameNI ( const TInt NId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 402 of file networkmp.h.

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

Definition at line 68 of file networkmp.cpp.

68  {
69  Names = TVec<TStr>();
70  while (!NodeHI.IsEnd()) {
71  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
72  Names.Add(NodeHI.GetKey());
73  }
74  NodeHI++;
75  }
76 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:123
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 439 of file networkmp.h.

439  {
440  StrAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: networkmp.h:439
TStrIntPrH KeyToIndexTypeE
Definition: networkmp.h:272
TIter BegI() const
Definition: hash.h:213
void TNEANetMP::StrAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 200 of file networkmp.cpp.

200  {
201  Values = TVec<TStr>();
202  while (!EdgeHI.IsEnd()) {
203  if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
204  TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
205  Values.Add(val);
206  }
207  EdgeHI++;
208  }
209 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &EdgeHI) const
Definition: networkmp.cpp:245
TVec< TStrV > VecOfStrVecsE
Definition: networkmp.h:278
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TNEANetMP::StrAttrValueNI ( const TInt NId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 406 of file networkmp.h.

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

Definition at line 78 of file networkmp.cpp.

78  {
79  Values = TVec<TStr>();
80  while (!NodeHI.IsEnd()) {
81  if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
82  TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NodeH.GetKeyId(NId));
83  Values.Add(val);
84  }
85  NodeHI++;
86  }
87 }
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool NodeAttrIsStrDeleted(const int &NId, const TStrIntPrH::TIter &NodeHI) const
Definition: networkmp.cpp:123
THashMP< TInt, TNode > NodeH
Definition: networkmp.h:269
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int GetKeyId(const TKey &Key) const
Definition: hashmp.h:459
TVec< TStrV > VecOfStrVecsN
Definition: networkmp.h:278

Friends And Related Function Documentation

friend class TPt< TNEANetMP >
friend

Definition at line 716 of file networkmp.h.

Member Data Documentation

TCRef TNEANetMP::CRef
private

Definition at line 267 of file networkmp.h.

THashMP<TInt, TEdge> TNEANetMP::EdgeH
private

Definition at line 270 of file networkmp.h.

THashMP<TStr, TFlt> TNEANetMP::FltDefaultsE
private

Definition at line 276 of file networkmp.h.

THashMP<TStr, TFlt> TNEANetMP::FltDefaultsN
private

Definition at line 276 of file networkmp.h.

THashMP<TStr, TInt> TNEANetMP::IntDefaultsE
private

Definition at line 274 of file networkmp.h.

THashMP<TStr, TInt> TNEANetMP::IntDefaultsN
private

Definition at line 274 of file networkmp.h.

TStrIntPrH TNEANetMP::KeyToIndexTypeE
private

Definition at line 272 of file networkmp.h.

TStrIntPrH TNEANetMP::KeyToIndexTypeN
private

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

Definition at line 272 of file networkmp.h.

TInt TNEANetMP::MxEId
private

Definition at line 268 of file networkmp.h.

TInt TNEANetMP::MxNId
private

Definition at line 268 of file networkmp.h.

THashMP<TInt, TNode> TNEANetMP::NodeH
private

Definition at line 269 of file networkmp.h.

THashMP<TStr, TStr> TNEANetMP::StrDefaultsE
private

Definition at line 275 of file networkmp.h.

THashMP<TStr, TStr> TNEANetMP::StrDefaultsN
private

Definition at line 275 of file networkmp.h.

TVec<TFltV> TNEANetMP::VecOfFltVecsE
private

Definition at line 279 of file networkmp.h.

TVec<TFltV> TNEANetMP::VecOfFltVecsN
private

Definition at line 279 of file networkmp.h.

TVec<TIntV> TNEANetMP::VecOfIntVecsE
private

Definition at line 277 of file networkmp.h.

TVec<TIntV> TNEANetMP::VecOfIntVecsN
private

Definition at line 277 of file networkmp.h.

TVec<TStrV> TNEANetMP::VecOfStrVecsE
private

Definition at line 278 of file networkmp.h.

TVec<TStrV> TNEANetMP::VecOfStrVecsN
private

Definition at line 278 of file networkmp.h.


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