SNAP Library 3.0, User Reference
2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Directed network. More...
#include <network.h>
Classes | |
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 TDirNet | TNet |
typedef TPt< TDirNet > | PNet |
Public Member Functions | |
TDirNet () | |
TDirNet (const int &Nodes, const int &Edges) | |
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges. More... | |
TDirNet (const TDirNet &Graph) | |
TDirNet (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... | |
TDirNet & | operator= (const TDirNet &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 | AddNode (const TNodeI &NodeId) |
Adds a node of ID NodeI.GetId() to the network. More... | |
int | AddNode (const int &NId, const TIntV &InNIdV, const TIntV &OutNIdV) |
Adds a node of ID NId to the network, creates edges to the node from all nodes in vector InNIdV, creates edges from the node to all nodes in vector OutNIdV. More... | |
int | AddNode (const int &NId, const TVecPool< TInt > &Pool, const int &SrcVId, const int &DstVId) |
Adds a node of ID NId to the network, creates edges to the node from all nodes in vector InNIdV in the vector pool Pool, creates edges from the node to all nodes in vector OutNIdVin 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 from node IDs SrcNId to node DstNId to the network. More... | |
int | AddEdge (const TEdgeI &EdgeI) |
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() to 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 &SrcNId, const int &DstNId, const bool &IsDir=true) const |
Tests whether an edge from node IDs SrcNId to 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 | ReserveNIdInDeg (const int &NId, const int &InDeg) |
Reserves memory for node ID NId having InDeg in-edges. More... | |
void | ReserveNIdOutDeg (const int &NId, const int &OutDeg) |
Reserves memory for node ID NId having OutDeg out-edges. 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 PDirNet | New () |
Static constructor that returns a pointer to the network. Call: PDirNet Graph = TDirNet::New(). More... | |
static PDirNet | 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 PDirNet | Load (TSIn &SIn) |
Static constructor that loads the network from a stream SIn and returns a pointer to it. More... | |
static PDirNet | Load_V1 (TSIn &SIn) |
Static constructor that loads the network from a stream SIn and returns a pointer to it. Backwards compatible. More... | |
static PDirNet | GetSmallGraph () |
Returns a small network on 5 nodes and 6 edges. More... | |
Private Member Functions | |
TNode & | GetNode (const int &NId) |
const TNode & | GetNode (const int &NId) const |
Private Attributes | |
TCRef | CRef |
TInt | MxNId |
THash< TInt, TNode > | NodeH |
TAttr | SAttrN |
TAttrPair | SAttrE |
Friends | |
class | TPt< TDirNet > |
class | TDirNetMtx |
Directed 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 directed edge from one source node to a destination node. There can be an edge between the same pair of nodes in the opposite direction. Self loops (one per node) are allowed but multiple (parallel) edges are not. The directed 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<TDirNet> TDirNet::PNet |
typedef TDirNet TDirNet::TNet |
|
inlineexplicit |
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges.
Definition at line 3377 of file network.h.
|
inline |
int TDirNet::AddEdge | ( | const int & | SrcNId, |
const int & | DstNId | ||
) |
Adds an edge from node IDs SrcNId to node 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 TDirNet have no IDs we return -1. Function aborts if SrcNId or DstNId are not nodes in the graph.
Definition at line 2222 of file network.cpp.
|
inline |
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() to the network.
Definition at line 3465 of file network.h.
int TDirNet::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 2142 of file network.cpp.
|
inline |
Adds a node of ID NodeI.GetId() to the network.
Definition at line 3411 of file network.h.
Adds a node of ID NId to the network, creates edges to the node from all nodes in vector InNIdV, creates edges from the node to all nodes in vector OutNIdV.
//OutNIdV) 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 vectors InNIdV and OutNIdV do not exist. Use TDirNet::IsOk to check that the resulting graph is consistent after the operation.
Definition at line 2155 of file network.cpp.
int TDirNet::AddNode | ( | const int & | NId, |
const TVecPool< TInt > & | Pool, | ||
const int & | SrcVId, | ||
const int & | DstVId | ||
) |
Adds a node of ID NId to the network, creates edges to the node from all nodes in vector InNIdV in the vector pool Pool, creates edges from the node to all nodes in vector OutNIdVin the vector pool Pool .
//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 TDirNet::IsOk to check that the resulting graph is consistent.
Definition at line 2175 of file network.cpp.
int TDirNet::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 2476 of file network.cpp.
int TDirNet::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 2484 of file network.cpp.
Adds Int sparse attribute with name AttrName
to EdgeI
.
Definition at line 3645 of file network.h.
Adds Int sparse attribute with id AttrId
to EdgeI
.
Definition at line 3649 of file network.h.
int TDirNet::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 2492 of file network.cpp.
int TDirNet::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 2500 of file network.cpp.
Adds Flt sparse attribute with name AttrName
to EdgeI
.
Definition at line 3659 of file network.h.
Adds Flt sparse attribute with id AttrId
to EdgeI
.
Definition at line 3663 of file network.h.
int TDirNet::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 2508 of file network.cpp.
int TDirNet::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 2516 of file network.cpp.
Adds Str sparse attribute with name AttrName
to EdgeI
.
Definition at line 3673 of file network.h.
Adds Str sparse attribute with id AttrId
to EdgeI
.
Definition at line 3677 of file network.h.
Adds Int sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 2350 of file network.cpp.
Adds Int sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 2357 of file network.cpp.
Adds Int sparse attribute with name AttrName
to NodeI
.
Definition at line 3527 of file network.h.
Adds Int sparse attribute with id AttrId
to NodeI
.
Definition at line 3531 of file network.h.
Adds Flt sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 2364 of file network.cpp.
Adds Flt sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 2371 of file network.cpp.
Adds Flt sparse attribute with name AttrName
to NodeI
.
Definition at line 3541 of file network.h.
Adds Flt sparse attribute with id AttrId
to NodeI
.
Definition at line 3545 of file network.h.
Adds Str sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 2378 of file network.cpp.
Adds Str sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 2385 of file network.cpp.
Adds Str sparse attribute with name AttrName
to NodeI
.
Definition at line 3555 of file network.h.
Adds Str sparse attribute with id AttrId
to NodeI
.
Definition at line 3559 of file network.h.
Adds mapping for sparse attribute with name Name
and type AttrType
.
Definition at line 2605 of file network.cpp.
Adds mapping for sparse attribute with name Name
and type AttrType
.
Definition at line 2464 of file network.cpp.
|
inline |
Returns an iterator referring to the first edge in the network.
Definition at line 3475 of file network.h.
|
inline |
|
inline |
Deletes all nodes and edges from the network.
Definition at line 3493 of file network.h.
void TDirNet::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 2270 of file network.cpp.
void TDirNet::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 graph function still completes. But the function aborts if SrcNId or DstNId are not nodes in the graph.
Definition at line 2231 of file network.cpp.
void TDirNet::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 2193 of file network.cpp.
|
inline |
Deletes node of ID NodeI.GetId() from the network.
Definition at line 3440 of file network.h.
int TDirNet::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 2572 of file network.cpp.
int TDirNet::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 2580 of file network.cpp.
Deletes sparse attribute with name AttrName
from EdgeI
.
Definition at line 3729 of file network.h.
Deletes sparse attribute with id AttrId
from EdgeI
.
Definition at line 3733 of file network.h.
Deletes sparse attribute with name AttrName
from node with id NId
.
Definition at line 2434 of file network.cpp.
Deletes sparse attribute with id AttrId
from node with id NId
.
Definition at line 2441 of file network.cpp.
Deletes sparse attribute with name AttrName
from NodeI
.
Definition at line 3611 of file network.h.
Deletes sparse attribute with id AttrId
from NodeI
.
Definition at line 3615 of file network.h.
void TDirNet::Dump | ( | FILE * | OutF = stdout | ) | const |
Print the network in a human readable form to an output stream OutF.
Definition at line 2325 of file network.cpp.
|
inline |
Tests whether the network is empty (has zero nodes).
Definition at line 3491 of file network.h.
|
inline |
Returns an iterator referring to the past-the-end edge in the network.
Definition at line 3477 of file network.h.
|
inline |
int TDirNet::GetEdges | ( | ) | const |
TEdgeI TDirNet::GetEI | ( | const int & | EId | ) | const |
Not supported/implemented!
TDirNet::TEdgeI TDirNet::GetEI | ( | const int & | SrcNId, |
const int & | DstNId | ||
) | const |
Returns an iterator referring to edge (SrcNId, DstNId) in the network.
Definition at line 2257 of file network.cpp.
Gets a list of all edges that have a sparse attribute with name AttrName
.
Definition at line 2597 of file network.cpp.
Gets a list of all edges that have a sparse attribute with id AttrId
.
Definition at line 2601 of file network.cpp.
Gets a list of all nodes that have a sparse attribute with name AttrName
.
Definition at line 2456 of file network.cpp.
Gets a list of all nodes that have a sparse attribute with id AttrId
.
Definition at line 2460 of file network.cpp.
|
inline |
|
inline |
void TDirNet::GetNIdV | ( | TIntV & | NIdV | ) | const |
Gets a vector IDs of all nodes in the network.
Definition at line 2264 of file network.cpp.
|
inlineprivate |
|
inline |
Returns an interator referring to a random node in the network.
Definition at line 3486 of file network.h.
Returns an ID of a random node in the network.
Definition at line 3484 of file network.h.
int TDirNet::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 2524 of file network.cpp.
int TDirNet::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 2532 of file network.cpp.
Gets Int sparse attribute with name AttrName
from EdgeI
.
Definition at line 3687 of file network.h.
Gets Int sparse attribute with id AttrId
from EdgeI
.
Definition at line 3691 of file network.h.
int TDirNet::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 2540 of file network.cpp.
int TDirNet::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 2548 of file network.cpp.
Gets Flt sparse attribute with name AttrName
from EdgeI
.
Definition at line 3701 of file network.h.
Gets Flt sparse attribute with id AttrId
from EdgeI
.
Definition at line 3705 of file network.h.
int TDirNet::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 2556 of file network.cpp.
int TDirNet::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 2564 of file network.cpp.
Gets Str sparse attribute with name AttrName
from EdgeI
.
Definition at line 3715 of file network.h.
Gets Str sparse attribute with id AttrId
from EdgeI
.
Definition at line 3719 of file network.h.
Gets Int sparse attribute with name AttrName
from node with id NId
.
Definition at line 2392 of file network.cpp.
Gets Int sparse attribute with id AttrId
from node with id NId
.
Definition at line 2399 of file network.cpp.
Gets Int sparse attribute with name AttrName
from NodeI
.
Definition at line 3569 of file network.h.
Gets Int sparse attribute with id AttrId
from NodeI
.
Definition at line 3573 of file network.h.
Gets Flt sparse attribute with name AttrName
from node with id NId
.
Definition at line 2406 of file network.cpp.
Gets Flt sparse attribute with id AttrId
from node with id NId
.
Definition at line 2413 of file network.cpp.
Gets Flt sparse attribute with name AttrName
from NodeI
.
Definition at line 3583 of file network.h.
Gets Flt sparse attribute with id AttrId
from NodeI
.
Definition at line 3587 of file network.h.
Gets Str sparse attribute with name AttrName
from node with id NId
.
Definition at line 2420 of file network.cpp.
Gets Str sparse attribute with id AttrId
from node with id NId
.
Definition at line 2427 of file network.cpp.
Gets Str sparse attribute with name AttrName
from NodeI
.
Definition at line 3597 of file network.h.
Gets Str sparse attribute with id AttrId
from NodeI
.
Definition at line 3601 of file network.h.
Gets id and type for attribute with name Name
.
Definition at line 2609 of file network.cpp.
Gets id and type for attribute with name Name
.
Definition at line 2468 of file network.cpp.
Gets name and type for attribute with id AttrId
.
Definition at line 2613 of file network.cpp.
Gets name and type for attribute with id AttrId
.
Definition at line 2472 of file network.cpp.
int TDirNet::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 2588 of file network.cpp.
|
inline |
Gets a list of all sparse attributes of type AttrType
for EdgeI
.
Definition at line 3739 of file network.h.
Gets a list of all sparse attributes of type AttrType
for node with id NId
.
Definition at line 2448 of file network.cpp.
|
inline |
Gets a list of all sparse attributes of type AttrType
for NodeI
.
Definition at line 3622 of file network.h.
|
static |
Returns a small network on 5 nodes and 6 edges.
/// Edges: 0 -> 1, 1 -> 2, 0 -> 2, 1 -> 3, 3 -> 4, 2 -> 3 ///
Definition at line 2342 of file network.cpp.
bool TDirNet::HasFlag | ( | const TGraphFlag & | Flag | ) | const |
Allows for run-time checking the type of the network (see the TGraphFlag for flags).
Definition at line 2138 of file network.cpp.
bool TDirNet::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.
Definition at line 2251 of file network.cpp.
|
inline |
bool TDirNet::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 2279 of file network.cpp.
|
inlinestatic |
Static constructor that returns a pointer to the network. Call: PDirNet Graph = TDirNet::New().
Definition at line 3386 of file network.h.
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
Saves the network to a (binary) stream SOut. Expects data structures for sparse attributes.
Definition at line 3382 of file network.h.
|
inline |