SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TUndirNet Class Reference

Undirected network. More...

#include <network.h>

Collaboration diagram for TUndirNet:

Classes

class  LoadTNodeFunctor
 
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 TUndirNet TNet
 
typedef TPt< TUndirNetPNet
 

Public Member Functions

 TUndirNet ()
 
 TUndirNet (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a network of Nodes nodes and Edges edges. More...
 
 TUndirNet (const TUndirNet &Graph)
 
 TUndirNet (TSIn &SIn)
 Constructor that loads the network from a (binary) stream SIn. More...
 
void Save (TSOut &SOut) const
 Saves the network to a (binary) stream SOut. Expects data structures for sparse attributes. More...
 
void Save_V1 (TSOut &SOut) const
 Saves the network to a (binary) stream SOut. Available for backwards compatibility. More...
 
bool HasFlag (const TGraphFlag &Flag) const
 Allows for run-time checking the type of the network (see the TGraphFlag for flags). More...
 
TUndirNetoperator= (const TUndirNet &Graph)
 
int GetNodes () const
 Returns the number of nodes in the network. More...
 
int AddNode (int NId=-1)
 Adds a node of ID NId to the network. More...
 
int AddNodeUnchecked (int NId=-1)
 Adds a node of ID NId to the network, noop if the node already exists. More...
 
int AddNode (const TNodeI &NodeI)
 Adds a node of ID NodeI.GetId() to the network. More...
 
int AddNode (const int &NId, const TIntV &NbrNIdV)
 Adds a node of ID NId to the network and create edges to all nodes in vector NbrNIdV. More...
 
int AddNode (const int &NId, const TVecPool< TInt > &Pool, const int &NIdVId)
 Adds a node of ID NId to the network and create edges to all nodes in vector NIdVId in the vector pool Pool. More...
 
void DelNode (const int &NId)
 Deletes node of ID NId from the network. More...
 
void DelNode (const TNode &NodeI)
 Deletes node of ID NodeI.GetId() from the network. More...
 
bool IsNode (const int &NId) const
 Tests whether ID NId is a node. More...
 
TNodeI BegNI () const
 Returns an iterator referring to the first node in the network. More...
 
TNodeI EndNI () const
 Returns an iterator referring to the past-the-end node in the network. More...
 
TNodeI GetNI (const int &NId) const
 Returns an iterator referring to the node of ID NId in the network. More...
 
int GetMxNId () const
 Returns an ID that is larger than any node ID in the network. More...
 
int GetEdges () const
 Returns the number of edges in the network. More...
 
int AddEdge (const int &SrcNId, const int &DstNId)
 Adds an edge between node IDs SrcNId and DstNId to the network. More...
 
int AddEdgeUnchecked (const int &SrcNId, const int &DstNId)
 Adds an edge between node IDs SrcNId and DstNId to the network. More...
 
int AddEdge (const TEdgeI &EdgeI)
 Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the network. More...
 
void DelEdge (const int &SrcNId, const int &DstNId)
 Deletes an edge between node IDs SrcNId and DstNId from the network. More...
 
bool IsEdge (const int &SrcNId, const int &DstNId) const
 Tests whether an edge between node IDs SrcNId and DstNId exists in the network. More...
 
TEdgeI BegEI () const
 Returns an iterator referring to the first edge in the network. More...
 
TEdgeI EndEI () const
 Returns an iterator referring to the past-the-end edge in the network. More...
 
TEdgeI GetEI (const int &EId) const
 Not supported/implemented! More...
 
TEdgeI GetEI (const int &SrcNId, const int &DstNId) const
 Returns an iterator referring to edge (SrcNId, DstNId) in the network. More...
 
int GetRndNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random node in the network. More...
 
TNodeI GetRndNI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random node in the network. More...
 
void GetNIdV (TIntV &NIdV) const
 Gets a vector IDs of all nodes in the network. More...
 
bool Empty () const
 Tests whether the network is empty (has zero nodes). More...
 
void Clr ()
 Deletes all nodes and edges from the network. More...
 
void Reserve (const int &Nodes, const int &Edges)
 Reserves memory for a network of Nodes nodes and Edges edges. More...
 
void ReserveNIdDeg (const int &NId, const int &Deg)
 Reserves memory for node ID NId having Deg edges. More...
 
void SortNodeAdjV ()
 Sorts the adjacency lists of each node. More...
 
void Defrag (const bool &OnlyNodeLinks=false)
 Defragments the network. More...
 
bool IsOk (const bool &ThrowExcept=true) const
 Checks the network data structure for internal consistency. More...
 
void Dump (FILE *OutF=stdout) const
 Print the network in a human readable form to an output stream OutF. More...
 
int AddSAttrDatN (const TInt &NId, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to the given node with id NId. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to NodeI. More...
 
int AddSAttrDatN (const TInt &NId, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to the given node with id NId. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to NodeI. More...
 
int AddSAttrDatN (const TInt &NId, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to the given node with id NId. More...
 
int AddSAttrDatN (const TInt &NId, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to the given node with id NId. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to NodeI. More...
 
int AddSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from NodeI. More...
 
int GetSAttrDatN (const TInt &NId, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from node with id NId. More...
 
int GetSAttrDatN (const TInt &NId, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from node with id NId. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from NodeI. More...
 
int GetSAttrDatN (const TNodeI &NodeI, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from NodeI. More...
 
int DelSAttrDatN (const TInt &NId, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from node with id NId. More...
 
int DelSAttrDatN (const TInt &NId, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from node with id NId. More...
 
int DelSAttrDatN (const TNodeI &NodeI, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from NodeI. More...
 
int DelSAttrDatN (const TNodeI &NodeI, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from NodeI. More...
 
int GetSAttrVN (const TInt &NId, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for node with id NId. More...
 
int GetSAttrVN (const TNodeI &NodeI, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for NodeI. More...
 
int GetIdVSAttrN (const TStr &AttrName, TIntV &IdV) const
 Gets a list of all nodes that have a sparse attribute with name AttrName. More...
 
int GetIdVSAttrN (const TInt &AttrId, TIntV &IdV) const
 Gets a list of all nodes that have a sparse attribute with id AttrId. More...
 
int AddSAttrN (const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
 Adds mapping for sparse attribute with name Name and type AttrType. More...
 
int GetSAttrIdN (const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
 Gets id and type for attribute with name Name. More...
 
int GetSAttrNameN (const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
 Gets name and type for attribute with id AttrId. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to EdgeI. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to EdgeI. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to the given edge with ids SrcId and DstId. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to EdgeI. More...
 
int AddSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to EdgeI. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from EdgeI. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from EdgeI. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from edge with ids SrcId and DstId. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from EdgeI. More...
 
int GetSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from EdgeI. More...
 
int DelSAttrDatE (const int &SrcNId, const int &DstNId, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId. More...
 
int DelSAttrDatE (const int &SrcNId, const int &DstNId, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from edge with ids SrcId and DstId. More...
 
int DelSAttrDatE (const TEdgeI &EdgeI, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from EdgeI. More...
 
int DelSAttrDatE (const TEdgeI &EdgeI, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from EdgeI. More...
 
int GetSAttrVE (const int &SrcNId, const int &DstNId, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for edge with ids SrcId and DstId. More...
 
int GetSAttrVE (const TEdgeI &EdgeI, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for EdgeI. More...
 
int GetIdVSAttrE (const TStr &AttrName, TIntPrV &IdV) const
 Gets a list of all edges that have a sparse attribute with name AttrName. More...
 
int GetIdVSAttrE (const TInt &AttrId, TIntPrV &IdV) const
 Gets a list of all edges that have a sparse attribute with id AttrId. More...
 
int AddSAttrE (const TStr &Name, const TAttrType &AttrType, TInt &AttrId)
 Adds mapping for sparse attribute with name Name and type AttrType. More...
 
int GetSAttrIdE (const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
 Gets id and type for attribute with name Name. More...
 
int GetSAttrNameE (const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
 Gets name and type for attribute with id AttrId. More...
 

Static Public Member Functions

static PUndirNet New ()
 Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New(). More...
 
static PUndirNet New (const int &Nodes, const int &Edges)
 Static constructor that returns a pointer to the network and reserves enough memory for Nodes nodes and Edges edges. More...
 
static PUndirNet Load (TSIn &SIn)
 Static constructor that loads the network from a stream SIn and returns a pointer to it. More...
 
static PUndirNet Load_V1 (TSIn &SIn)
 Static constructor that loads the network from a stream SIn and returns a pointer to it. Backwards compatible. More...
 
static PUndirNet LoadShM (TShMIn &ShMIn)
 Static constructor that loads the network from memory. More...
 
static PUndirNet GetSmallGraph ()
 Returns a small network on 5 nodes and 5 edges. More...
 

Private Member Functions

TNodeGetNode (const int &NId)
 
const TNodeGetNode (const int &NId) const
 
TIntPr OrderEdgeNodes (const int &SrcNId, const int &DstNId) const
 
void LoadNetworkShM (TShMIn &ShMIn)
 

Private Attributes

TCRef CRef
 
TInt MxNId
 
TInt NEdges
 
THash< TInt, TNodeNodeH
 
TAttr SAttrN
 
TAttrPair SAttrE
 

Friends

class TUndirNetMtx
 
class TPt< TUndirNet >
 

Detailed Description

Undirected network.

Node IDs can be arbitrary non-negative integers. Nodes and edges can have sparse attributes/data associated with them. There is at most one undirected edge between a pair of nodes. Self loops (one per node) are allowed but multiple (parallel) edges are not. The undirected graph 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.

Definition at line 3145 of file network.h.

Member Typedef Documentation

Definition at line 3148 of file network.h.

Definition at line 3147 of file network.h.

Constructor & Destructor Documentation

TUndirNet::TUndirNet ( )
inline

Definition at line 3282 of file network.h.

3282 : CRef(), MxNId(0), NEdges(0), NodeH(), SAttrN(), SAttrE() { }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TInt MxNId
Definition: network.h:3257
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
TCRef CRef
Definition: network.h:3256
TInt NEdges
Definition: network.h:3257
TUndirNet::TUndirNet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.

Definition at line 3284 of file network.h.

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

3284 : MxNId(0), NEdges(0), SAttrN(), SAttrE() { Reserve(Nodes, Edges); }
void Reserve(const int &Nodes, const int &Edges)
Reserves memory for a network of Nodes nodes and Edges edges.
Definition: network.h:3431
TInt MxNId
Definition: network.h:3257
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

TUndirNet::TUndirNet ( const TUndirNet Graph)
inline

Definition at line 3285 of file network.h.

3285  : MxNId(Graph.MxNId), NEdges(Graph.NEdges), NodeH(Graph.NodeH),
3286  SAttrN(), SAttrE() { }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TInt MxNId
Definition: network.h:3257
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
TInt NEdges
Definition: network.h:3257
TUndirNet::TUndirNet ( TSIn SIn)
inline

Constructor that loads the network from a (binary) stream SIn.

Definition at line 3288 of file network.h.

3288 : MxNId(SIn), NEdges(SIn), NodeH(SIn), SAttrN(SIn), SAttrE(SIn) { }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TInt MxNId
Definition: network.h:3257
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
TInt NEdges
Definition: network.h:3257

Member Function Documentation

int TUndirNet::AddEdge ( const int &  SrcNId,
const int &  DstNId 
)

Adds an edge between node IDs SrcNId and DstNId to the network.

If the edge already exists return -2. If the edge was successfully added return -1. Normally the function should return an ID of the edge added but since edges in TUndirNet have no IDs we return -1. The function aborts if SrcNId or DstNId are not nodes in the graph.

Definition at line 1891 of file network.cpp.

References TStr::Fmt(), TNEANet::GetNode(), IAssertR, TNEANet::IsEdge(), and TNEANet::IsNode().

1891  {
1892  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
1893  if (IsEdge(SrcNId, DstNId)) { return -2; } // edge already exists
1894  GetNode(SrcNId).NIdV.AddSorted(DstNId);
1895  if (SrcNId!=DstNId) { // not a self edge
1896  GetNode(DstNId).NIdV.AddSorted(SrcNId); }
1897  NEdges++;
1898  return -1; // no edge id
1899 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1117
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TNode & GetNode(const int &NId)
Definition: network.h:3263
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

int TUndirNet::AddEdge ( const TEdgeI EdgeI)
inline

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

Definition at line 3398 of file network.h.

References AddEdge(), TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

Referenced by AddEdge().

3398 { return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId()); }
int AddEdge(const int &SrcNId, const int &DstNId)
Adds an edge between node IDs SrcNId and DstNId to the network.
Definition: network.cpp:1891

Here is the call graph for this function:

Here is the caller graph for this function:

int TUndirNet::AddEdgeUnchecked ( const int &  SrcNId,
const int &  DstNId 
)

Adds an edge between node IDs SrcNId and DstNId to the network.

Returns -1. The method assumes that SrcNId and DstNId are existing nodes in the graph and adds new neighbor values at the end of their adjacency vectors. No checks are performed to verify these assumptions. Adjacency vectors must be sorted and have duplicates removed after a sequence of these operations to assure consistency of data structures.

Definition at line 1902 of file network.cpp.

References TNEANet::GetNode().

1902  {
1903  GetNode(SrcNId).NIdV.Add(DstNId);
1904  if (SrcNId!=DstNId) { // not a self edge
1905  GetNode(DstNId).NIdV.Add(SrcNId); }
1906  NEdges++;
1907  return -1; // no edge id
1908 }
TNode & GetNode(const int &NId)
Definition: network.h:3263
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

int TUndirNet::AddNode ( int  NId = -1)

Adds a node of ID NId to the network.

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

Definition at line 1802 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TStr::Fmt(), IAssertR, TNEANet::IsNode(), TMath::Mx(), TNEANet::MxNId, and TNEANet::NodeH.

1802  {
1803  if (NId == -1) {
1804  NId = MxNId; MxNId++;
1805  } else {
1806  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
1807  MxNId = TMath::Mx(NId+1, MxNId());
1808  }
1809  NodeH.AddDat(NId, TNode(NId));
1810  return NId;
1811 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TInt, TNode > NodeH
Definition: network.h:3258
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TInt MxNId
Definition: network.h:3257
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

int TUndirNet::AddNode ( const TNodeI NodeI)
inline

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

Definition at line 3338 of file network.h.

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

Referenced by AddNode().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TUndirNet::AddNode ( const int &  NId,
const TIntV NbrNIdV 
)

Adds a node of ID NId to the network and create edges to all nodes in vector NbrNIdV.

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.

The operation can create inconsistent graphs when the neighboring nodes in NbrNIdV vector do not exist. Use TUndirNet::IsOk to check that the resulting graph is consistent after the operation.

Definition at line 1825 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TStr::Fmt(), TUndirNet::TNode::GetDeg(), TNEANet::GetNode(), IAssertR, TUndirNet::TNode::Id, TNEANet::IsNode(), TVec< TVal, TSizeTy >::Len(), TMath::Mx(), TNEANet::MxNId, TUndirNet::TNode::NIdV, TNEANet::NodeH, and TVec< TVal, TSizeTy >::Sort().

1825  {
1826  int NewNId;
1827  if (NId == -1) {
1828  NewNId = MxNId; MxNId++;
1829  } else {
1830  IAssertR(! IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
1831  NewNId = NId;
1832  MxNId = TMath::Mx(NewNId+1, MxNId());
1833  }
1834  TNode& Node = NodeH.AddDat(NewNId);
1835  Node.Id = NewNId;
1836  Node.NIdV = NbrNIdV;
1837  Node.NIdV.Sort();
1838  NEdges += Node.GetDeg();
1839  for (int i = 0; i < NbrNIdV.Len(); i++) {
1840  GetNode(NbrNIdV[i]).NIdV.AddSorted(NewNId);
1841  }
1842  return NewNId;
1843 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TInt, TNode > NodeH
Definition: network.h:3258
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TSizeTy AddSorted(const TVal &Val, const bool &Asc=true, const TSizeTy &_MxVals=-1)
Adds element Val to a sorted vector.
Definition: ds.h:1117
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1318
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TNode & GetNode(const int &NId)
Definition: network.h:3263
TInt MxNId
Definition: network.h:3257
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TInt NEdges
Definition: network.h:3257
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

int TUndirNet::AddNode ( const int &  NId,
const TVecPool< TInt > &  Pool,
const int &  NIdVId 
)

Adds a node of ID NId to the network and create edges to all nodes in vector NIdVId in the vector pool Pool.

//int& NIdVId) 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.

The operation can create inconsistent graphs when the neighboring nodes stored in the Pool vector are not explicitly added to the graph. Use TUndirNet::IsOk to check that the resulting graph is consistent.

Definition at line 1846 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TStr::Fmt(), TVec< TVal, TSizeTy >::GenExt(), TUndirNet::TNode::GetDeg(), TVecPool< TVal, TSizeTy >::GetValVPt(), TVecPool< TVal, TSizeTy >::GetVLen(), IAssertR, TUndirNet::TNode::Id, TNEANet::IsNode(), TMath::Mx(), TNEANet::MxNId, TUndirNet::TNode::NIdV, TNEANet::NodeH, and TVec< TVal, TSizeTy >::Sort().

1846  {
1847  int NewNId;
1848  if (NId == -1) {
1849  NewNId = MxNId; MxNId++;
1850  } else {
1851  IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
1852  NewNId = NId;
1853  MxNId = TMath::Mx(NewNId+1, MxNId());
1854  }
1855  TNode& Node = NodeH.AddDat(NewNId);
1856  Node.Id = NewNId;
1857  Node.NIdV.GenExt(Pool.GetValVPt(NIdVId), Pool.GetVLen(NIdVId));
1858  Node.NIdV.Sort();
1859  NEdges += Node.GetDeg();
1860  return NewNId;
1861 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
THash< TInt, TNode > NodeH
Definition: network.h:3258
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TVal * GetValVPt(const int &VId) const
Returns pointer to the first element of the vector with id VId.
Definition: ds.h:1730
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetVLen(const int &VId) const
Returns the number of elements in the vector with id VId.
Definition: ds.h:1728
TInt MxNId
Definition: network.h:3257
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TInt NEdges
Definition: network.h:3257
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

int TUndirNet::AddNodeUnchecked ( int  NId = -1)

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

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

Definition at line 1813 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TNEANet::IsNode(), TMath::Mx(), TNEANet::MxNId, and TNEANet::NodeH.

1813  {
1814  if (NId == -1) {
1815  NId = MxNId; MxNId++;
1816  } else {
1817  if (IsNode(NId)) { return -1;}
1818  MxNId = TMath::Mx(NId+1, MxNId());
1819  }
1820  NodeH.AddDat(NId, TNode(NId));
1821  return NId;
1822 }
THash< TInt, TNode > NodeH
Definition: network.h:3258
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TInt MxNId
Definition: network.h:3257
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
const TInt Val 
)

Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId.

Definition at line 2153 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2153  {
2154  if (!IsEdge(SrcNId, DstNId)) {
2155  return -1;
2156  }
2157  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2158  return SAttrE.AddSAttrDat(EId, AttrName, Val);
2159 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
const TInt Val 
)

Adds Int sparse attribute with id AttrId to the given edge with ids SrcId and DstId.

Definition at line 2161 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2161  {
2162  if (!IsEdge(SrcNId, DstNId)) {
2163  return -1;
2164  }
2165  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2166  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2167 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TInt Val 
)
inline

Adds Int sparse attribute with name AttrName to EdgeI.

Definition at line 3583 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3583  {
3584  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, Val);
3585  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TInt Val 
)
inline

Adds Int sparse attribute with id AttrId to EdgeI.

Definition at line 3587 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3587  {
3588  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, Val);
3589  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
const TFlt Val 
)

Adds Flt sparse attribute with name AttrName to the given edge with ids SrcId and DstId.

Definition at line 2169 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2169  {
2170  if (!IsEdge(SrcNId, DstNId)) {
2171  return -1;
2172  }
2173  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2174  return SAttrE.AddSAttrDat(EId, AttrName, Val);
2175 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
const TFlt Val 
)

Adds Flt sparse attribute with id AttrId to the given edge with ids SrcId and DstId.

Definition at line 2177 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2177  {
2178  if (!IsEdge(SrcNId, DstNId)) {
2179  return -1;
2180  }
2181  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2182  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2183 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TFlt Val 
)
inline

Adds Flt sparse attribute with name AttrName to EdgeI.

Definition at line 3597 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3597  {
3598  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, Val);
3599  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TFlt Val 
)
inline

Adds Flt sparse attribute with id AttrId to EdgeI.

Definition at line 3601 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3601  {
3602  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, Val);
3603  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
const TStr Val 
)

Adds Str sparse attribute with name AttrName to the given edge with ids SrcId and DstId.

Definition at line 2185 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2185  {
2186  if (!IsEdge(SrcNId, DstNId)) {
2187  return -1;
2188  }
2189  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2190  return SAttrE.AddSAttrDat(EId, AttrName, Val);
2191 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
const TStr Val 
)

Adds Str sparse attribute with id AttrId to the given edge with ids SrcId and DstId.

Definition at line 2193 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2193  {
2194  if (!IsEdge(SrcNId, DstNId)) {
2195  return -1;
2196  }
2197  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2198  return SAttrE.AddSAttrDat(EId, AttrId, Val);
2199 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
const TStr Val 
)
inline

Adds Str sparse attribute with name AttrName to EdgeI.

Definition at line 3611 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3611  {
3612  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, Val);
3613  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
const TStr Val 
)
inline

Adds Str sparse attribute with id AttrId to EdgeI.

Definition at line 3615 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3615  {
3616  return AddSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, Val);
3617  }
int AddSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given edge with ids SrcId and DstId...
Definition: network.cpp:2153

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TInt Val 
)

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

Definition at line 2020 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2020  {
2021  if (!IsNode(NId)) {
2022  return -1;
2023  }
2024  return SAttrN.AddSAttrDat(NId, AttrName, Val);
2025 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TInt Val 
)

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

Definition at line 2027 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2027  {
2028  if (!IsNode(NId)) {
2029  return -1;
2030  }
2031  return SAttrN.AddSAttrDat(NId, AttrId, Val);
2032 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TInt Val 
)
inline

Adds Int sparse attribute with name AttrName to NodeI.

Definition at line 3465 of file network.h.

References TUndirNet::TNodeI::GetId().

3465  {
3466  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3467  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TInt Val 
)
inline

Adds Int sparse attribute with id AttrId to NodeI.

Definition at line 3469 of file network.h.

References TUndirNet::TNodeI::GetId().

3469  {
3470  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3471  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TFlt Val 
)

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

Definition at line 2034 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2034  {
2035  if (!IsNode(NId)) {
2036  return -1;
2037  }
2038  return SAttrN.AddSAttrDat(NId, AttrName, Val);
2039 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TFlt Val 
)

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

Definition at line 2041 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2041  {
2042  if (!IsNode(NId)) {
2043  return -1;
2044  }
2045  return SAttrN.AddSAttrDat(NId, AttrId, Val);
2046 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TFlt Val 
)
inline

Adds Flt sparse attribute with name AttrName to NodeI.

Definition at line 3479 of file network.h.

References TUndirNet::TNodeI::GetId().

3479  {
3480  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3481  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TFlt Val 
)
inline

Adds Flt sparse attribute with id AttrId to NodeI.

Definition at line 3483 of file network.h.

References TUndirNet::TNodeI::GetId().

3483  {
3484  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3485  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TStr AttrName,
const TStr Val 
)

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

Definition at line 2048 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2048  {
2049  if (!IsNode(NId)) {
2050  return -1;
2051  }
2052  return SAttrN.AddSAttrDat(NId, AttrName, Val);
2053 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TInt NId,
const TInt AttrId,
const TStr Val 
)

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

Definition at line 2055 of file network.cpp.

References TAttr::AddSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2055  {
2056  if (!IsNode(NId)) {
2057  return -1;
2058  }
2059  return SAttrN.AddSAttrDat(NId, AttrId, Val);
2060 }
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
const TStr Val 
)
inline

Adds Str sparse attribute with name AttrName to NodeI.

Definition at line 3493 of file network.h.

References TUndirNet::TNodeI::GetId().

3493  {
3494  return AddSAttrDatN(NodeI.GetId(), AttrName, Val);
3495  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
const TStr Val 
)
inline

Adds Str sparse attribute with id AttrId to NodeI.

Definition at line 3497 of file network.h.

References TUndirNet::TNodeI::GetId().

3497  {
3498  return AddSAttrDatN(NodeI.GetId(), AttrId, Val);
3499  }
int AddSAttrDatN(const TInt &NId, const TStr &AttrName, const TInt &Val)
Adds Int sparse attribute with name AttrName to the given node with id NId.
Definition: network.cpp:2020

Here is the call graph for this function:

int TUndirNet::AddSAttrE ( const TStr Name,
const TAttrType AttrType,
TInt AttrId 
)

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

Definition at line 2282 of file network.cpp.

References TAttr::AddSAttr(), and TNEANet::SAttrE.

2282  {
2283  return SAttrE.AddSAttr(Name, AttrType, AttrId);
2284 }
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:454
TAttrPair SAttrE
Definition: network.h:3261

Here is the call graph for this function:

int TUndirNet::AddSAttrN ( const TStr Name,
const TAttrType AttrType,
TInt AttrId 
)

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

Definition at line 2134 of file network.cpp.

References TAttr::AddSAttr(), and TNEANet::SAttrN.

2134  {
2135  return SAttrN.AddSAttr(Name, AttrType, AttrId);
2136 }
TAttr SAttrN
Definition: network.h:3260
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:210

Here is the call graph for this function:

TEdgeI TUndirNet::BegEI ( ) const
inline

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

Definition at line 3408 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::BegNI(), TNodeEdgeNet< TNodeData, TEdgeData >::EndNI(), TUndirNet::TNodeI::GetId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNodes(), TUndirNet::TNodeI::GetOutDeg(), and TUndirNet::TNodeI::GetOutNId().

3408 { TNodeI NI = BegNI(); TEdgeI EI(NI, EndNI(), 0); if (GetNodes() != 0 && (NI.GetOutDeg()==0 || NI.GetId()>NI.GetOutNId(0))) { EI++; } return EI; }
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
Definition: network.h:3370
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
Definition: network.h:3372
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:3324

Here is the call graph for this function:

TNodeI TUndirNet::BegNI ( ) const
inline

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

Definition at line 3370 of file network.h.

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

3370 { return TNodeI(NodeH.BegI()); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TIter BegI() const
Definition: hash.h:213

Here is the call graph for this function:

void TUndirNet::Clr ( )
inline

Deletes all nodes and edges from the network.

Definition at line 3429 of file network.h.

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

3429 { MxNId=0; NEdges=0; NodeH.Clr(); SAttrN.Clr(); SAttrE.Clr(); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TInt MxNId
Definition: network.h:3257
void Clr()
Clears the contents of the attribute map.
Definition: attr.h:122
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361
TInt NEdges
Definition: network.h:3257
void Clr()
Clears the contents of the attribute map.
Definition: attr.h:37

Here is the call graph for this function:

void TUndirNet::Defrag ( const bool &  OnlyNodeLinks = false)

Defragments the network.

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

References THash< TKey, TDat, THashFunc >::Defrag(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN(), TNEANet::NodeH, and THash< TKey, TDat, THashFunc >::Pack().

1950  {
1951  for (int n = NodeH.FFirstKeyId(); NodeH.FNextKeyId(n); ) {
1952  NodeH[n].NIdV.Pack();
1953  }
1954  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) {
1955  NodeH.Defrag();
1956  }
1957 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
THash< TInt, TNode > NodeH
Definition: network.h:3258
void Defrag()
Definition: hash.h:555
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
void Pack()
Definition: hash.h:289

Here is the call graph for this function:

void TUndirNet::DelEdge ( const int &  SrcNId,
const int &  DstNId 
)

Deletes an edge between node IDs SrcNId and DstNId from the network.

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

References TVec< TVal, TSizeTy >::Del(), TAttr::DelSAttrId(), TStr::Fmt(), TNEANet::GetNode(), IAssertR, TNEANet::IsNode(), TUndirNet::TNode::NIdV, TNEANet::SAttrE, and TVec< TVal, TSizeTy >::SearchBin().

1911  {
1912  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
1913  { TNode& N = GetNode(SrcNId);
1914  const int n = N.NIdV.SearchBin(DstNId);
1915  TIntPr Id(SrcNId, DstNId);
1916  SAttrE.DelSAttrId(Id);
1917  if (n!= -1) { N.NIdV.Del(n); NEdges--; } }
1918  if (SrcNId != DstNId) { // not a self edge
1919  TNode& N = GetNode(DstNId);
1920  const int n = N.NIdV.SearchBin(SrcNId);
1921  if (n!= -1) { N.NIdV.Del(n); }
1922  }
1923 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
void DelSAttrId(const TIntPr &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:368
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TNode & GetNode(const int &NId)
Definition: network.h:3263
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

void TUndirNet::DelNode ( const int &  NId)

Deletes node of ID NId from the network.

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

Definition at line 1864 of file network.cpp.

References AssertR, TVec< TVal, TSizeTy >::Del(), THash< TKey, TDat, THashFunc >::DelKey(), TAttr::DelSAttrId(), TStr::Fmt(), TUndirNet::TNode::GetDeg(), TUndirNet::TNode::GetNbrNId(), TNEANet::GetNode(), IAssert, TNEANet::IsNode(), TUndirNet::TNode::NIdV, TNEANet::NodeH, TNEANet::SAttrN, and TVec< TVal, TSizeTy >::SearchBin().

1864  {
1865  { AssertR(IsNode(NId), TStr::Fmt("NodeId %d does not exist", NId));
1866  TInt Id(NId);
1867  SAttrN.DelSAttrId(Id);
1868  TNode& Node = GetNode(NId);
1869  NEdges -= Node.GetDeg();
1870  for (int e = 0; e < Node.GetDeg(); e++) {
1871  const int nbr = Node.GetNbrNId(e);
1872  if (nbr == NId) { continue; }
1873  TNode& N = GetNode(nbr);
1874  const int n = N.NIdV.SearchBin(NId);
1875  IAssert(n != -1); // if NId points to N, then N also should point back
1876  if (n!= -1) { N.NIdV.Del(n); }
1877  } }
1878  NodeH.DelKey(NId);
1879 }
#define IAssert(Cond)
Definition: bd.h:262
THash< TInt, TNode > NodeH
Definition: network.h:3258
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
void DelKey(const TKey &Key)
Definition: hash.h:404
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TNode & GetNode(const int &NId)
Definition: network.h:3263
Definition: dt.h:1134
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TAttr SAttrN
Definition: network.h:3260
#define AssertR(Cond, Reason)
Definition: bd.h:258
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

void TUndirNet::DelNode ( const TNode NodeI)
inline

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

Definition at line 3366 of file network.h.

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

Referenced by DelNode().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TUndirNet::DelSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName 
)

Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId.

Definition at line 2249 of file network.cpp.

References TAttr::DelSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2249  {
2250  if (!IsEdge(SrcNId, DstNId)) {
2251  return -1;
2252  }
2253  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2254  return SAttrE.DelSAttrDat(EId, AttrName);
2255 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
int DelSAttrDat(const TIntPr &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:347
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::DelSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId 
)

Deletes sparse attribute with id AttrId from edge with ids SrcId and DstId.

Definition at line 2257 of file network.cpp.

References TAttr::DelSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2257  {
2258  if (!IsEdge(SrcNId, DstNId)) {
2259  return -1;
2260  }
2261  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2262  return SAttrE.DelSAttrDat(EId, AttrId);
2263 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
int DelSAttrDat(const TIntPr &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:347
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::DelSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from EdgeI.

Definition at line 3667 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3667  {
3668  return DelSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName);
3669  }
int DelSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2249

Here is the call graph for this function:

int TUndirNet::DelSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId 
)
inline

Deletes sparse attribute with id AttrId from EdgeI.

Definition at line 3671 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3671  {
3672  return DelSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId);
3673  }
int DelSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2249

Here is the call graph for this function:

int TUndirNet::DelSAttrDatN ( const TInt NId,
const TStr AttrName 
)

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

Definition at line 2104 of file network.cpp.

References TAttr::DelSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2104  {
2105  if (!IsNode(NId)) {
2106  return -1;
2107  }
2108  return SAttrN.DelSAttrDat(NId, AttrName);
2109 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::DelSAttrDatN ( const TInt NId,
const TInt AttrId 
)

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

Definition at line 2111 of file network.cpp.

References TAttr::DelSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2111  {
2112  if (!IsNode(NId)) {
2113  return -1;
2114  }
2115  return SAttrN.DelSAttrDat(NId, AttrId);
2116 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::DelSAttrDatN ( const TNodeI NodeI,
const TStr AttrName 
)
inline

Deletes sparse attribute with name AttrName from NodeI.

Definition at line 3549 of file network.h.

References TUndirNet::TNodeI::GetId().

3549  {
3550  return DelSAttrDatN(NodeI.GetId(), AttrName);
3551  }
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2104

Here is the call graph for this function:

int TUndirNet::DelSAttrDatN ( const TNodeI NodeI,
const TInt AttrId 
)
inline

Deletes sparse attribute with id AttrId from NodeI.

Definition at line 3553 of file network.h.

References TUndirNet::TNodeI::GetId().

3553  {
3554  return DelSAttrDatN(NodeI.GetId(), AttrId);
3555  }
int DelSAttrDatN(const TInt &NId, const TStr &AttrName)
Deletes sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2104

Here is the call graph for this function:

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

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

Definition at line 1997 of file network.cpp.

References edge, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TUndirNet::TNode::GetDeg(), TNEANet::GetEdges(), TUndirNet::TNode::GetId(), TUndirNet::TNode::GetNbrNId(), TNEANet::GetNodes(), and TNEANet::NodeH.

1997  {
1998  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
1999  fprintf(OutF, "-------------------------------------------------\nUndirected Node Graph: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
2000  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
2001  const TNode& Node = NodeH[N];
2002  fprintf(OutF, " %*d [%d] ", NodePlaces, Node.GetId(), Node.GetDeg());
2003  for (int edge = 0; edge < Node.GetDeg(); edge++) {
2004  fprintf(OutF, " %*d", NodePlaces, Node.GetNbrNId(edge)); }
2005  fprintf(OutF, "\n");
2006  }
2007  fprintf(OutF, "\n");
2008 }
THash< TInt, TNode > NodeH
Definition: network.h:3258
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:3324
int GetEdges() const
Returns the number of edges in the network.
Definition: network.cpp:1881

Here is the call graph for this function:

bool TUndirNet::Empty ( ) const
inline

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

Definition at line 3427 of file network.h.

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

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

Here is the call graph for this function:

TEdgeI TUndirNet::EndEI ( ) const
inline

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

Definition at line 3410 of file network.h.

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

3410 { return TEdgeI(EndNI(), EndNI()); }
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
Definition: network.h:3372

Here is the call graph for this function:

TNodeI TUndirNet::EndNI ( ) const
inline

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

Definition at line 3372 of file network.h.

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

3372 { return TNodeI(NodeH.EndI()); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TIter EndI() const
Definition: hash.h:218

Here is the call graph for this function:

int TUndirNet::GetEdges ( ) const

Returns the number of edges in the network.

Definition at line 1881 of file network.cpp.

1881  {
1882  //int Edges = 0;
1883  //for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
1884  // Edges += NodeH[N].GetDeg();
1885  //}
1886  //return Edges/2;
1887  return NEdges;
1888 }
TInt NEdges
Definition: network.h:3257
TEdgeI TUndirNet::GetEI ( const int &  EId) const

Not supported/implemented!

TUndirNet::TEdgeI TUndirNet::GetEI ( const int &  SrcNId,
const int &  DstNId 
) const

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

Note that since this is an undirected graph GetEI(SrcNId, DstNId) has the same effect as GetEI(DstNId, SrcNId).

Definition at line 1932 of file network.cpp.

References TNEANet::EndNI(), TNEANet::GetNI(), IAssert, TMath::Mn(), TMath::Mx(), TNEANet::MxNId, and TUndirNet::TNodeI::NodeHI.

1932  {
1933  const int MnNId = TMath::Mn(SrcNId, DstNId);
1934  const int MxNId = TMath::Mx(SrcNId, DstNId);
1935  const TNodeI SrcNI = GetNI(MnNId);
1936  const int NodeN = SrcNI.NodeHI.GetDat().NIdV.SearchBin(MxNId);
1937  IAssert(NodeN != -1);
1938  return TEdgeI(SrcNI, EndNI(), NodeN);
1939 }
#define IAssert(Cond)
Definition: bd.h:262
static const T & Mn(const T &LVal, const T &RVal)
Definition: xmath.h:36
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TInt MxNId
Definition: network.h:3257
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
Definition: network.h:3372
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the network.
Definition: network.h:3374

Here is the call graph for this function:

int TUndirNet::GetIdVSAttrE ( const TStr AttrName,
TIntPrV IdV 
) const

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

Definition at line 2274 of file network.cpp.

References TAttr::GetIdVSAttr(), and TNEANet::SAttrE.

2274  {
2275  return SAttrE.GetIdVSAttr(AttrName, IdV);
2276 }
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntPrV &IdV) const
Definition: attr.cpp:411
TAttrPair SAttrE
Definition: network.h:3261

Here is the call graph for this function:

int TUndirNet::GetIdVSAttrE ( const TInt AttrId,
TIntPrV IdV 
) const

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

Definition at line 2278 of file network.cpp.

References TAttr::GetIdVSAttr(), and TNEANet::SAttrE.

2278  {
2279  return SAttrE.GetIdVSAttr(AttrId, IdV);
2280 }
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntPrV &IdV) const
Definition: attr.cpp:411
TAttrPair SAttrE
Definition: network.h:3261

Here is the call graph for this function:

int TUndirNet::GetIdVSAttrN ( const TStr AttrName,
TIntV IdV 
) const

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

Definition at line 2126 of file network.cpp.

References TAttr::GetIdVSAttr(), and TNEANet::SAttrN.

2126  {
2127  return SAttrN.GetIdVSAttr(AttrName, IdV);
2128 }
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetIdVSAttrN ( const TInt AttrId,
TIntV IdV 
) const

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

Definition at line 2130 of file network.cpp.

References TAttr::GetIdVSAttr(), and TNEANet::SAttrN.

2130  {
2131  return SAttrN.GetIdVSAttr(AttrId, IdV);
2132 }
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetMxNId ( ) const
inline

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

Definition at line 3376 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::MxNId.

3376 { return MxNId; }
TInt MxNId
Definition: network.h:3257
TNodeI TUndirNet::GetNI ( const int &  NId) const
inline

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

Definition at line 3374 of file network.h.

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

3374 { return TNodeI(NodeH.GetI(NId)); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TIter GetI(const TKey &Key) const
Definition: hash.h:220

Here is the call graph for this function:

void TUndirNet::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the network.

Definition at line 1943 of file network.cpp.

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

1943  {
1944  NIdV.Gen(GetNodes(), 0);
1945  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
1946  NIdV.Add(NodeH.GetKey(N)); }
1947 }
THash< TInt, TNode > NodeH
Definition: network.h:3258
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
int GetNodes() const
Returns the number of nodes in the network.
Definition: network.h:3324
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

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

Definition at line 3263 of file network.h.

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

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

Here is the call graph for this function:

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

Definition at line 3264 of file network.h.

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

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

Here is the call graph for this function:

int TUndirNet::GetNodes ( ) const
inline

Returns the number of nodes in the network.

Definition at line 3324 of file network.h.

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

3324 { return NodeH.Len(); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

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

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

Definition at line 3422 of file network.h.

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

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

Here is the call graph for this function:

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

Returns an ID of a random node in the network.

Definition at line 3420 of file network.h.

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

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

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
TInt ValX 
) const

Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.

Definition at line 2201 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2201  {
2202  if (!IsEdge(SrcNId, DstNId)) {
2203  return -1;
2204  }
2205  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2206  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2207 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
TInt ValX 
) const

Gets Int sparse attribute with id AttrId from edge with ids SrcId and DstId.

Definition at line 2209 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2209  {
2210  if (!IsEdge(SrcNId, DstNId)) {
2211  return -1;
2212  }
2213  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2214  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2215 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TInt ValX 
) const
inline

Gets Int sparse attribute with name AttrName from EdgeI.

Definition at line 3625 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3625  {
3626  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, ValX);
3627  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TInt ValX 
) const
inline

Gets Int sparse attribute with id AttrId from EdgeI.

Definition at line 3629 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3629  {
3630  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, ValX);
3631  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
TFlt ValX 
) const

Gets Flt sparse attribute with name AttrName from edge with ids SrcId and DstId.

Definition at line 2217 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2217  {
2218  if (!IsEdge(SrcNId, DstNId)) {
2219  return -1;
2220  }
2221  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2222  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2223 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
TFlt ValX 
) const

Gets Flt sparse attribute with id AttrId from edge with ids SrcId and DstId.

Definition at line 2225 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2225  {
2226  if (!IsEdge(SrcNId, DstNId)) {
2227  return -1;
2228  }
2229  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2230  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2231 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with name AttrName from EdgeI.

Definition at line 3639 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3639  {
3640  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, ValX);
3641  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with id AttrId from EdgeI.

Definition at line 3643 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3643  {
3644  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, ValX);
3645  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TStr AttrName,
TStr ValX 
) const

Gets Str sparse attribute with name AttrName from edge with ids SrcId and DstId.

Definition at line 2233 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2233  {
2234  if (!IsEdge(SrcNId, DstNId)) {
2235  return -1;
2236  }
2237  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2238  return SAttrE.GetSAttrDat(EId, AttrName, Val);
2239 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const int &  SrcNId,
const int &  DstNId,
const TInt AttrId,
TStr ValX 
) const

Gets Str sparse attribute with id AttrId from edge with ids SrcId and DstId.

Definition at line 2241 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2241  {
2242  if (!IsEdge(SrcNId, DstNId)) {
2243  return -1;
2244  }
2245  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2246  return SAttrE.GetSAttrDat(EId, AttrId, Val);
2247 }
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TStr AttrName,
TStr ValX 
) const
inline

Gets Str sparse attribute with name AttrName from EdgeI.

Definition at line 3653 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3653  {
3654  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrName, ValX);
3655  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatE ( const TEdgeI EdgeI,
const TInt AttrId,
TStr ValX 
) const
inline

Gets Str sparse attribute with id AttrId from EdgeI.

Definition at line 3657 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3657  {
3658  return GetSAttrDatE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrId, ValX);
3659  }
int GetSAttrDatE(const int &SrcNId, const int &DstNId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from edge with ids SrcId and DstId.
Definition: network.cpp:2201

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TInt ValX 
) const

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

Definition at line 2062 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2062  {
2063  if (!IsNode(NId)) {
2064  return -1;
2065  }
2066  return SAttrN.GetSAttrDat(NId, AttrName, Val);
2067 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TInt ValX 
) const

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

Definition at line 2069 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2069  {
2070  if (!IsNode(NId)) {
2071  return -1;
2072  }
2073  return SAttrN.GetSAttrDat(NId, AttrId, Val);
2074 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TInt ValX 
) const
inline

Gets Int sparse attribute with name AttrName from NodeI.

Definition at line 3507 of file network.h.

References TUndirNet::TNodeI::GetId().

3507  {
3508  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3509  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TInt ValX 
) const
inline

Gets Int sparse attribute with id AttrId from NodeI.

Definition at line 3511 of file network.h.

References TUndirNet::TNodeI::GetId().

3511  {
3512  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3513  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TFlt ValX 
) const

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

Definition at line 2076 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2076  {
2077  if (!IsNode(NId)) {
2078  return -1;
2079  }
2080  return SAttrN.GetSAttrDat(NId, AttrName, Val);
2081 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TFlt ValX 
) const

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

Definition at line 2083 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2083  {
2084  if (!IsNode(NId)) {
2085  return -1;
2086  }
2087  return SAttrN.GetSAttrDat(NId, AttrId, Val);
2088 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with name AttrName from NodeI.

Definition at line 3521 of file network.h.

References TUndirNet::TNodeI::GetId().

3521  {
3522  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3523  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TFlt ValX 
) const
inline

Gets Flt sparse attribute with id AttrId from NodeI.

Definition at line 3525 of file network.h.

References TUndirNet::TNodeI::GetId().

3525  {
3526  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3527  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TStr AttrName,
TStr ValX 
) const

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

Definition at line 2090 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2090  {
2091  if (!IsNode(NId)) {
2092  return -1;
2093  }
2094  return SAttrN.GetSAttrDat(NId, AttrName, Val);
2095 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TInt NId,
const TInt AttrId,
TStr ValX 
) const

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

Definition at line 2097 of file network.cpp.

References TAttr::GetSAttrDat(), TNEANet::IsNode(), and TNEANet::SAttrN.

2097  {
2098  if (!IsNode(NId)) {
2099  return -1;
2100  }
2101  return SAttrN.GetSAttrDat(NId, AttrId, Val);
2102 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TStr AttrName,
TStr ValX 
) const
inline

Gets Str sparse attribute with name AttrName from NodeI.

Definition at line 3535 of file network.h.

References TUndirNet::TNodeI::GetId().

3535  {
3536  return GetSAttrDatN(NodeI.GetId(), AttrName, ValX);
3537  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrDatN ( const TNodeI NodeI,
const TInt AttrId,
TStr ValX 
) const
inline

Gets Str sparse attribute with id AttrId from NodeI.

Definition at line 3539 of file network.h.

References TUndirNet::TNodeI::GetId().

3539  {
3540  return GetSAttrDatN(NodeI.GetId(), AttrId, ValX);
3541  }
int GetSAttrDatN(const TInt &NId, const TStr &AttrName, TInt &ValX) const
Gets Int sparse attribute with name AttrName from node with id NId.
Definition: network.cpp:2062

Here is the call graph for this function:

int TUndirNet::GetSAttrIdE ( const TStr Name,
TInt AttrIdX,
TAttrType AttrTypeX 
) const

Gets id and type for attribute with name Name.

Definition at line 2286 of file network.cpp.

References TAttr::GetSAttrId(), and TNEANet::SAttrE.

2286  {
2287  return SAttrE.GetSAttrId(Name, AttrId, AttrType);
2288 }
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id and type.
Definition: attr.cpp:467
TAttrPair SAttrE
Definition: network.h:3261

Here is the call graph for this function:

int TUndirNet::GetSAttrIdN ( const TStr Name,
TInt AttrIdX,
TAttrType AttrTypeX 
) const

Gets id and type for attribute with name Name.

Definition at line 2138 of file network.cpp.

References TAttr::GetSAttrId(), and TNEANet::SAttrN.

2138  {
2139  return SAttrN.GetSAttrId(Name, AttrId, AttrType);
2140 }
TAttr SAttrN
Definition: network.h:3260
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id.
Definition: attr.cpp:224

Here is the call graph for this function:

int TUndirNet::GetSAttrNameE ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 2290 of file network.cpp.

References TAttr::GetSAttrName(), and TNEANet::SAttrE.

2290  {
2291  return SAttrE.GetSAttrName(AttrId, Name, AttrType);
2292 }
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name and type.
Definition: attr.cpp:477
TAttrPair SAttrE
Definition: network.h:3261

Here is the call graph for this function:

int TUndirNet::GetSAttrNameN ( const TInt AttrId,
TStr NameX,
TAttrType AttrTypeX 
) const

Gets name and type for attribute with id AttrId.

Definition at line 2142 of file network.cpp.

References TAttr::GetSAttrName(), and TNEANet::SAttrN.

2142  {
2143  return SAttrN.GetSAttrName(AttrId, Name, AttrType);
2144 }
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name.
Definition: attr.cpp:233
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrVE ( const int &  SrcNId,
const int &  DstNId,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const

Gets a list of all sparse attributes of type AttrType for edge with ids SrcId and DstId.

Definition at line 2265 of file network.cpp.

References TAttr::GetSAttrV(), TNEANet::IsEdge(), and TNEANet::SAttrE.

2265  {
2266  if (!IsEdge(SrcNId, DstNId)) {
2267  return -1;
2268  }
2269  TIntPr EId = OrderEdgeNodes(SrcNId, DstNId);
2270  SAttrE.GetSAttrV(EId, AttrType, AttrV);
2271  return 0;
2272 }
bool IsEdge(const int &SrcNId, const int &DstNId) const
Tests whether an edge between node IDs SrcNId and DstNId exists in the network.
Definition: network.cpp:1926
Definition: ds.h:32
TAttrPair SAttrE
Definition: network.h:3261
void GetSAttrV(const TIntPr &Id, const TAttrType AttrType, TAttrPrV &AttrV) const
Get a list of all attributes of the given type AttrType for the given id Id.
Definition: attr.cpp:383
TIntPr OrderEdgeNodes(const int &SrcNId, const int &DstNId) const
Definition: network.cpp:2146

Here is the call graph for this function:

int TUndirNet::GetSAttrVE ( const TEdgeI EdgeI,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const
inline

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

Definition at line 3677 of file network.h.

References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().

3677  {
3678  return GetSAttrVE(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), AttrType, AttrV);
3679  }
int GetSAttrVE(const int &SrcNId, const int &DstNId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for edge with ids SrcId and DstId...
Definition: network.cpp:2265

Here is the call graph for this function:

int TUndirNet::GetSAttrVN ( const TInt NId,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const

Gets a list of all sparse attributes of type AttrType for node with id NId.

Definition at line 2118 of file network.cpp.

References TAttr::GetSAttrV(), TNEANet::IsNode(), and TNEANet::SAttrN.

2118  {
2119  if (!IsNode(NId)) {
2120  return -1;
2121  }
2122  SAttrN.GetSAttrV(NId, AttrType, AttrV);
2123  return 0;
2124 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
void GetSAttrV(const TInt &Id, const TAttrType AttrType, TAttrPrV &AttrV) const
Get a list of all attributes of type AttrType for the given id Id.
Definition: attr.cpp:139
TAttr SAttrN
Definition: network.h:3260

Here is the call graph for this function:

int TUndirNet::GetSAttrVN ( const TNodeI NodeI,
const TAttrType  AttrType,
TAttrPrV AttrV 
) const
inline

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

Definition at line 3560 of file network.h.

References TUndirNet::TNodeI::GetId().

3560  {
3561  return GetSAttrVN(NodeI.GetId(), AttrType, AttrV);
3562  }
int GetSAttrVN(const TInt &NId, const TAttrType AttrType, TAttrPrV &AttrV) const
Gets a list of all sparse attributes of type AttrType for node with id NId.
Definition: network.cpp:2118

Here is the call graph for this function:

PUndirNet TUndirNet::GetSmallGraph ( )
static

Returns a small network on 5 nodes and 5 edges.

/// Graph:   3--0--4
///            /|
///           1-2
/// 

Definition at line 2011 of file network.cpp.

References New().

2011  {
2012  PUndirNet Graph = TUndirNet::New();
2013  for (int i = 0; i < 5; i++) { Graph->AddNode(i); }
2014  Graph->AddEdge(0,1); Graph->AddEdge(0,2);
2015  Graph->AddEdge(0,3); Graph->AddEdge(0,4);
2016  Graph->AddEdge(1,2);
2017  return Graph;
2018 }
static PUndirNet New()
Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New()...
Definition: network.h:3295
Definition: bd.h:196

Here is the call graph for this function:

bool TUndirNet::HasFlag ( const TGraphFlag Flag) const

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

Definition at line 1797 of file network.cpp.

References HasGraphFlag.

1797  {
1798  return HasGraphFlag(TUndirNet::TNet, Flag);
1799 }
#define HasGraphFlag(TGraph, Flag)
For quick testing of the properties of the graph/network object (see TGraphFlag). ...
Definition: gbase.h:41
Undirected network.
Definition: network.h:3145
bool TUndirNet::IsEdge ( const int &  SrcNId,
const int &  DstNId 
) const

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

Definition at line 1926 of file network.cpp.

References TNEANet::GetNode(), and TNEANet::IsNode().

1926  {
1927  if (! IsNode(SrcNId) || ! IsNode(DstNId)) return false;
1928  return GetNode(SrcNId).IsNbrNId(DstNId);
1929 }
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
TNode & GetNode(const int &NId)
Definition: network.h:3263
bool IsNbrNId(const int &NId) const
Definition: network.h:3167

Here is the call graph for this function:

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

Tests whether ID NId is a node.

Definition at line 3368 of file network.h.

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

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

Here is the call graph for this function:

bool TUndirNet::IsOk ( const bool &  ThrowExcept = true) const

Checks the network data structure for internal consistency.

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

Definition at line 1960 of file network.cpp.

References TNEANet::BegEI(), TStr::CStr(), EAssertR, TNEANet::EndEI(), ErrNotify(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TUndirNet::TNode::GetDeg(), TNEANet::GetEdges(), TUndirNet::TNode::GetId(), TUndirNet::TNode::GetNbrNId(), TNEANet::IsNode(), TVec< TVal, TSizeTy >::IsSorted(), TUndirNet::TNode::NIdV, and TNEANet::NodeH.

1960  {
1961  bool RetVal = true;
1962  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
1963  const TNode& Node = NodeH[N];
1964  if (! Node.NIdV.IsSorted()) {
1965  const TStr Msg = TStr::Fmt("Neighbor list of node %d is not sorted.", Node.GetId());
1966  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); }
1967  RetVal=false;
1968  }
1969  int prevNId = -1;
1970  for (int e = 0; e < Node.GetDeg(); e++) {
1971  if (! IsNode(Node.GetNbrNId(e))) {
1972  const TStr Msg = TStr::Fmt("Edge %d --> %d: node %d does not exist.",
1973  Node.GetId(), Node.GetNbrNId(e), Node.GetNbrNId(e));
1974  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); }
1975  RetVal=false;
1976  }
1977  if (e > 0 && prevNId == Node.GetNbrNId(e)) {
1978  const TStr Msg = TStr::Fmt("Node %d has duplicate edge %d --> %d.",
1979  Node.GetId(), Node.GetId(), Node.GetNbrNId(e));
1980  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); }
1981  RetVal=false;
1982  }
1983  prevNId = Node.GetNbrNId(e);
1984  }
1985  }
1986  int EdgeCnt = 0;
1987  for (TEdgeI EI = BegEI(); EI < EndEI(); EI++) { EdgeCnt++; }
1988  if (EdgeCnt != GetEdges()) {
1989  const TStr Msg = TStr::Fmt("Number of edges counter is corrupted: GetEdges():%d, EdgeCount:%d.", GetEdges(), EdgeCnt);
1990  if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); }
1991  RetVal=false;
1992  }
1993  return RetVal;
1994 }
THash< TInt, TNode > NodeH
Definition: network.h:3258
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:3368
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
int GetEdges() const
Returns the number of edges in the network.
Definition: network.cpp:1881
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TEdgeI EndEI() const
Returns an iterator referring to the past-the-end edge in the network.
Definition: network.h:3410
char * CStr()
Definition: dt.h:476
TEdgeI BegEI() const
Returns an iterator referring to the first edge in the network.
Definition: network.h:3408

Here is the call graph for this function:

static PUndirNet TUndirNet::Load ( TSIn SIn)
inlinestatic

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

Definition at line 3301 of file network.h.

3301 { return PUndirNet(new TUndirNet(SIn)); }
TUndirNet()
Definition: network.h:3282
TPt< TUndirNet > PUndirNet
Pointer to an undirected network (TUndirNet)
Definition: network.h:3120
static PUndirNet TUndirNet::Load_V1 ( TSIn SIn)
inlinestatic

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

Definition at line 3303 of file network.h.

3303  { PUndirNet Graph = PUndirNet(new TUndirNet());
3304  Graph->MxNId.Load(SIn); Graph->NEdges.Load(SIn); Graph->NodeH.Load(SIn); return Graph;
3305  }
TUndirNet()
Definition: network.h:3282
TPt< TUndirNet > PUndirNet
Pointer to an undirected network (TUndirNet)
Definition: network.h:3120
Definition: bd.h:196
void TUndirNet::LoadNetworkShM ( TShMIn ShMIn)
inlineprivate

Definition at line 3273 of file network.h.

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

Referenced by LoadShM().

3273  {
3274  MxNId = TInt(ShMIn);
3275  NEdges = TInt(ShMIn);
3276  LoadTNodeFunctor NodeFn;
3277  NodeH.LoadShM(ShMIn, NodeFn);
3278  SAttrN.Load(ShMIn);
3279  SAttrE = TAttrPair(ShMIn);
3280  }
THash< TInt, TNode > NodeH
Definition: network.h:3258
Definition: attr.h:98
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
Definition: hash.h:157
TInt MxNId
Definition: network.h:3257
Definition: dt.h:1134
TAttrPair SAttrE
Definition: network.h:3261
TAttr SAttrN
Definition: network.h:3260
void Load(TSIn &SIn)
Load attribute from input stream.
Definition: attr.h:25
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

Here is the caller graph for this function:

static PUndirNet TUndirNet::LoadShM ( TShMIn ShMIn)
inlinestatic

Static constructor that loads the network from memory.

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

Definition at line 3312 of file network.h.

References LoadNetworkShM().

3312  {
3313  TUndirNet* Network = new TUndirNet();
3314  Network->LoadNetworkShM(ShMIn);
3315  return PUndirNet(Network);
3316  }
void LoadNetworkShM(TShMIn &ShMIn)
Definition: network.h:3273
TUndirNet()
Definition: network.h:3282
TPt< TUndirNet > PUndirNet
Pointer to an undirected network (TUndirNet)
Definition: network.h:3120
Undirected network.
Definition: network.h:3145

Here is the call graph for this function:

static PUndirNet TUndirNet::New ( )
inlinestatic

Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New().

Definition at line 3295 of file network.h.

Referenced by GetSmallGraph().

3295 { return new TUndirNet(); }
TUndirNet()
Definition: network.h:3282

Here is the caller graph for this function:

static PUndirNet TUndirNet::New ( const int &  Nodes,
const int &  Edges 
)
inlinestatic

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

Call: PUndirNet Net = TUndirNet::New(Nodes, Edges).

Definition at line 3299 of file network.h.

3299 { return new TUndirNet(Nodes, Edges); }
TUndirNet()
Definition: network.h:3282
TUndirNet& TUndirNet::operator= ( const TUndirNet Graph)
inline

Definition at line 3320 of file network.h.

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

3320  {
3321  if (this!=&Graph) { MxNId=Graph.MxNId; NEdges=Graph.NEdges; NodeH=Graph.NodeH; } return *this; }
THash< TInt, TNode > NodeH
Definition: network.h:3258
TInt MxNId
Definition: network.h:3257
TInt NEdges
Definition: network.h:3257
TIntPr TUndirNet::OrderEdgeNodes ( const int &  SrcNId,
const int &  DstNId 
) const
private

Definition at line 2146 of file network.cpp.

2146  {
2147  if (SrcNId < DstNId) {
2148  return TIntPr(SrcNId, DstNId);
2149  }
2150  return TIntPr(DstNId, SrcNId);
2151 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
void TUndirNet::Reserve ( const int &  Nodes,
const int &  Edges 
)
inline

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

Definition at line 3431 of file network.h.

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

3431 { if (Nodes>0) NodeH.Gen(Nodes/2); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
void Gen(const int &ExpectVals)
Definition: hash.h:222

Here is the call graph for this function:

void TUndirNet::ReserveNIdDeg ( const int &  NId,
const int &  Deg 
)
inline

Reserves memory for node ID NId having Deg edges.

Definition at line 3433 of file network.h.

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

3433 { GetNode(NId).NIdV.Reserve(Deg); }
TNode & GetNode(const int &NId)
Definition: network.h:3263
void Reserve(const TSizeTy &_MxVals)
Reserves enough memory for the vector to store _MxVals elements.
Definition: ds.h:543

Here is the call graph for this function:

void TUndirNet::Save ( TSOut SOut) const
inline

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

Definition at line 3290 of file network.h.

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

3290  { MxNId.Save(SOut); NEdges.Save(SOut); NodeH.Save(SOut);
3291  SAttrN.Save(SOut); SAttrE.Save(SOut); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:118
TInt MxNId
Definition: network.h:3257
TAttrPair SAttrE
Definition: network.h:3261
void Save(TSOut &SOut) const
Saves the attributes to a (binary) stream SOut.
Definition: attr.h:33
TAttr SAttrN
Definition: network.h:3260
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

void TUndirNet::Save_V1 ( TSOut SOut) const
inline

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

Definition at line 3293 of file network.h.

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

3293 { MxNId.Save(SOut); NEdges.Save(SOut); NodeH.Save(SOut); }
THash< TInt, TNode > NodeH
Definition: network.h:3258
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
TInt MxNId
Definition: network.h:3257
TInt NEdges
Definition: network.h:3257

Here is the call graph for this function:

void TUndirNet::SortNodeAdjV ( )
inline

Sorts the adjacency lists of each node.

Definition at line 3435 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::BegNI(), and TNodeEdgeNet< TNodeData, TEdgeData >::EndNI().

3435 { for (TNodeI NI = BegNI(); NI < EndNI(); NI++) { NI.SortNIdV();} }
TNodeI BegNI() const
Returns an iterator referring to the first node in the network.
Definition: network.h:3370
TNodeI EndNI() const
Returns an iterator referring to the past-the-end node in the network.
Definition: network.h:3372

Here is the call graph for this function:

Friends And Related Function Documentation

friend class TPt< TUndirNet >
friend

Definition at line 3695 of file network.h.

friend class TUndirNetMtx
friend

Definition at line 3694 of file network.h.

Member Data Documentation

TCRef TUndirNet::CRef
private

Definition at line 3256 of file network.h.

TInt TUndirNet::MxNId
private

Definition at line 3257 of file network.h.

Referenced by operator=().

TInt TUndirNet::NEdges
private

Definition at line 3257 of file network.h.

Referenced by operator=().

THash<TInt, TNode> TUndirNet::NodeH
private

Definition at line 3258 of file network.h.

Referenced by operator=().

TAttrPair TUndirNet::SAttrE
private

Definition at line 3261 of file network.h.

TAttr TUndirNet::SAttrN
private

Definition at line 3260 of file network.h.


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