SNAP Library 4.1, Developer Reference
2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Node Edge Network (directed multigraph, TNEGraph with data on nodes and edges). More...
#include <network.h>
Classes | |
class | LoadTNodeFunctor |
class | TEdge |
class | TEdgeI |
Edge iterator. Only forward iteration (operator++) is supported. More... | |
class | TNode |
class | TNodeI |
Node iterator. Only forward iteration (operator++) is supported. More... | |
Public Types | |
typedef TNodeData | TNodeDat |
typedef TEdgeData | TEdgeDat |
typedef TNodeEdgeNet < TNodeData, TEdgeData > | TNet |
typedef TPt< TNet > | PNet |
Public Member Functions | |
TNodeEdgeNet () | |
TNodeEdgeNet (const int &Nodes, const int &Edges) | |
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges. More... | |
TNodeEdgeNet (const TNodeEdgeNet &Net) | |
TNodeEdgeNet (TSIn &SIn) | |
Constructor that loads the network from a (binary) stream SIn. More... | |
virtual | ~TNodeEdgeNet () |
virtual void | Save (TSOut &SOut) const |
Saves the network to a (binary) stream SOut. More... | |
bool | HasFlag (const TGraphFlag &Flag) const |
Allows for run-time checking the type of the network (see the TGraphFlag for flags). More... | |
TNodeEdgeNet & | operator= (const TNodeEdgeNet &Net) |
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 (int NId, const TNodeData &NodeDat) |
Adds node data to node with ID NId. More... | |
int | AddNode (const TNodeI &NodeI) |
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... | |
void | SetNDat (const int &NId, const TNodeData &NodeDat) |
Sets node data for the node of ID NId in the network. More... | |
TNodeData & | GetNDat (const int &NId) |
Returns node data for the node of ID NId in the network. More... | |
const TNodeData & | GetNDat (const int &NId) const |
Returns node data for 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 | GetUniqEdges (const bool &IsDir=true) const |
Returns the number of edges in the network with a unique pair of nodes. More... | |
int | AddEdge (const int &SrcNId, const int &DstNId, int EId=-1) |
Adds an edge between node IDs SrcNId and DstNId to the graph. More... | |
int | AddEdge (const int &SrcNId, const int &DstNId, int EId, const TEdgeData &EdgeDat) |
Adds an edge and edge data from node IDs SrcNId to node DstNId. More... | |
int | AddEdge (const TEdgeI &EdgeI) |
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() and its edge data to the network. More... | |
void | DelEdge (const int &EId) |
Deletes an edge with ID EId from the network. More... | |
void | DelEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) |
Deletes an edge from node IDs SrcNId to DstNId from the network. More... | |
bool | IsEdge (const int &EId) const |
Tests whether an edge with ID EId exists in the network. More... | |
bool | IsEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) const |
Tests whether an edge from node IDs SrcNId to DstNId exists in the network. More... | |
bool | IsEdge (const int &SrcNId, const int &DstNId, int &EId, const bool &IsDir=true) const |
Tests whether an edge from node IDs SrcNId to DstNId with edge ID EId exists in the network. More... | |
int | GetEId (const int &SrcNId, const int &DstNId) const |
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 graph. More... | |
void | SetEDat (const int &EId, const TEdgeData &EdgeDat) |
Sets edge data for the edge of ID NId in the network. More... | |
TEdgeData & | GetEDat (const int &EId) |
Returns edge data for the edge with ID EId. More... | |
const TEdgeData & | GetEDat (const int &EId) const |
Returns edge data for the edge with ID EId. More... | |
void | SetAllEDat (const TEdgeData &EdgeDat) |
Sets edge data for all the edges in the network to EDat. 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... | |
int | GetRndEId (TRnd &Rnd=TInt::Rnd) |
Returns an ID of a random edge in the network. More... | |
TEdgeI | GetRndEI (TRnd &Rnd=TInt::Rnd) |
Returns an interator referring to a random edge in the network. More... | |
void | GetNIdV (TIntV &NIdV) const |
Returns a vector of all node IDs in the network. More... | |
void | GetEIdV (TIntV &EIdV) const |
Returns a vector of all edge IDs 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 | SortNIdById (const bool &Asc=true) |
Sorts nodes by node IDs. More... | |
void | SortNIdByDat (const bool &Asc=true) |
Sorts nodes by node data. More... | |
void | SortEIdById (const bool &Asc=true) |
Sorts edges by edge IDs. More... | |
void | SortEIdByDat (const bool &Asc=true) |
Sorts edges by edge data. 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... | |
Static Public Member Functions | |
static PNet | New () |
Static constructor that returns a pointer to the network. More... | |
static PNet | Load (TSIn &SIn) |
Static constructor that loads the network from a stream SIn and returns a pointer to it. More... | |
static PNet | LoadShM (TShMIn &ShMIn) |
Static constructor that loads the network from memory. More... | |
Protected Attributes | |
TCRef | CRef |
TInt | MxNId |
TInt | MxEId |
THash< TInt, TNode > | NodeH |
THash< TInt, TEdge > | EdgeH |
Private Member Functions | |
TNode & | GetNode (const int &NId) |
const TNode & | GetNode (const int &NId) const |
const TNode & | GetNodeKId (const int &NodeKeyId) const |
TEdge & | GetEdge (const int &EId) |
const TEdge & | GetEdge (const int &EId) const |
const TEdge & | GetEdgeKId (const int &EdgeKeyId) const |
void | LoadNetworkShM (TShMIn &ShMIn) |
Friends | |
class | TCrossNet |
Adds a node NodeI and its node data to the network. More... | |
class | TPt< TNodeEdgeNet< TNodeData, TEdgeData > > |
Node Edge Network (directed multigraph, TNEGraph with data on nodes and edges).
typedef TPt<TNet> TNodeEdgeNet< TNodeData, TEdgeData >::PNet |
typedef TEdgeData TNodeEdgeNet< TNodeData, TEdgeData >::TEdgeDat |
typedef TNodeEdgeNet<TNodeData, TEdgeData> TNodeEdgeNet< TNodeData, TEdgeData >::TNet |
typedef TNodeData TNodeEdgeNet< TNodeData, TEdgeData >::TNodeDat |
|
inline |
|
inlineexplicit |
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
Definition at line 1278 of file network.h.
|
inline |
|
inline |
|
inlinevirtual |
int TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
int | EId = -1 |
||
) |
Adds an edge between node IDs SrcNId and DstNId to the graph.
Returns the ID of the edge being added. If EId is -1, edge ID is automatically assigned. Aborts, if an edge with ID EId already exists. Aborts, if SrcNId or DstNId are not nodes in the graph.
Definition at line 1557 of file network.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::AddSorted(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, TStr::Fmt(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), IAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TMath::Mx(), TNodeEdgeNet< TNodeData, TEdgeData >::MxEId, and TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV.
Referenced by TTimeNENet::GetESubGraph(), TTimeNENet::GetGraphUpToTm(), and TTimeNENet::GetSubGraph().
int TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
int | EId, | ||
const TEdgeData & | EdgeDat | ||
) |
Adds an edge and edge data from node IDs SrcNId to node DstNId.
Returns the ID of the edge being added. If EId is -1, edge ID is automatically assigned. Aborts, if an edge with ID EId already exists. Aborts, if SrcNId or DstNId are not nodes in the graph.
Definition at line 1569 of file network.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::AddSorted(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, TStr::Fmt(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), IAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TMath::Mx(), TNodeEdgeNet< TNodeData, TEdgeData >::MxEId, and TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV.
|
inline |
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() and its edge data to the network.
Definition at line 1372 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::AddEdge().
int TNodeEdgeNet< TNodeData, TEdgeData >::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 1483 of file network.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TStr::Fmt(), IAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TMath::Mx(), TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
Referenced by TTimeNENet::GetESubGraph(), TTimeNENet::GetGraphUpToTm(), and TTimeNENet::GetSubGraph().
int TNodeEdgeNet< TNodeData, TEdgeData >::AddNode | ( | int | NId, |
const TNodeData & | NodeDat | ||
) |
Adds node data to node with ID NId.
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 1507 of file network.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TStr::Fmt(), IAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TMath::Mx(), TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inline |
Definition at line 1328 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::AddNode().
int TNodeEdgeNet< TNodeData, TEdgeData >::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 1495 of file network.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TMath::Mx(), TNodeEdgeNet< TNodeData, TEdgeData >::MxNId, and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inline |
Returns an iterator referring to the first edge in the network.
Definition at line 1389 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges(), and TNodeEdgeNet< TNodeData, TEdgeData >::SetAllEDat().
|
inline |
Returns an iterator referring to the first node in the network.
Definition at line 1338 of file network.h.
Referenced by TUndirNet::BegEI(), TDirNet::BegEI(), TUndirNet::SortNodeAdjV(), and TDirNet::SortNodeAdjV().
|
inline |
Deletes all nodes and edges from the network.
Definition at line 1421 of file network.h.
void TNodeEdgeNet< TNodeData, TEdgeData >::Defrag | ( | const bool & | OnlyNodeLinks = false | ) |
Defragments the network.
After performing many node and edge insertions and deletions to a network, the network data structure will be fragmented in memory. This function compacts down the network data structure and frees unneeded memory.
Definition at line 1650 of file network.h.
References THash< TKey, TDat, THashFunc >::Defrag(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN(), TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV, and TVec< TVal, TSizeTy >::Pack().
Referenced by TTimeNENet::GetESubGraph(), TTimeNENet::GetGraphUpToTm(), and TTimeNENet::GetSubGraph().
void TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge | ( | const int & | EId | ) |
Deletes an edge with ID EId from the network.
Definition at line 1581 of file network.h.
References TVec< TVal, TSizeTy >::DelIfIn(), THash< TKey, TDat, THashFunc >::DelKey(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetDstNId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetSrcNId(), IAssert, TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), and TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV.
void TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
const bool & | IsDir = true |
||
) |
Deletes an edge from node IDs SrcNId to DstNId from the network.
If the edge (SrcNId, DstNId) does not exist in the network function still completes. But the function aborts if SrcNId or DstNId are not nodes in the network.
Definition at line 1591 of file network.h.
References TVec< TVal, TSizeTy >::DelIfIn(), THash< TKey, TDat, THashFunc >::DelKey(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), IAssert, TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), and TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV.
void TNodeEdgeNet< TNodeData, TEdgeData >::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 1519 of file network.h.
References THash< TKey, TDat, THashFunc >::DelKey(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetDstNId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInEId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutEId(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetSrcNId(), IAssert, and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inline |
Deletes node of ID NodeI.GetId() from the network.
Definition at line 1334 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::DelNode().
|
inline |
Tests whether the network is empty (has zero nodes).
Definition at line 1419 of file network.h.
|
inline |
Returns an iterator referring to the past-the-end edge in the network.
Definition at line 1391 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges(), and TNodeEdgeNet< TNodeData, TEdgeData >::SetAllEDat().
|
inline |
Returns an iterator referring to the past-the-end node in the network.
Definition at line 1340 of file network.h.
Referenced by TUndirNet::BegEI(), TDirNet::BegEI(), TUndirNet::EndEI(), TDirNet::EndEI(), TUndirNet::SortNodeAdjV(), and TDirNet::SortNodeAdjV().
|
inline |
Returns edge data for the edge with ID EId.
Definition at line 1399 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEDat(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEDat().
|
inline |
|
inlineprivate |
Definition at line 1253 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelNode(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNId(), TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), and TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsInNId().
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns the number of edges in the network.
Definition at line 1354 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::GetEIdV(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges().
|
inline |
Not supported/implemented!
Definition at line 1393 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetRndEI(), TNEANet::GetRndEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::SetEDat().
|
inline |
Returns an iterator referring to edge (SrcNId, DstNId) in the graph.
Definition at line 1395 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetEI().
|
inline |
Definition at line 1387 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetEI(), and TNEANet::GetEI().
void TNodeEdgeNet< TNodeData, TEdgeData >::GetEIdV | ( | TIntV & | EIdV | ) | const |
Returns a vector of all edge IDs in the network.
Definition at line 1642 of file network.h.
References TVec< TVal, TSizeTy >::Add(), TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEdges(), and THash< TKey, TDat, THashFunc >::GetKey().
|
inline |
|
inline |
Returns node data for the node of ID NId in the network.
Definition at line 1346 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::TEdgeI::GetDstNDat(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNDat(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNDat(), TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::TEdgeI::GetSrcNDat().
|
inline |
|
inline |
Returns an iterator referring to the node of ID NId in the network.
Definition at line 1342 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetRndNI(), TNEANet::GetRndNI(), TUndirNet::GetRndNI(), and TDirNet::GetRndNI().
void TNodeEdgeNet< TNodeData, TEdgeData >::GetNIdV | ( | TIntV & | NIdV | ) | const |
Returns a vector of all node IDs in the network.
Definition at line 1634 of file network.h.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), THash< TKey, TDat, THashFunc >::GetKey(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNodes(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inlineprivate |
Definition at line 1250 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelNode(), TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), TUndirNet::ReserveNIdDeg(), TDirNet::ReserveNIdInDeg(), and TDirNet::ReserveNIdOutDeg().
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns the number of nodes in the network.
Definition at line 1307 of file network.h.
Referenced by TUndirNet::BegEI(), TNodeEdgeNet< TSecTm, TSecTm >::Empty(), TNEANet::Empty(), TUndirNet::Empty(), TDirNet::Empty(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetNIdV().
|
inline |
Returns an interator referring to a random edge in the network.
Definition at line 1412 of file network.h.
|
inline |
Returns an ID of a random edge in the network.
Definition at line 1410 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetRndEI(), and TNEANet::GetRndEI().
|
inline |
Returns an interator referring to a random node in the network.
Definition at line 1408 of file network.h.
|
inline |
Returns an ID of a random node in the network.
Definition at line 1406 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::GetRndNI(), TNEANet::GetRndNI(), TUndirNet::GetRndNI(), and TDirNet::GetRndNI().
int TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges | ( | const bool & | IsDir = true | ) | const |
Returns the number of edges in the network with a unique pair of nodes.
Definition at line 1545 of file network.h.
References THashSet< TKey, THashFunc >::AddKey(), TNodeEdgeNet< TNodeData, TEdgeData >::BegEI(), TNodeEdgeNet< TNodeData, TEdgeData >::EndEI(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEdges(), THashSet< TKey, THashFunc >::Len(), TMath::Mn(), and TMath::Mx().
bool TNodeEdgeNet< TNodeData, TEdgeData >::HasFlag | ( | const TGraphFlag & | Flag | ) | const |
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
Definition at line 1458 of file network.h.
References HasGraphFlag.
|
inline |
Tests whether an edge with ID EId exists in the network.
Definition at line 1382 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge(), TNodeEdgeNet< TSecTm, TSecTm >::GetEId(), TNEANet::GetEId(), TNodeEdgeNet< TNodeData, TEdgeData >::IsOk(), and TNodeEdgeNet< TNodeData, TEdgeData >::SetEDat().
|
inline |
Tests whether an edge from node IDs SrcNId to DstNId exists in the network.
Definition at line 1384 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::IsEdge().
bool TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
int & | EId, | ||
const bool & | IsDir = true |
||
) | const |
Tests whether an edge from node IDs SrcNId to DstNId with edge ID EId exists in the network.
Definition at line 1600 of file network.h.
References edge, TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetDstNId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInEId(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNode(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutEId(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetSrcNId(), and TNodeEdgeNet< TNodeData, TEdgeData >::IsNode().
|
inline |
Tests whether ID NId is a node.
Definition at line 1336 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNode(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNodeUnchecked(), TTimeNENet::GetESubGraph(), TTimeNENet::GetGraphUpToTm(), TTimeNENet::GetSubGraph(), TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::IsOk(), and TNodeEdgeNet< TNodeData, TEdgeData >::SetNDat().
bool TNodeEdgeNet< TNodeData, TEdgeData >::IsOk | ( | const bool & | ThrowExcept = true | ) | const |
Checks the network data structure for internal consistency.
For each node in the network check that its neighbors are also nodes in the network.
Definition at line 1660 of file network.h.
References TStr::CStr(), EAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, ErrNotify(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetDstNId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetId(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetInEId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutDeg(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::GetOutEId(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdge::GetSrcNId(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::InEIdV, TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TVec< TVal, TSizeTy >::IsSorted(), TNodeEdgeNet< TNodeData, TEdgeData >::NodeH, and TNodeEdgeNet< TNodeData, TEdgeData >::TNode::OutEIdV.
|
inlinestatic |
|
inlineprivate |
Definition at line 1268 of file network.h.
Referenced by TNodeEdgeNet< TSecTm, TSecTm >::LoadShM().
|
inlinestatic |
|
inlinestatic |
Static constructor that returns a pointer to the network.
Call with: TPt <TNodeEdgeNet<TNodeData, TEdgeData> > Net = TNodeEdgeNet<TNodeData, TEdgeData>::New().
Definition at line 1288 of file network.h.
|
inline |
|
inline |
Reserves memory for a network of Nodes nodes and Edges edges.
Definition at line 1423 of file network.h.
Referenced by TTimeNENet::GetESubGraph(), TTimeNENet::GetSubGraph(), TDirNet::TDirNet(), TNEANet::TNEANet(), TNodeEdgeNet< TSecTm, TSecTm >::TNodeEdgeNet(), and TUndirNet::TUndirNet().
|
inlinevirtual |
Saves the network to a (binary) stream SOut.
Reimplemented in TTimeNENet.
Definition at line 1284 of file network.h.
void TNodeEdgeNet< TNodeData, TEdgeData >::SetAllEDat | ( | const TEdgeData & | EdgeDat | ) |
Sets edge data for all the edges in the network to EDat.
Definition at line 1626 of file network.h.
References TNodeEdgeNet< TNodeData, TEdgeData >::BegEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::EndEI().
void TNodeEdgeNet< TNodeData, TEdgeData >::SetEDat | ( | const int & | EId, |
const TEdgeData & | EdgeDat | ||
) |
Sets edge data for the edge of ID NId in the network.
Definition at line 1620 of file network.h.
References TStr::Fmt(), TNodeEdgeNet< TNodeData, TEdgeData >::TEdgeI::GetDat(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEI(), IAssertR, and TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge().
void TNodeEdgeNet< TNodeData, TEdgeData >::SetNDat | ( | const int & | NId, |
const TNodeData & | NodeDat | ||
) |
Sets node data for the node of ID NId in the network.
Definition at line 1539 of file network.h.
References TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), IAssertR, TNodeEdgeNet< TNodeData, TEdgeData >::IsNode(), TNodeEdgeNet< TNodeData, TEdgeData >::TNode::NodeDat, and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
protected |
|
protected |
Definition at line 1260 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNodeEdgeNet< TSecTm, TSecTm >::BegEI(), TNEANet::BegEI(), TNodeEdgeNet< TSecTm, TSecTm >::Clr(), TNEANet::Clr(), TNodeEdgeNet< TNodeData, TEdgeData >::Defrag(), TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelNode(), TNodeEdgeNet< TSecTm, TSecTm >::EndEI(), TNEANet::EndEI(), TNEANet::GetEAFltI(), TNEANet::GetEAIntI(), TNEANet::GetEAIntVI(), TNEANet::GetEAStrI(), TNodeEdgeNet< TSecTm, TSecTm >::GetEDat(), TNodeEdgeNet< TSecTm, TSecTm >::GetEdge(), TNEANet::GetEdge(), TNodeEdgeNet< TSecTm, TSecTm >::GetEdgeKId(), TNodeEdgeNet< TSecTm, TSecTm >::GetEdges(), TNEANet::GetEdges(), TNodeEdgeNet< TSecTm, TSecTm >::GetEI(), TNEANet::GetEI(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEIdV(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndEId(), TNEANet::GetRndEId(), TNodeEdgeNet< TSecTm, TSecTm >::IsEdge(), TNEANet::IsEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::IsOk(), TNodeEdgeNet< TSecTm, TSecTm >::LoadNetworkShM(), TNodeEdgeNet< TSecTm, TSecTm >::operator=(), TNEANet::operator=(), TNodeEdgeNet< TSecTm, TSecTm >::Reserve(), TNEANet::Reserve(), TNodeEdgeNet< TSecTm, TSecTm >::Save(), TNEANet::Save(), TNEANet::Save_V1(), TNEANet::Save_V2(), TNodeEdgeNet< TSecTm, TSecTm >::SortEIdByDat(), and TNodeEdgeNet< TSecTm, TSecTm >::SortEIdById().
|
protected |
Definition at line 1258 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNodeEdgeNet< TSecTm, TSecTm >::Clr(), TNEANet::Clr(), TNEANet::GetMxEId(), TNodeEdgeNet< TSecTm, TSecTm >::LoadNetworkShM(), TNodeEdgeNet< TSecTm, TSecTm >::operator=(), TNEANet::operator=(), TNodeEdgeNet< TSecTm, TSecTm >::Save(), TNEANet::Save(), TNEANet::Save_V1(), and TNEANet::Save_V2().
|
protected |
Definition at line 1258 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddNode(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNodeUnchecked(), TNodeEdgeNet< TSecTm, TSecTm >::Clr(), TNEANet::Clr(), TUndirNet::Clr(), TDirNet::Clr(), TNodeEdgeNet< TSecTm, TSecTm >::GetMxNId(), TNEANet::GetMxNId(), TUndirNet::GetMxNId(), TDirNet::GetMxNId(), TNodeEdgeNet< TSecTm, TSecTm >::LoadNetworkShM(), TUndirNet::LoadNetworkShM(), TDirNet::LoadNetworkShM(), TNodeEdgeNet< TSecTm, TSecTm >::operator=(), TNEANet::operator=(), TUndirNet::operator=(), TDirNet::operator=(), TNodeEdgeNet< TSecTm, TSecTm >::Save(), TNEANet::Save(), TUndirNet::Save(), TDirNet::Save(), TNEANet::Save_V1(), TUndirNet::Save_V1(), TDirNet::Save_V1(), and TNEANet::Save_V2().
|
protected |
Definition at line 1259 of file network.h.
Referenced by TNodeEdgeNet< TNodeData, TEdgeData >::AddNode(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNodeUnchecked(), TNodeEdgeNet< TSecTm, TSecTm >::BegNI(), TNEANet::BegNI(), TUndirNet::BegNI(), TDirNet::BegNI(), TNodeEdgeNet< TSecTm, TSecTm >::Clr(), TNEANet::Clr(), TUndirNet::Clr(), TDirNet::Clr(), TNodeEdgeNet< TNodeData, TEdgeData >::Defrag(), TNodeEdgeNet< TNodeData, TEdgeData >::DelNode(), TNodeEdgeNet< TSecTm, TSecTm >::EndNI(), TNEANet::EndNI(), TUndirNet::EndNI(), TDirNet::EndNI(), TNEANet::GetNAFltI(), TNEANet::GetNAIntI(), TNEANet::GetNAIntVI(), TNEANet::GetNAStrI(), TNodeEdgeNet< TSecTm, TSecTm >::GetNDat(), TNodeEdgeNet< TSecTm, TSecTm >::GetNI(), TNEANet::GetNI(), TUndirNet::GetNI(), TDirNet::GetNI(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNIdV(), TNodeEdgeNet< TSecTm, TSecTm >::GetNode(), TNEANet::GetNode(), TUndirNet::GetNode(), TDirNet::GetNode(), TNodeEdgeNet< TSecTm, TSecTm >::GetNodeKId(), TNodeEdgeNet< TSecTm, TSecTm >::GetNodes(), TNEANet::GetNodes(), TUndirNet::GetNodes(), TDirNet::GetNodes(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndNId(), TNEANet::GetRndNId(), TUndirNet::GetRndNId(), TDirNet::GetRndNId(), TNodeEdgeNet< TSecTm, TSecTm >::IsNode(), TNEANet::IsNode(), TUndirNet::IsNode(), TDirNet::IsNode(), TNodeEdgeNet< TNodeData, TEdgeData >::IsOk(), TNodeEdgeNet< TSecTm, TSecTm >::LoadNetworkShM(), TUndirNet::LoadNetworkShM(), TDirNet::LoadNetworkShM(), TNodeEdgeNet< TSecTm, TSecTm >::operator=(), TNEANet::operator=(), TUndirNet::operator=(), TDirNet::operator=(), TNodeEdgeNet< TSecTm, TSecTm >::Reserve(), TNEANet::Reserve(), TUndirNet::Reserve(), TDirNet::Reserve(), TNodeEdgeNet< TSecTm, TSecTm >::Save(), TNEANet::Save(), TUndirNet::Save(), TDirNet::Save(), TNEANet::Save_V1(), TUndirNet::Save_V1(), TDirNet::Save_V1(), TNEANet::Save_V2(), TNodeEdgeNet< TNodeData, TEdgeData >::SetNDat(), TNodeEdgeNet< TSecTm, TSecTm >::SortNIdByDat(), and TNodeEdgeNet< TSecTm, TSecTm >::SortNIdById().