SNAP Library 2.4, User Reference
2015-05-11 19:40:56
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Directed multigraph with node edge attributes. More...
#include <network.h>
Classes | |
class | TAFltI |
Node/edge float attribute iterator. Iterates through all nodes/edges for one float attribute. More... | |
class | TAIntI |
Node/edge integer attribute iterator. Iterates through all nodes/edges for one integer attribute. More... | |
class | TAStrI |
Node/edge string attribute iterator. Iterates through all nodes/edges for one string attribute. More... | |
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 TNEANet | TNet |
typedef TPt< TNEANet > | PNet |
Public Member Functions | |
TNEANet () | |
TNEANet (const int &Nodes, const int &Edges) | |
Constructor that reserves enough memory for a graph of nodes and edges. More... | |
TNEANet (const TNEANet &Graph) | |
TNEANet (TSIn &SIn) | |
Constructor for loading the graph from a (binary) stream SIn. More... | |
void | Save (TSOut &SOut) const |
Saves the graph to a (binary) stream SOut. More... | |
bool | HasFlag (const TGraphFlag &Flag) const |
Allows for run-time checking the type of the graph (see the TGraphFlag for flags). More... | |
TNEANet & | operator= (const TNEANet &Graph) |
int | GetNodes () const |
Returns the number of nodes in the graph. More... | |
int | AddNode (int NId=-1) |
Adds a node of ID NId to the graph. More... | |
int | AddNode (const TNodeI &NodeI) |
Adds a node of ID NodeI.GetId() to the graph. More... | |
void | DelNode (const int &NId) |
Deletes node of ID NId from the graph. More... | |
void | DelNode (const TNode &NodeI) |
Deletes node of ID NodeI.GetId() from the graph. 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 graph. More... | |
TNodeI | EndNI () const |
Returns an iterator referring to the past-the-end node in the graph. More... | |
TNodeI | GetNI (const int &NId) const |
Returns an iterator referring to the node of ID NId in the graph. More... | |
TAIntI | BegNAIntI (const TStr &attr) const |
Returns an iterator referring to the first node's int attribute. More... | |
TAIntI | EndNAIntI (const TStr &attr) const |
Returns an iterator referring to the past-the-end node's attribute. More... | |
TAIntI | GetNAIntI (const TStr &attr, const int &NId) const |
Returns an iterator referring to the node of ID NId in the graph. More... | |
TAStrI | BegNAStrI (const TStr &attr) const |
Returns an iterator referring to the first node's str attribute. More... | |
TAStrI | EndNAStrI (const TStr &attr) const |
Returns an iterator referring to the past-the-end node's attribute. More... | |
TAStrI | GetNAStrI (const TStr &attr, const int &NId) const |
Returns an iterator referring to the node of ID NId in the graph. More... | |
TAFltI | BegNAFltI (const TStr &attr) const |
Returns an iterator referring to the first node's flt attribute. More... | |
TAFltI | EndNAFltI (const TStr &attr) const |
Returns an iterator referring to the past-the-end node's attribute. More... | |
TAFltI | GetNAFltI (const TStr &attr, const int &NId) const |
Returns an iterator referring to the node of ID NId in the graph. More... | |
void | AttrNameNI (const TInt &NId, TStrV &Names) const |
Returns a vector of attr names for node NId. More... | |
void | AttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const |
void | AttrValueNI (const TInt &NId, TStrV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | AttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Values) const |
void | IntAttrNameNI (const TInt &NId, TStrV &Names) const |
Returns a vector of int attr names for node NId. More... | |
void | IntAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const |
void | IntAttrValueNI (const TInt &NId, TIntV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | IntAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TIntV &Values) const |
void | StrAttrNameNI (const TInt &NId, TStrV &Names) const |
Returns a vector of str attr names for node NId. More... | |
void | StrAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const |
void | StrAttrValueNI (const TInt &NId, TStrV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | StrAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Values) const |
void | FltAttrNameNI (const TInt &NId, TStrV &Names) const |
Returns a vector of int attr names for node NId. More... | |
void | FltAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const |
void | FltAttrValueNI (const TInt &NId, TFltV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | FltAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TFltV &Values) const |
void | AttrNameEI (const TInt &EId, TStrV &Names) const |
Returns a vector of attr names for edge EId. More... | |
void | AttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const |
void | AttrValueEI (const TInt &EId, TStrV &Values) const |
Returns a vector of attr values for edge EId. More... | |
void | AttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Values) const |
void | IntAttrNameEI (const TInt &EId, TStrV &Names) const |
Returns a vector of int attr names for edge EId. More... | |
void | IntAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const |
void | IntAttrValueEI (const TInt &EId, TIntV &Values) const |
Returns a vector of attr values for edge EId. More... | |
void | IntAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TIntV &Values) const |
void | StrAttrNameEI (const TInt &EId, TStrV &Names) const |
Returns a vector of str attr names for node NId. More... | |
void | StrAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const |
void | StrAttrValueEI (const TInt &EId, TStrV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | StrAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Values) const |
void | FltAttrNameEI (const TInt &EId, TStrV &Names) const |
Returns a vector of int attr names for node NId. More... | |
void | FltAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const |
void | FltAttrValueEI (const TInt &EId, TFltV &Values) const |
Returns a vector of attr values for node NId. More... | |
void | FltAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TFltV &Values) const |
TAIntI | BegEAIntI (const TStr &attr) const |
Returns an iterator referring to the first edge's int attribute. More... | |
TAIntI | EndEAIntI (const TStr &attr) const |
Returns an iterator referring to the past-the-end edge's attribute. More... | |
TAIntI | GetEAIntI (const TStr &attr, const int &EId) const |
Returns an iterator referring to the edge of ID EId in the graph. More... | |
TAStrI | BegEAStrI (const TStr &attr) const |
Returns an iterator referring to the first edge's str attribute. More... | |
TAStrI | EndEAStrI (const TStr &attr) const |
Returns an iterator referring to the past-the-end edge's attribute. More... | |
TAStrI | GetEAStrI (const TStr &attr, const int &EId) const |
Returns an iterator referring to the edge of ID EId in the graph. More... | |
TAFltI | BegEAFltI (const TStr &attr) const |
Returns an iterator referring to the first edge's flt attribute. More... | |
TAFltI | EndEAFltI (const TStr &attr) const |
Returns an iterator referring to the past-the-end edge's attribute. More... | |
TAFltI | GetEAFltI (const TStr &attr, const int &EId) const |
Returns an iterator referring to the edge of ID EId in the graph. More... | |
int | GetMxNId () const |
Returns an ID that is larger than any node ID in the network. More... | |
int | GetMxEId () const |
Returns an ID that is larger than any edge ID in the network. More... | |
int | GetEdges () const |
Returns the number of edges in the graph. More... | |
int | AddEdge (const int &SrcNId, const int &DstNId, int EId=-1) |
Adds an edge with ID EId between node IDs SrcNId and DstNId to the graph. More... | |
int | AddEdge (const TEdgeI &EdgeI) |
Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph. More... | |
void | DelEdge (const int &EId) |
Deletes an edge with edge ID EId from the graph. More... | |
void | DelEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) |
Deletes all edges between node IDs SrcNId and DstNId from the graph. More... | |
bool | IsEdge (const int &EId) const |
Tests whether an edge with edge ID EId exists in the graph. More... | |
bool | IsEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) const |
Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. More... | |
bool | IsEdge (const int &SrcNId, const int &DstNId, int &EId, const bool &IsDir=true) const |
Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. if an edge exists, return its edge ID in EId. More... | |
int | GetEId (const int &SrcNId, const int &DstNId) const |
Returns an edge ID between node IDs SrcNId and DstNId, if such an edge exists. Otherwise, return -1. More... | |
TEdgeI | BegEI () const |
Returns an iterator referring to the first edge in the graph. More... | |
TEdgeI | EndEI () const |
Returns an iterator referring to the past-the-end edge in the graph. More... | |
TEdgeI | GetEI (const int &EId) const |
Returns an iterator referring to edge with edge ID EId. More... | |
TEdgeI | GetEI (const int &SrcNId, const int &DstNId) const |
Returns an iterator referring to edge (SrcNId, DstNId) in the graph. More... | |
int | GetRndNId (TRnd &Rnd=TInt::Rnd) |
Returns an ID of a random node in the graph. More... | |
TNodeI | GetRndNI (TRnd &Rnd=TInt::Rnd) |
Returns an interator referring to a random node in the graph. More... | |
int | GetRndEId (TRnd &Rnd=TInt::Rnd) |
Returns an ID of a random edge in the graph. More... | |
TEdgeI | GetRndEI (TRnd &Rnd=TInt::Rnd) |
Returns an interator referring to a random edge in the graph. More... | |
void | GetNIdV (TIntV &NIdV) const |
Gets a vector IDs of all nodes in the graph. More... | |
void | GetEIdV (TIntV &EIdV) const |
Gets a vector IDs of all edges in the graph. More... | |
bool | Empty () const |
Tests whether the graph is empty (has zero nodes). More... | |
void | Clr () |
Deletes all nodes and edges from the graph. More... | |
void | Reserve (const int &Nodes, const int &Edges) |
Reserves memory for a graph of Nodes nodes and Edges edges. More... | |
void | Defrag (const bool &OnlyNodeLinks=false) |
Defragments the graph. More... | |
bool | IsOk (const bool &ThrowExcept=true) const |
Checks the graph data structure for internal consistency. More... | |
void | Dump (FILE *OutF=stdout) const |
Print the graph in a human readable form to an output stream OutF. More... | |
int | AddIntAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr) |
Attribute based add function for attr to Int value. More... | |
int | AddIntAttrDatN (const int &NId, const TInt &value, const TStr &attr) |
int | AddStrAttrDatN (const TNodeI &NodeI, const TStr &value, const TStr &attr) |
Attribute based add function for attr to Str value. More... | |
int | AddStrAttrDatN (const int &NId, const TStr &value, const TStr &attr) |
int | AddFltAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr) |
Attribute based add function for attr to Flt value. More... | |
int | AddFltAttrDatN (const int &NId, const TFlt &value, const TStr &attr) |
int | AddIntAttrDatE (const TEdgeI &EdgeI, const TInt &value, const TStr &attr) |
Attribute based add function for attr to Int value. More... | |
int | AddIntAttrDatE (const int &EId, const TInt &value, const TStr &attr) |
int | AddStrAttrDatE (const TEdgeI &EdgeI, const TStr &value, const TStr &attr) |
Attribute based add function for attr to Str value. More... | |
int | AddStrAttrDatE (const int &EId, const TStr &value, const TStr &attr) |
int | AddFltAttrDatE (const TEdgeI &EdgeI, const TFlt &value, const TStr &attr) |
Attribute based add function for attr to Flt value. More... | |
int | AddFltAttrDatE (const int &EId, const TFlt &value, const TStr &attr) |
TInt | GetIntAttrDatN (const TNodeI &NodeI, const TStr &attr) |
Gets the value of int attr from the node attr value vector. More... | |
TInt | GetIntAttrDatN (const int &NId, const TStr &attr) |
TStr | GetStrAttrDatN (const TNodeI &NodeI, const TStr &attr) |
Gets the value of str attr from the node attr value vector. More... | |
TStr | GetStrAttrDatN (const int &NId, const TStr &attr) |
TFlt | GetFltAttrDatN (const TNodeI &NodeI, const TStr &attr) |
Gets the value of flt attr from the node attr value vector. More... | |
TFlt | GetFltAttrDatN (const int &NId, const TStr &attr) |
int | GetIntAttrIndN (const TStr &attr) |
Gets the index of the node attr value vector specified by attr (same as GetAttrIndN for compatibility reasons). More... | |
int | GetAttrIndN (const TStr &attr) |
Gets the index of the node attr value vector specified by attr . More... | |
TInt | GetIntAttrIndDatN (const TNodeI &NodeI, const int &index) |
Gets the value of an int node attr specified by node iterator NodeI and the attr index . More... | |
TInt | GetIntAttrIndDatN (const int &NId, const int &index) |
Gets the value of an int node attr specified by node ID NId and the attr index . More... | |
TStr | GetStrAttrIndDatN (const TNodeI &NodeI, const int &index) |
Gets the value of a string node attr specified by node iterator NodeI and the attr index . More... | |
TStr | GetStrAttrIndDatN (const int &NId, const int &index) |
Gets the value of a string node attr specified by node ID NId and the attr index . More... | |
TFlt | GetFltAttrIndDatN (const TNodeI &NodeI, const int &index) |
Gets the value of a float node attr specified by node iterator NodeI and the attr index . More... | |
TFlt | GetFltAttrIndDatN (const int &NId, const int &index) |
Gets the value of a float node attr specified by node ID NId and the attr index . More... | |
TInt | GetIntAttrDatE (const TEdgeI &EdgeI, const TStr &attr) |
Gets the value of int attr from the edge attr value vector. More... | |
TInt | GetIntAttrDatE (const int &EId, const TStr &attr) |
TStr | GetStrAttrDatE (const TEdgeI &EdgeI, const TStr &attr) |
Gets the value of str attr from the edge attr value vector. More... | |
TStr | GetStrAttrDatE (const int &EId, const TStr &attr) |
TFlt | GetFltAttrDatE (const TEdgeI &EdgeI, const TStr &attr) |
Gets the value of flt attr from the edge attr value vector. More... | |
TFlt | GetFltAttrDatE (const int &EId, const TStr &attr) |
int | GetIntAttrIndE (const TStr &attr) |
Gets the index of the edge attr value vector specified by attr (same as GetAttrIndE for compatibility reasons). More... | |
int | GetAttrIndE (const TStr &attr) |
Gets the index of the edge attr value vector specified by attr . More... | |
TInt | GetIntAttrIndDatE (const TEdgeI &EdgeI, const int &index) |
Gets the value of an int edge attr specified by edge iterator EdgeI and the attr index . More... | |
TInt | GetIntAttrIndDatE (const int &EId, const int &index) |
Gets the value of an int edge attr specified by edge ID EId and the attr index . More... | |
TFlt | GetFltAttrIndDatE (const TEdgeI &EdgeI, const int &index) |
Gets the value of a float edge attr specified by edge iterator EdgeI and the attr index . More... | |
TFlt | GetFltAttrIndDatE (const int &EId, const int &index) |
Gets the value of an int edge attr specified by edge ID EId and the attr index . More... | |
TStr | GetStrAttrIndDatE (const TEdgeI &EdgeI, const int &index) |
Gets the value of a string edge attr specified by edge iterator EdgeI and the attr index . More... | |
TStr | GetStrAttrIndDatE (const int &EId, const int &index) |
Gets the value of an int edge attr specified by edge ID EId and the attr index . More... | |
int | DelAttrDatN (const TNodeI &NodeI, const TStr &attr) |
Deletes the node attribute for NodeI. More... | |
int | DelAttrDatN (const int &NId, const TStr &attr) |
int | DelAttrDatE (const TEdgeI &EdgeI, const TStr &attr) |
Deletes the edge attribute for NodeI. More... | |
int | DelAttrDatE (const int &EId, const TStr &attr) |
int | AddIntAttrN (const TStr &attr, TInt defaultValue=TInt::Mn) |
Adds a new Int node attribute to the hashmap. More... | |
int | AddStrAttrN (const TStr &attr, TStr defaultValue=TStr::GetNullStr()) |
Adds a new Str node attribute to the hashmap. More... | |
int | AddFltAttrN (const TStr &attr, TFlt defaultValue=TFlt::Mn) |
Adds a new Flt node attribute to the hashmap. More... | |
int | AddIntAttrE (const TStr &attr, TInt defaultValue=TInt::Mn) |
Adds a new Int edge attribute to the hashmap. More... | |
int | AddStrAttrE (const TStr &attr, TStr defaultValue=TStr::GetNullStr()) |
Adds a new Str edge attribute to the hashmap. More... | |
int | AddFltAttrE (const TStr &attr, TFlt defaultValue=TFlt::Mn) |
Adds a new Flt edge attribute to the hashmap. More... | |
int | DelAttrN (const TStr &attr) |
Removes all the values for node attr. More... | |
int | DelAttrE (const TStr &attr) |
Removes all the values for edge attr. More... | |
bool | IsAttrDeletedN (const int &NId, const TStr &attr) const |
bool | IsIntAttrDeletedN (const int &NId, const TStr &attr) const |
bool | IsStrAttrDeletedN (const int &NId, const TStr &attr) const |
bool | IsFltAttrDeletedN (const int &NId, const TStr &attr) const |
bool | NodeAttrIsDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const |
bool | NodeAttrIsIntDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const |
bool | NodeAttrIsStrDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const |
bool | NodeAttrIsFltDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const |
bool | IsAttrDeletedE (const int &EId, const TStr &attr) const |
bool | IsIntAttrDeletedE (const int &EId, const TStr &attr) const |
bool | IsStrAttrDeletedE (const int &EId, const TStr &attr) const |
bool | IsFltAttrDeletedE (const int &EId, const TStr &attr) const |
bool | EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const |
bool | EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const |
bool | EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const |
bool | EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const |
TStr | GetNodeAttrValue (const int &NId, const TStrIntPrH::TIter &NodeHI) const |
TStr | GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &EdgeHI) const |
void | GetAttrNNames (TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const |
Fills each of the vectors with the names of node attributes of the given type. More... | |
void | GetAttrENames (TStrV &IntAttrNames, TStrV &FltAttrNames, TStrV &StrAttrNames) const |
Fills each of the vectors with the names of edge attributes of the given type. More... | |
Static Public Member Functions | |
static PNEANet | New () |
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New(). More... | |
static PNEANet | New (const int &Nodes, const int &Edges) |
Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges. More... | |
static PNEANet | Load (TSIn &SIn) |
Static constructor that loads the graph from a stream SIn and returns a pointer to it. More... | |
static PNEANet | GetSmallGraph () |
Returns a small multigraph on 5 nodes and 6 edges. More... | |
Private Types | |
enum | { IntType, StrType, FltType } |
Private Member Functions | |
TNode & | GetNode (const int &NId) |
const TNode & | GetNode (const int &NId) const |
TEdge & | GetEdge (const int &EId) |
const TEdge & | GetEdge (const int &EId) const |
TInt | GetIntAttrDefaultN (const TStr &attribute) const |
Get Int node attribute val. If not a proper attr, return default. More... | |
TStr | GetStrAttrDefaultN (const TStr &attribute) const |
Get Str node attribute val. If not a proper attr, return default. More... | |
TFlt | GetFltAttrDefaultN (const TStr &attribute) const |
Get Flt node attribute val. If not a proper attr, return default. More... | |
TInt | GetIntAttrDefaultE (const TStr &attribute) const |
Get Int edge attribute val. If not a proper attr, return default. More... | |
TStr | GetStrAttrDefaultE (const TStr &attribute) const |
Get Str edge attribute val. If not a proper attr, return default. More... | |
TFlt | GetFltAttrDefaultE (const TStr &attribute) const |
Get Flt edge attribute val. If not a proper attr, return default. More... | |
Private Attributes | |
TCRef | CRef |
TInt | MxNId |
TInt | MxEId |
THash< TInt, TNode > | NodeH |
THash< TInt, TEdge > | EdgeH |
TStrIntPrH | KeyToIndexTypeN |
KeyToIndexType[N|E]: Key->(Type,Index). More... | |
TStrIntPrH | KeyToIndexTypeE |
THash< TStr, TInt > | IntDefaultsN |
THash< TStr, TInt > | IntDefaultsE |
THash< TStr, TStr > | StrDefaultsN |
THash< TStr, TStr > | StrDefaultsE |
THash< TStr, TFlt > | FltDefaultsN |
THash< TStr, TFlt > | FltDefaultsE |
TVec< TIntV > | VecOfIntVecsN |
TVec< TIntV > | VecOfIntVecsE |
TVec< TStrV > | VecOfStrVecsN |
TVec< TStrV > | VecOfStrVecsE |
TVec< TFltV > | VecOfFltVecsN |
TVec< TFltV > | VecOfFltVecsE |
Friends | |
class | TPt< TNEANet > |
Directed multigraph with node edge attributes.
Node IDs can be arbitrary non-negative integers. Edges have IDs. There can be more than one directed edge from one source node to a destination node. Self loops (one per node) are allowed as well as multiple (parallel) edges. Nodes and edges can have attributes/data associated with them. The attributes can be added dynamically at runtime. The directed multigraph 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. The attributes are organized in a columnar store, where each attribute column is defined for all the nodes or edges in the network.
typedef TPt<TNEANet> TNEANet::PNet |
typedef TNEANet TNEANet::TNet |
|
private |
Enumerator | |
---|---|
IntType | |
StrType | |
FltType |
|
inline |
Definition at line 1842 of file network.h.
|
inlineexplicit |
Constructor that reserves enough memory for a graph of nodes and edges.
Definition at line 1848 of file network.h.
|
inline |
Definition at line 1854 of file network.h.
|
inline |
Constructor for loading the graph from a (binary) stream SIn.
Definition at line 1860 of file network.h.
int TNEANet::AddEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
int | EId = -1 |
||
) |
Adds an edge with ID EId 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 419 of file network.cpp.
|
inline |
Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph.
Definition at line 2058 of file network.h.
Attribute based add function for attr to Flt value.
Adds the key flt value pair to the corresponding edge attribute value vector.
Definition at line 2152 of file network.h.
Definition at line 774 of file network.cpp.
Attribute based add function for attr to Flt value.
Adds the key flt value pair to the corresponding node attribute value vector.
Definition at line 2136 of file network.h.
Definition at line 704 of file network.cpp.
Adds a new Flt edge attribute to the hashmap.
Definition at line 988 of file network.cpp.
Adds a new Flt node attribute to the hashmap.
Definition at line 929 of file network.cpp.
Attribute based add function for attr to Int value.
Adds the key int value pair to the corresponding edge attribute value vector.
Definition at line 2142 of file network.h.
Definition at line 728 of file network.cpp.
Attribute based add function for attr to Int value.
Adds the key int value pair to the corresponding node attribute value vector.
Definition at line 2126 of file network.h.
Definition at line 658 of file network.cpp.
Adds a new Int edge attribute to the hashmap.
Definition at line 949 of file network.cpp.
Adds a new Int node attribute to the hashmap.
Definition at line 891 of file network.cpp.
int TNEANet::AddNode | ( | int | NId = -1 | ) |
Adds a node of ID NId to the graph.
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 313 of file network.cpp.
|
inline |
Adds a node of ID NodeI.GetId() to the graph.
Definition at line 1898 of file network.h.
Attribute based add function for attr to Str value.
Adds the key str value pair to the corresponding edge attribute value vector.
Definition at line 2147 of file network.h.
Definition at line 751 of file network.cpp.
Attribute based add function for attr to Str value.
Adds the key str value pair to the corresponding node attribute value vector.
Definition at line 2131 of file network.h.
Definition at line 681 of file network.cpp.
int TNEANet::AddStrAttrE | ( | const TStr & | attr, |
TStr | defaultValue = TStr::GetNullStr() |
||
) |
Adds a new Str edge attribute to the hashmap.
Definition at line 969 of file network.cpp.
int TNEANet::AddStrAttrN | ( | const TStr & | attr, |
TStr | defaultValue = TStr::GetNullStr() |
||
) |
Adds a new Str node attribute to the hashmap.
Definition at line 910 of file network.cpp.
Returns a vector of attr names for edge EId.
Definition at line 1976 of file network.h.
void TNEANet::AttrNameEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 172 of file network.cpp.
Returns a vector of attr names for node NId.
Definition at line 1943 of file network.h.
void TNEANet::AttrNameNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 25 of file network.cpp.
Returns a vector of attr values for edge EId.
Definition at line 1980 of file network.h.
void TNEANet::AttrValueEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Values | ||
) | const |
Definition at line 182 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 1947 of file network.h.
void TNEANet::AttrValueNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Values | ||
) | const |
Definition at line 35 of file network.cpp.
|
inline |
Returns an iterator referring to the first node's flt attribute.
Definition at line 1933 of file network.h.
Returns an iterator referring to the first node's int attribute.
Definition at line 1914 of file network.h.
Returns an iterator referring to the first node's str attribute.
Definition at line 1923 of file network.h.
|
inline |
|
inline |
Deletes all nodes and edges from the graph.
Definition at line 2100 of file network.h.
void TNEANet::Defrag | ( | const bool & | OnlyNodeLinks = false | ) |
Defragments the graph.
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 539 of file network.cpp.
Deletes the edge attribute for NodeI.
Definition at line 2220 of file network.h.
int TNEANet::DelAttrDatE | ( | const int & | EId, |
const TStr & | attr | ||
) |
Definition at line 876 of file network.cpp.
Deletes the node attribute for NodeI.
Definition at line 2217 of file network.h.
int TNEANet::DelAttrDatN | ( | const int & | NId, |
const TStr & | attr | ||
) |
Definition at line 862 of file network.cpp.
int TNEANet::DelAttrE | ( | const TStr & | attr | ) |
Removes all the values for edge attr.
Definition at line 1031 of file network.cpp.
int TNEANet::DelAttrN | ( | const TStr & | attr | ) |
Removes all the values for node attr.
Definition at line 1007 of file network.cpp.
void TNEANet::DelEdge | ( | const int & | EId | ) |
Deletes an edge with edge ID EId from the graph.
Definition at line 469 of file network.cpp.
void TNEANet::DelEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
const bool & | IsDir = true |
||
) |
Deletes all edges between node IDs SrcNId and DstNId from the graph.
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 494 of file network.cpp.
void TNEANet::DelNode | ( | const int & | NId | ) |
Deletes node of ID NId from the graph.
If the node of ID NId does not exist the function aborts.
Definition at line 359 of file network.cpp.
|
inline |
Deletes node of ID NodeI.GetId() from the graph.
Definition at line 1904 of file network.h.
void TNEANet::Dump | ( | FILE * | OutF = stdout | ) | const |
Print the graph in a human readable form to an output stream OutF.
Definition at line 601 of file network.cpp.
bool TNEANet::EdgeAttrIsDeleted | ( | const int & | EId, |
const TStrIntPrH::TIter & | EdgeHI | ||
) | const |
Definition at line 274 of file network.cpp.
bool TNEANet::EdgeAttrIsFltDeleted | ( | const int & | EId, |
const TStrIntPrH::TIter & | EdgeHI | ||
) | const |
Definition at line 293 of file network.cpp.
bool TNEANet::EdgeAttrIsIntDeleted | ( | const int & | EId, |
const TStrIntPrH::TIter & | EdgeHI | ||
) | const |
Definition at line 281 of file network.cpp.
bool TNEANet::EdgeAttrIsStrDeleted | ( | const int & | EId, |
const TStrIntPrH::TIter & | EdgeHI | ||
) | const |
Definition at line 287 of file network.cpp.
|
inline |
Tests whether the graph is empty (has zero nodes).
Definition at line 2098 of file network.h.
|
inline |
Returns an iterator referring to the past-the-end node's attribute.
Definition at line 1936 of file network.h.
Returns an iterator referring to the past-the-end node's attribute.
Definition at line 1917 of file network.h.
Returns an iterator referring to the past-the-end node's attribute.
Definition at line 1927 of file network.h.
|
inline |
Returns a vector of int attr names for node NId.
Definition at line 2000 of file network.h.
void TNEANet::FltAttrNameEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 234 of file network.cpp.
Returns a vector of int attr names for node NId.
Definition at line 1967 of file network.h.
void TNEANet::FltAttrNameNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 87 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 2004 of file network.h.
void TNEANet::FltAttrValueEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TFltV & | Values | ||
) | const |
Definition at line 244 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 1971 of file network.h.
void TNEANet::FltAttrValueNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TFltV & | Values | ||
) | const |
Definition at line 97 of file network.cpp.
void TNEANet::GetAttrENames | ( | TStrV & | IntAttrNames, |
TStrV & | FltAttrNames, | ||
TStrV & | StrAttrNames | ||
) | const |
Fills each of the vectors with the names of edge attributes of the given type.
Definition at line 1079 of file network.cpp.
int TNEANet::GetAttrIndE | ( | const TStr & | attr | ) |
Gets the index of the edge attr value vector specified by attr
.
Definition at line 858 of file network.cpp.
int TNEANet::GetAttrIndN | ( | const TStr & | attr | ) |
Gets the index of the node attr value vector specified by attr
.
Definition at line 826 of file network.cpp.
void TNEANet::GetAttrNNames | ( | TStrV & | IntAttrNames, |
TStrV & | FltAttrNames, | ||
TStrV & | StrAttrNames | ||
) | const |
Fills each of the vectors with the names of node attributes of the given type.
Definition at line 1065 of file network.cpp.
Returns an iterator referring to the edge of ID EId in the graph.
Definition at line 2040 of file network.h.
Returns an iterator referring to the edge of ID EId in the graph.
Definition at line 2017 of file network.h.
Returns an iterator referring to the edge of ID EId in the graph.
Definition at line 2028 of file network.h.
|
inlineprivate |
TStr TNEANet::GetEdgeAttrValue | ( | const int & | EId, |
const TStrIntPrH::TIter & | EdgeHI | ||
) | const |
Definition at line 299 of file network.cpp.
|
inline |
|
inline |
|
inline |
Returns an iterator referring to edge (SrcNId, DstNId) in the graph.
Definition at line 2082 of file network.h.
|
inline |
Returns an edge ID between node IDs SrcNId and DstNId, if such an edge exists. Otherwise, return -1.
Definition at line 2074 of file network.h.
void TNEANet::GetEIdV | ( | TIntV & | EIdV | ) | const |
Gets a vector IDs of all edges in the graph.
Definition at line 532 of file network.cpp.
Gets the value of flt attr from the edge attr value vector.
Definition at line 2193 of file network.h.
Definition at line 838 of file network.cpp.
Gets the value of flt attr from the node attr value vector.
Definition at line 2163 of file network.h.
Definition at line 806 of file network.cpp.
Gets the value of a float edge attr specified by edge iterator EdgeI
and the attr index
.
Definition at line 2207 of file network.h.
TFlt TNEANet::GetFltAttrIndDatE | ( | const int & | EId, |
const int & | index | ||
) |
Gets the value of an int edge attr specified by edge ID EId
and the attr index
.
Definition at line 850 of file network.cpp.
Gets the value of a float node attr specified by node iterator NodeI
and the attr index
.
Definition at line 2182 of file network.h.
TFlt TNEANet::GetFltAttrIndDatN | ( | const int & | NId, |
const int & | index | ||
) |
Gets the value of a float node attr specified by node ID NId
and the attr index
.
Definition at line 818 of file network.cpp.
Gets the value of int attr from the edge attr value vector.
Definition at line 2187 of file network.h.
Definition at line 830 of file network.cpp.
Gets the value of int attr from the node attr value vector.
Definition at line 2156 of file network.h.
Definition at line 798 of file network.cpp.
Gets the value of an int edge attr specified by edge iterator EdgeI
and the attr index
.
Definition at line 2202 of file network.h.
TInt TNEANet::GetIntAttrIndDatE | ( | const int & | EId, |
const int & | index | ||
) |
Gets the value of an int edge attr specified by edge ID EId
and the attr index
.
Definition at line 842 of file network.cpp.
Gets the value of an int node attr specified by node iterator NodeI
and the attr index
.
Definition at line 2172 of file network.h.
TInt TNEANet::GetIntAttrIndDatN | ( | const int & | NId, |
const int & | index | ||
) |
Gets the value of an int node attr specified by node ID NId
and the attr index
.
Definition at line 810 of file network.cpp.
int TNEANet::GetIntAttrIndE | ( | const TStr & | attr | ) |
Gets the index of the edge attr value vector specified by attr
(same as GetAttrIndE for compatibility reasons).
Definition at line 854 of file network.cpp.
int TNEANet::GetIntAttrIndN | ( | const TStr & | attr | ) |
Gets the index of the node attr value vector specified by attr
(same as GetAttrIndN for compatibility reasons).
Definition at line 822 of file network.cpp.
|
inline |
|
inline |
Returns an iterator referring to the node of ID NId in the graph.
Definition at line 1939 of file network.h.
Returns an iterator referring to the node of ID NId in the graph.
Definition at line 1920 of file network.h.
Returns an iterator referring to the node of ID NId in the graph.
Definition at line 1930 of file network.h.
|
inline |
void TNEANet::GetNIdV | ( | TIntV & | NIdV | ) | const |
Gets a vector IDs of all nodes in the graph.
Definition at line 525 of file network.cpp.
|
inlineprivate |
TStr TNEANet::GetNodeAttrValue | ( | const int & | NId, |
const TStrIntPrH::TIter & | NodeHI | ||
) | const |
Definition at line 158 of file network.cpp.
|
inline |
Returns an interator referring to a random edge in the graph.
Definition at line 2091 of file network.h.
Returns an ID of a random edge in the graph.
Definition at line 2089 of file network.h.
Returns an interator referring to a random node in the graph.
Definition at line 2087 of file network.h.
Returns an ID of a random node in the graph.
Definition at line 2085 of file network.h.
|
static |
Returns a small multigraph on 5 nodes and 6 edges.
/// Edges: 0 -> 1, 0 -> 2, 0 -> 3, 0 -> 4, 1 -> 2, 1 -> 2 ///
Definition at line 1056 of file network.cpp.
Gets the value of str attr from the edge attr value vector.
Definition at line 2190 of file network.h.
Definition at line 834 of file network.cpp.
Gets the value of str attr from the node attr value vector.
Definition at line 2160 of file network.h.
Definition at line 802 of file network.cpp.
Get Str edge attribute val. If not a proper attr, return default.
Definition at line 1822 of file network.h.
Get Str node attribute val. If not a proper attr, return default.
Definition at line 1816 of file network.h.
Gets the value of a string edge attr specified by edge iterator EdgeI
and the attr index
.
Definition at line 2212 of file network.h.
TStr TNEANet::GetStrAttrIndDatE | ( | const int & | EId, |
const int & | index | ||
) |
Gets the value of an int edge attr specified by edge ID EId
and the attr index
.
Definition at line 846 of file network.cpp.
Gets the value of a string node attr specified by node iterator NodeI
and the attr index
.
Definition at line 2177 of file network.h.
TStr TNEANet::GetStrAttrIndDatN | ( | const int & | NId, |
const int & | index | ||
) |
Gets the value of a string node attr specified by node ID NId
and the attr index
.
Definition at line 814 of file network.cpp.
bool TNEANet::HasFlag | ( | const TGraphFlag & | Flag | ) | const |
Allows for run-time checking the type of the graph (see the TGraphFlag for flags).
Definition at line 3 of file network.cpp.
Returns a vector of int attr names for edge EId.
Definition at line 1984 of file network.h.
void TNEANet::IntAttrNameEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 192 of file network.cpp.
Returns a vector of int attr names for node NId.
Definition at line 1951 of file network.h.
void TNEANet::IntAttrNameNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 45 of file network.cpp.
Returns a vector of attr values for edge EId.
Definition at line 1988 of file network.h.
void TNEANet::IntAttrValueEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TIntV & | Values | ||
) | const |
Definition at line 202 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 1955 of file network.h.
void TNEANet::IntAttrValueNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TIntV & | Values | ||
) | const |
Definition at line 55 of file network.cpp.
bool TNEANet::IsAttrDeletedE | ( | const int & | EId, |
const TStr & | attr | ||
) | const |
Definition at line 255 of file network.cpp.
bool TNEANet::IsAttrDeletedN | ( | const int & | NId, |
const TStr & | attr | ||
) | const |
Definition at line 108 of file network.cpp.
|
inline |
|
inline |
Tests whether an edge between node IDs SrcNId and DstNId exists in the graph.
Definition at line 2070 of file network.h.
bool TNEANet::IsEdge | ( | const int & | SrcNId, |
const int & | DstNId, | ||
int & | EId, | ||
const bool & | IsDir = true |
||
) | const |
Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. if an edge exists, return its edge ID in EId.
Definition at line 504 of file network.cpp.
bool TNEANet::IsFltAttrDeletedE | ( | const int & | EId, |
const TStr & | attr | ||
) | const |
Definition at line 270 of file network.cpp.
bool TNEANet::IsFltAttrDeletedN | ( | const int & | NId, |
const TStr & | attr | ||
) | const |
Definition at line 123 of file network.cpp.
bool TNEANet::IsIntAttrDeletedE | ( | const int & | EId, |
const TStr & | attr | ||
) | const |
Definition at line 262 of file network.cpp.
bool TNEANet::IsIntAttrDeletedN | ( | const int & | NId, |
const TStr & | attr | ||
) | const |
Definition at line 115 of file network.cpp.
|
inline |
bool TNEANet::IsOk | ( | const bool & | ThrowExcept = true | ) | const |
Checks the graph data structure for internal consistency.
For each node in the graph check that its neighbors are also nodes in the graph.
Definition at line 548 of file network.cpp.
bool TNEANet::IsStrAttrDeletedE | ( | const int & | EId, |
const TStr & | attr | ||
) | const |
Definition at line 266 of file network.cpp.
bool TNEANet::IsStrAttrDeletedN | ( | const int & | NId, |
const TStr & | attr | ||
) | const |
Definition at line 119 of file network.cpp.
Static constructor that loads the graph from a stream SIn and returns a pointer to it.
Definition at line 1882 of file network.h.
|
inlinestatic |
Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
Definition at line 1876 of file network.h.
|
inlinestatic |
Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges.
Call: PNEANet Graph = TNEANet::New(Nodes, Edges).
Definition at line 1880 of file network.h.
bool TNEANet::NodeAttrIsDeleted | ( | const int & | NId, |
const TStrIntPrH::TIter & | NodeHI | ||
) | const |
Definition at line 127 of file network.cpp.
bool TNEANet::NodeAttrIsFltDeleted | ( | const int & | NId, |
const TStrIntPrH::TIter & | NodeHI | ||
) | const |
Definition at line 150 of file network.cpp.
bool TNEANet::NodeAttrIsIntDeleted | ( | const int & | NId, |
const TStrIntPrH::TIter & | NodeHI | ||
) | const |
Definition at line 134 of file network.cpp.
bool TNEANet::NodeAttrIsStrDeleted | ( | const int & | NId, |
const TStrIntPrH::TIter & | NodeHI | ||
) | const |
Definition at line 142 of file network.cpp.
|
inline |
|
inline |
Saves the graph to a (binary) stream SOut.
Definition at line 1866 of file network.h.
Returns a vector of str attr names for node NId.
Definition at line 1992 of file network.h.
void TNEANet::StrAttrNameEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 213 of file network.cpp.
Returns a vector of str attr names for node NId.
Definition at line 1959 of file network.h.
void TNEANet::StrAttrNameNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Names | ||
) | const |
Definition at line 66 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 1996 of file network.h.
void TNEANet::StrAttrValueEI | ( | const TInt & | EId, |
TStrIntPrH::TIter | EdgeHI, | ||
TStrV & | Values | ||
) | const |
Definition at line 223 of file network.cpp.
Returns a vector of attr values for node NId.
Definition at line 1963 of file network.h.
void TNEANet::StrAttrValueNI | ( | const TInt & | NId, |
TStrIntPrH::TIter | NodeHI, | ||
TStrV & | Values | ||
) | const |
Definition at line 76 of file network.cpp.
|
private |
|
private |