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
|
Undirected network. More...
#include <network.h>
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< TUndirNet > | PNet |
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... | |
TUndirNet & | operator= (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 | |
TNode & | GetNode (const int &NId) |
const TNode & | GetNode (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, TNode > | NodeH |
TAttr | SAttrN |
TAttrPair | SAttrE |
Friends | |
class | TUndirNetMtx |
class | TPt< TUndirNet > |
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.
typedef TPt<TUndirNet> TUndirNet::PNet |
typedef TUndirNet TUndirNet::TNet |
|
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().
|
inline |
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().
|
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().
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().
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.
|
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().
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().
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().
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.
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.
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.
|
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().
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().
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.
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.
|
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().
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().
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.
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.
|
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().
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().
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.
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.
|
inline |
Adds Int sparse attribute with name AttrName
to NodeI
.
Definition at line 3465 of file network.h.
References TUndirNet::TNodeI::GetId().
Adds Int sparse attribute with id AttrId
to NodeI
.
Definition at line 3469 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
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.
|
inline |
Adds Flt sparse attribute with name AttrName
to NodeI
.
Definition at line 3479 of file network.h.
References TUndirNet::TNodeI::GetId().
Adds Flt sparse attribute with id AttrId
to NodeI
.
Definition at line 3483 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
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.
|
inline |
Adds Str sparse attribute with name AttrName
to NodeI
.
Definition at line 3493 of file network.h.
References TUndirNet::TNodeI::GetId().
Adds Str sparse attribute with id AttrId
to NodeI
.
Definition at line 3497 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
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.
|
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().
|
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.
|
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.
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().
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().
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().
|
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().
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.
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.
Deletes sparse attribute with name AttrName
from EdgeI
.
Definition at line 3667 of file network.h.
References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().
Deletes sparse attribute with id AttrId
from EdgeI
.
Definition at line 3671 of file network.h.
References TUndirNet::TEdgeI::GetDstNId(), and TUndirNet::TEdgeI::GetSrcNId().
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.
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.
Deletes sparse attribute with name AttrName
from NodeI
.
Definition at line 3549 of file network.h.
References TUndirNet::TNodeI::GetId().
Deletes sparse attribute with id AttrId
from NodeI
.
Definition at line 3553 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
|
inline |
Tests whether the network is empty (has zero nodes).
Definition at line 3427 of file network.h.
References TNodeEdgeNet< TNodeData, TEdgeData >::GetNodes().
|
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().
|
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.
int TUndirNet::GetEdges | ( | ) | const |
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.
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.
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.
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.
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.
|
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.
|
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.
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.
|
inlineprivate |
Definition at line 3263 of file network.h.
References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inlineprivate |
Definition at line 3264 of file network.h.
References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
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.
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().
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.
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.
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.
|
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().
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().
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.
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.
|
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().
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().
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.
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.
|
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().
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().
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.
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.
|
inline |
Gets Int sparse attribute with name AttrName
from NodeI
.
Definition at line 3507 of file network.h.
References TUndirNet::TNodeI::GetId().
Gets Int sparse attribute with id AttrId
from NodeI
.
Definition at line 3511 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
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.
|
inline |
Gets Flt sparse attribute with name AttrName
from NodeI
.
Definition at line 3521 of file network.h.
References TUndirNet::TNodeI::GetId().
Gets Flt sparse attribute with id AttrId
from NodeI
.
Definition at line 3525 of file network.h.
References TUndirNet::TNodeI::GetId().
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.
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.
|
inline |
Gets Str sparse attribute with name AttrName
from NodeI
.
Definition at line 3535 of file network.h.
References TUndirNet::TNodeI::GetId().
Gets Str sparse attribute with id AttrId
from NodeI
.
Definition at line 3539 of file network.h.
References TUndirNet::TNodeI::GetId().
Gets id and type for attribute with name Name
.
Definition at line 2286 of file network.cpp.
References TAttr::GetSAttrId(), and TNEANet::SAttrE.
Gets id and type for attribute with name Name
.
Definition at line 2138 of file network.cpp.
References TAttr::GetSAttrId(), and TNEANet::SAttrN.
Gets name and type for attribute with id AttrId
.
Definition at line 2290 of file network.cpp.
References TAttr::GetSAttrName(), and TNEANet::SAttrE.
Gets name and type for attribute with id AttrId
.
Definition at line 2142 of file network.cpp.
References TAttr::GetSAttrName(), and TNEANet::SAttrN.
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.
|
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().
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.
|
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().
|
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().
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.
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().
|
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.
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.
Static constructor that loads the network from a stream SIn and returns a pointer to it.
Definition at line 3301 of file network.h.
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.
|
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().
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().
|
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().
|
inlinestatic |
|
private |
|
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.
|
inline |
Reserves memory for node ID NId having Deg edges.
Definition at line 3433 of file network.h.
References TNodeEdgeNet< TNodeData, TEdgeData >::GetNode().
|
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().
|
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().
|
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().
|
private |
Definition at line 3257 of file network.h.
Referenced by operator=().
|
private |
Definition at line 3257 of file network.h.
Referenced by operator=().
Definition at line 3258 of file network.h.
Referenced by operator=().