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
|
Undirected 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 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 | 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 | 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 | 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 | 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 |
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 2865 of file network.h.
|
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 1742 of file network.cpp.
|
inline |
Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the network.
Definition at line 2953 of file network.h.
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 1664 of file network.cpp.
|
inline |
Adds a node of ID NodeI.GetId() to the network.
Definition at line 2902 of file network.h.
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 1676 of file network.cpp.
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 1697 of file network.cpp.
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 1995 of file network.cpp.
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 2003 of file network.cpp.
|
inline |
Adds Int sparse attribute with name AttrName
to EdgeI
.
Definition at line 3136 of file network.h.
Adds Int sparse attribute with id AttrId
to EdgeI
.
Definition at line 3140 of file network.h.
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 2011 of file network.cpp.
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 2019 of file network.cpp.
|
inline |
Adds Flt sparse attribute with name AttrName
to EdgeI
.
Definition at line 3150 of file network.h.
Adds Flt sparse attribute with id AttrId
to EdgeI
.
Definition at line 3154 of file network.h.
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 2027 of file network.cpp.
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 2035 of file network.cpp.
|
inline |
Adds Str sparse attribute with name AttrName
to EdgeI
.
Definition at line 3164 of file network.h.
Adds Str sparse attribute with id AttrId
to EdgeI
.
Definition at line 3168 of file network.h.
Adds Int sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 1862 of file network.cpp.
Adds Int sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 1869 of file network.cpp.
|
inline |
Adds Int sparse attribute with name AttrName
to NodeI
.
Definition at line 3018 of file network.h.
Adds Int sparse attribute with id AttrId
to NodeI
.
Definition at line 3022 of file network.h.
Adds Flt sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 1876 of file network.cpp.
Adds Flt sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 1883 of file network.cpp.
|
inline |
Adds Flt sparse attribute with name AttrName
to NodeI
.
Definition at line 3032 of file network.h.
Adds Flt sparse attribute with id AttrId
to NodeI
.
Definition at line 3036 of file network.h.
Adds Str sparse attribute with name AttrName
to the given node with id NId
.
Definition at line 1890 of file network.cpp.
Adds Str sparse attribute with id AttrId
to the given node with id NId
.
Definition at line 1897 of file network.cpp.
|
inline |
Adds Str sparse attribute with name AttrName
to NodeI
.
Definition at line 3046 of file network.h.
Adds Str sparse attribute with id AttrId
to NodeI
.
Definition at line 3050 of file network.h.
Adds mapping for sparse attribute with name Name
and type AttrType
.
Definition at line 2124 of file network.cpp.
Adds mapping for sparse attribute with name Name
and type AttrType
.
Definition at line 1976 of file network.cpp.
|
inline |
Returns an iterator referring to the first edge in the network.
Definition at line 2963 of file network.h.
|
inline |
|
inline |
Deletes all nodes and edges from the network.
Definition at line 2984 of file network.h.
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 1792 of file network.cpp.
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 1753 of file network.cpp.
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 1715 of file network.cpp.
|
inline |
Deletes node of ID NodeI.GetId() from the network.
Definition at line 2930 of file network.h.
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 2091 of file network.cpp.
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 2099 of file network.cpp.
Deletes sparse attribute with name AttrName
from EdgeI
.
Definition at line 3220 of file network.h.
Deletes sparse attribute with id AttrId
from EdgeI
.
Definition at line 3224 of file network.h.
Deletes sparse attribute with name AttrName
from node with id NId
.
Definition at line 1946 of file network.cpp.
Deletes sparse attribute with id AttrId
from node with id NId
.
Definition at line 1953 of file network.cpp.
Deletes sparse attribute with name AttrName
from NodeI
.
Definition at line 3102 of file network.h.
Deletes sparse attribute with id AttrId
from NodeI
.
Definition at line 3106 of file network.h.
void TUndirNet::Dump | ( | FILE * | OutF = stdout | ) | const |
Print the network in a human readable form to an output stream OutF.
Definition at line 1839 of file network.cpp.
|
inline |
Tests whether the network is empty (has zero nodes).
Definition at line 2982 of file network.h.
|
inline |
Returns an iterator referring to the past-the-end edge in the network.
Definition at line 2965 of file network.h.
|
inline |
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 1774 of file network.cpp.
Gets a list of all edges that have a sparse attribute with name AttrName
.
Definition at line 2116 of file network.cpp.
Gets a list of all edges that have a sparse attribute with id AttrId
.
Definition at line 2120 of file network.cpp.
Gets a list of all nodes that have a sparse attribute with name AttrName
.
Definition at line 1968 of file network.cpp.
Gets a list of all nodes that have a sparse attribute with id AttrId
.
Definition at line 1972 of file network.cpp.
|
inline |
|
inline |
void TUndirNet::GetNIdV | ( | TIntV & | NIdV | ) | const |
Gets a vector IDs of all nodes in the network.
Definition at line 1785 of file network.cpp.
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns an interator referring to a random node in the network.
Definition at line 2977 of file network.h.
Returns an ID of a random node in the network.
Definition at line 2975 of file network.h.
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 2043 of file network.cpp.
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 2051 of file network.cpp.
|
inline |
Gets Int sparse attribute with name AttrName
from EdgeI
.
Definition at line 3178 of file network.h.
Gets Int sparse attribute with id AttrId
from EdgeI
.
Definition at line 3182 of file network.h.
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 2059 of file network.cpp.
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 2067 of file network.cpp.
|
inline |
Gets Flt sparse attribute with name AttrName
from EdgeI
.
Definition at line 3192 of file network.h.
Gets Flt sparse attribute with id AttrId
from EdgeI
.
Definition at line 3196 of file network.h.
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 2075 of file network.cpp.
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 2083 of file network.cpp.
|
inline |
Gets Str sparse attribute with name AttrName
from EdgeI
.
Definition at line 3206 of file network.h.
Gets Str sparse attribute with id AttrId
from EdgeI
.
Definition at line 3210 of file network.h.
Gets Int sparse attribute with name AttrName
from node with id NId
.
Definition at line 1904 of file network.cpp.
Gets Int sparse attribute with id AttrId
from node with id NId
.
Definition at line 1911 of file network.cpp.
|
inline |
Gets Int sparse attribute with name AttrName
from NodeI
.
Definition at line 3060 of file network.h.
Gets Int sparse attribute with id AttrId
from NodeI
.
Definition at line 3064 of file network.h.
Gets Flt sparse attribute with name AttrName
from node with id NId
.
Definition at line 1918 of file network.cpp.
Gets Flt sparse attribute with id AttrId
from node with id NId
.
Definition at line 1925 of file network.cpp.
|
inline |
Gets Flt sparse attribute with name AttrName
from NodeI
.
Definition at line 3074 of file network.h.
Gets Flt sparse attribute with id AttrId
from NodeI
.
Definition at line 3078 of file network.h.
Gets Str sparse attribute with name AttrName
from node with id NId
.
Definition at line 1932 of file network.cpp.
Gets Str sparse attribute with id AttrId
from node with id NId
.
Definition at line 1939 of file network.cpp.
|
inline |
Gets Str sparse attribute with name AttrName
from NodeI
.
Definition at line 3088 of file network.h.
Gets Str sparse attribute with id AttrId
from NodeI
.
Definition at line 3092 of file network.h.
Gets id and type for attribute with name Name
.
Definition at line 2128 of file network.cpp.
Gets id and type for attribute with name Name
.
Definition at line 1980 of file network.cpp.
Gets name and type for attribute with id AttrId
.
Definition at line 2132 of file network.cpp.
Gets name and type for attribute with id AttrId
.
Definition at line 1984 of file network.cpp.
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 2107 of file network.cpp.
|
inline |
Gets a list of all sparse attributes of type AttrType
for EdgeI
.
Definition at line 3230 of file network.h.
Gets a list of all sparse attributes of type AttrType
for node with id NId
.
Definition at line 1960 of file network.cpp.
|
inline |
Gets a list of all sparse attributes of type AttrType
for NodeI
.
Definition at line 3113 of file network.h.
|
static |
Returns a small network on 5 nodes and 5 edges.
/// Graph: 3--0--4 /// /| /// 1-2 ///
Definition at line 1853 of file network.cpp.
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 1659 of file network.cpp.
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 1768 of file network.cpp.
|
inline |
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 1802 of file network.cpp.
Static constructor that loads the network from a stream SIn and returns a pointer to it.
Definition at line 2882 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 2884 of file network.h.
|
inlinestatic |
Static constructor that returns a pointer to the network. Call: PUndirNet Graph = TUndirNet::New().
Definition at line 2876 of file network.h.
|
inlinestatic |
|
private |
|
inline |
|
inline |
|
inline |
Saves the network to a (binary) stream SOut. Expects data structures for sparse attributes.
Definition at line 2871 of file network.h.
|
inline |