SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TModeNet Class Reference

The nodes of one particular mode in a TMMNet, and their neighbor vectors as TIntV attributes. More...

#include <mmnet.h>

Inherits TNEANet.

Classes

class  TNodeI
 Node iterator. Only forward iteration (operator++) is supported. More...
 

Public Types

typedef TModeNet TNetMM
 
- Public Types inherited from TNEANet
typedef TNEANet TNet
 
typedef TPt< TNEANetPNet
 

Public Member Functions

 TModeNet ()
 
 TModeNet (const int &TypeId)
 
 TModeNet (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a graph of nodes and edges. More...
 
 TModeNet (const int &Nodes, const int &Edges, const int &TypeId)
 
 TModeNet (const TModeNet &Graph)
 
 TModeNet (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...
 
void LoadShM (TShMIn &ShMIn)
 Loads graph from shared memory. More...
 
void DelNode (const int &NId)
 Deletes the given node from this mode. More...
 
void GetCrossNetNames (TStrV &Names) const
 Gets a list of CrossNets that have this Mode as either a source or destination type. More...
 
void GetNeighborsByCrossNet (const int &NId, TStr &Name, TIntV &Neighbors, const bool isOutEId=false) const
 For the given node, gets all the neighbors for the crossnet type. If this mode is both the source and dest type, use isOutEId to specify direction. More...
 
TNodeI BegMMNI () const
 Returns an iterator referring to the first node in the graph. More...
 
TNodeI EndMMNI () const
 Returns an iterator referring to the past-the-end node in the graph. More...
 
TNodeI GetMMNI (const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
void Clr ()
 Deletes all nodes from this mode and edges from associated crossnets. More...
 
TModeNetoperator= (const TModeNet &Graph)
 
- Public Member Functions inherited from TNEANet
 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. Expects data structures for sparse attributes. More...
 
void Save_V1 (TSOut &SOut) const
 Saves the graph to a (binary) stream SOut. Available for backwards compatibility. More...
 
void Save_V2 (TSOut &SOut) const
 Saves the graph without any sparse data structures. Available for backwards compatibility. More...
 
void LoadNetworkShM (TShMIn &ShMIn)
 load network from shared memory for this network More...
 
void ConvertToSparse ()
 
bool HasFlag (const TGraphFlag &Flag) const
 Allows for run-time checking the type of the graph (see the TGraphFlag for flags). More...
 
TNEANetoperator= (const TNEANet &Graph)
 
int GetNodes () const
 Returns the number of nodes in the network. More...
 
int AddNode (int NId=-1)
 Adds a node of ID NId to the network. More...
 
int AddNodeUnchecked (int NId=-1)
 Adds a node of ID NId to the network, noop if the node already exists. More...
 
int AddNode (const TNodeI &NodeI)
 Adds a node of ID NodeI.GetId() to the 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...
 
TAIntVI BegNAIntVI (const TStr &attr) const
 Returns an iterator referring to the first node's int attribute. More...
 
TAIntVI EndNAIntVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAIntVI GetNAIntVI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph. More...
 
TAFltVI BegNAFltVI (const TStr &attr) const
 Returns an iterator referring to the first node's flt attribute. More...
 
TAFltVI EndNAFltVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute. More...
 
TAFltVI GetNAFltVI (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 IntVAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void IntVAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void IntVAttrValueNI (const TInt &NId, TVec< TIntV > &Values) const
 Returns a vector of attr values for node NId. More...
 
void IntVAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TVec< TIntV > &Values) const
 
void FltVAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of flt attr names for node NId. More...
 
void FltVAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
 
void FltVAttrValueNI (const TInt &NId, TVec< TFltV > &Values) const
 Returns a vector of flt values for node NId. More...
 
void FltVAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TVec< TFltV > &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 IntVAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for edge EId. More...
 
void IntVAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void IntVAttrValueEI (const TInt &EId, TVec< TIntV > &Values) const
 Returns a vector of attr values for edge EId. More...
 
void IntVAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TVec< TIntV > &Values) const
 
void FltVAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of flt attr names for edge EId. More...
 
void FltVAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
 
void FltVAttrValueEI (const TInt &EId, TVec< TFltV > &Values) const
 Returns a vector of attr values for edge EId. More...
 
void FltVAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TVec< TFltV > &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...
 
TAIntVI BegEAIntVI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAIntVI EndEAIntVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAIntVI GetEAIntVI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAFltVI BegEAFltVI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAFltVI EndEAFltVI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAFltVI GetEAFltVI (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 AddIntVAttrDatN (const TNodeI &NodeI, const TIntV &value, const TStr &attr)
 Attribute based add function for attr to IntV value. More...
 
int AddIntVAttrDatN (const int &NId, const TIntV &value, const TStr &attr, TBool UseDense=true)
 
int AddFltVAttrDatN (const TNodeI &NodeI, const TFltV &value, const TStr &attr)
 Attribute based add function for attr to FltV value. More...
 
int AddFltVAttrDatN (const int &NId, const TFltV &value, const TStr &attr, TBool UseDense=true)
 
int AppendIntVAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr)
 Appends value onto the TIntV attribute for the given node. More...
 
int AppendIntVAttrDatN (const int &NId, const TInt &value, const TStr &attr, TBool UseDense=true)
 
int DelFromIntVAttrDatN (const TNodeI &NodeI, const TInt &value, const TStr &attr)
 Deletes value from the TIntV attribute for the given node. More...
 
int DelFromIntVAttrDatN (const int &NId, const TInt &value, const TStr &attr)
 
int AppendFltVAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr)
 Appends value onto the TFltV attribute for the given node. More...
 
int AppendFltVAttrDatN (const int &NId, const TFlt &value, const TStr &attr, TBool UseDense=true)
 
int DelFromFltVAttrDatN (const TNodeI &NodeI, const TFlt &value, const TStr &attr)
 Deletes value from the TFltV attribute for the given node. More...
 
int DelFromFltVAttrDatN (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)
 
int AddIntVAttrDatE (const TEdgeI &EdgeI, const TIntV &value, const TStr &attr)
 Attribute based add function for attr to IntV value. More...
 
int AddIntVAttrDatE (const int &EId, const TIntV &value, const TStr &attr, TBool UseDense=true)
 
int AppendIntVAttrDatE (const TEdgeI &EdgeI, const TInt &value, const TStr &attr)
 Appends value onto the TIntV attribute for the given node. More...
 
int AppendIntVAttrDatE (const int &EId, const TInt &value, const TStr &attr, TBool UseDense=true)
 
int AddFltVAttrDatE (const TEdgeI &EdgeI, const TFltV &value, const TStr &attr)
 Attribute based add function for attr to TFltV value. More...
 
int AddFltVAttrDatE (const int &EId, const TFltV &value, const TStr &attr, TBool UseDense=true)
 
int AppendFltVAttrDatE (const TEdgeI &EdgeI, const TFlt &value, const TStr &attr)
 Appends value onto the TFltV attribute for the given node. More...
 
int AppendFltVAttrDatE (const int &EId, const TFlt &value, const TStr &attr, TBool UseDense=true)
 
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)
 
TIntV GetIntVAttrDatN (const TNodeI &NodeI, const TStr &attr) const
 Gets the value of the intv attr from the node attr value vector. More...
 
TIntV GetIntVAttrDatN (const int &NId, const TStr &attr) const
 
TFltV GetFltVAttrDatN (const TNodeI &NodeI, const TStr &attr) const
 Gets the value of the fltv attr from the node attr value vector. More...
 
TFltV GetFltVAttrDatN (const int &NId, const TStr &attr) const
 
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)
 
TIntV GetIntVAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of the intv attr from the edge attr value vector. More...
 
TIntV GetIntVAttrDatE (const int &EId, const TStr &attr)
 
TFltV GetFltVAttrDatE (const TEdgeI &EdgeI, const TStr &attr)
 Gets the value of the fltv attr from the edge attr value vector. More...
 
TFltV GetFltVAttrDatE (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 AddIntVAttrN (const TStr &attr, TBool UseDense=true)
 Adds a new IntV node attribute to the hashmap. More...
 
int AddFltVAttrN (const TStr &attr, TBool UseDense=true)
 Adds a new FltV 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 AddIntVAttrE (const TStr &attr, TBool UseDense=true)
 Adds a new IntV edge attribute to the hashmap. More...
 
int AddFltVAttrE (const TStr &attr, TBool UseDense=true)
 Adds a new FltV 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
 Returns true if attr exists for node NId and has default value. More...
 
bool IsIntAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Int attr exists for node NId and has default value. More...
 
bool IsIntVAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if IntV attr exists for node NId and is an empty vector. More...
 
bool IsFltVAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if FltV attr exists for node NId and is an empty vector. More...
 
bool IsStrAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Str attr exists for node NId and has default value. More...
 
bool IsFltAttrDeletedN (const int &NId, const TStr &attr) const
 Returns true if Flt attr exists for node NId and has default value. More...
 
bool NodeAttrIsDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted for current node attr iterator. More...
 
bool NodeAttrIsIntDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int attr iterator. More...
 
bool NodeAttrIsIntVDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int vector attr iterator. More...
 
bool NodeAttrIsFltVDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node int vector attr iterator. More...
 
bool NodeAttrIsStrDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node str attr iterator. More...
 
bool NodeAttrIsFltDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns true if NId attr deleted value for current node flt attr iterator. More...
 
bool IsAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if attr exists for edge EId and has default value. More...
 
bool IsIntAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Int attr exists for edge EId and has default value. More...
 
bool IsIntVAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if IntV attr exists for edge EId and is an empty vector. More...
 
bool IsFltVAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if FltV attr exists for edge EId and is an empty vector. More...
 
bool IsStrAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Str attr exists for edge NId and has default value. More...
 
bool IsFltAttrDeletedE (const int &EId, const TStr &attr) const
 Returns true if Flt attr exists for edge NId and has default value. More...
 
bool EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge attr iterator. More...
 
bool EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge int attr iterator. More...
 
bool EdgeAttrIsIntVDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge int vector attr iterator. More...
 
bool EdgeAttrIsFltVDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge flt vector attr iterator. More...
 
bool EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge str attr iterator. More...
 
bool EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns true if EId attr deleted for current edge flt attr iterator. More...
 
TStr GetNodeAttrValue (const int &NId, const TStrIntPrH::TIter &NodeHI) const
 Returns node attribute value, converted to Str type. More...
 
TStr GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
 Returns edge attribute value, converted to Str type. More...
 
TFlt GetWeightOutEdges (const TNodeI &NI, const TStr &attr)
 Gets the sum of the weights of all the outgoing edges of the node. More...
 
bool IsFltAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
bool IsIntAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
bool IsStrAttrE (const TStr &attr)
 Checks if there is an edge attribute with name attr. More...
 
TVec< TFlt > & GetFltAttrVecE (const TStr &attr)
 Gets Vector for the Flt Attribute attr. More...
 
int GetFltKeyIdE (const int &EId)
 Gets keyid for edge with id EId. More...
 
void GetWeightOutEdgesV (TFltV &OutWeights, const TFltV &AttrVal)
 Fills OutWeights with the outgoing weight from each node. More...
 
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...
 
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 TInt &EId, const TStr &AttrName, const TInt &Val)
 Adds Int sparse attribute with name AttrName to the given edge with id EId. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TInt &Val)
 Adds Int sparse attribute with id AttrId to the given edge with id EId. 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 TInt &EId, const TStr &AttrName, const TFlt &Val)
 Adds Flt sparse attribute with name AttrName to the given edge with id EId. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TFlt &Val)
 Adds Flt sparse attribute with id AttrId to the given edge with id EId. 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 TInt &EId, const TStr &AttrName, const TStr &Val)
 Adds Str sparse attribute with name AttrName to the given edge with id EId. More...
 
int AddSAttrDatE (const TInt &EId, const TInt &AttrId, const TStr &Val)
 Adds Str sparse attribute with id AttrId to the given edge with id EId. 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 TInt &EId, const TStr &AttrName, TInt &ValX) const
 Gets Int sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TInt &ValX) const
 Gets Int sparse attribute with id AttrId from edge with id EId. 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 TInt &EId, const TStr &AttrName, TFlt &ValX) const
 Gets Flt sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TFlt &ValX) const
 Gets Flt sparse attribute with id AttrId from edge with id EId. 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 TInt &EId, const TStr &AttrName, TStr &ValX) const
 Gets Str sparse attribute with name AttrName from edge with id EId. More...
 
int GetSAttrDatE (const TInt &EId, const TInt &AttrId, TStr &ValX) const
 Gets Str sparse attribute with id AttrId from edge with id EId. 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 TInt &EId, const TStr &AttrName)
 Deletes sparse attribute with name AttrName from edge with id EId. More...
 
int DelSAttrDatE (const TInt &EId, const TInt &AttrId)
 Deletes sparse attribute with id AttrId from edge with id EId. 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 TInt &EId, const TAttrType AttrType, TAttrPrV &AttrV) const
 Gets a list of all sparse attributes of type AttrType for edge with id EId. 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, TIntV &IdV) const
 Gets a list of all edges that have a sparse attribute with name AttrName. More...
 
int GetIdVSAttrE (const TInt &AttrId, TIntV &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...
 

Private Member Functions

 TModeNet (const TModeNet &Graph, bool isSubModeGraph)
 
int AddNeighbor (const int &NId, const int &EId, const bool outEdge, const int linkId, const bool sameMode, bool isDir)
 
int AddNeighbor (const int &NId, const int &EId, const bool outEdge, const TStr &linkName, const bool sameMode, bool isDir)
 
int DelNeighbor (const int &NId, const int &EId, bool outEdge, const TStr &CrossName, const bool sameMode, bool isDir)
 
int DelNeighbor (const int &NId, const int &EId, bool outEdge, const TInt &linkId, const bool sameMode, bool isDir)
 
TStr GetNeighborCrossName (const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
 
void SetParentPointer (TMMNet *parent)
 
int AddNbrType (const TStr &CrossName, const bool sameMode, bool isDir)
 
int AddIntVAttrByVecN (const TStr &attr, TVec< TIntV > &Attrs, TBool UseDense=true)
 Adds a new TIntV node attribute to the hashmap. More...
 
int AddIntVAttrByHashN (const TStr &attr, THash< TInt, TIntV > &Attrs)
 
void RemoveCrossNets (TModeNet &Result, TStrV &CrossNets)
 
int DelNbrType (const TStr &CrossName)
 
int GetAttrTypeN (const TStr &attr) const
 
void ClrNbr (const TStr &CrossNetName, const bool &outEdge, const bool &sameMode, bool &isDir)
 

Private Attributes

TInt ModeId
 
TMMNetMMNet
 
THash< TStr, TBoolNeighborTypes
 

Friends

class TMMNet
 
class TCrossNet
 

Additional Inherited Members

- Static Public Member Functions inherited from TNEANet
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 Load_V1 (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible. More...
 
static PNEANet Load_V2 (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it. Backwards compatible without Sparse. More...
 
static PNEANet LoadShM (TShMIn &ShMIn)
 Static constructor that loads the network from memory. More...
 
static PNEANet GetSmallGraph ()
 Returns a small multigraph on 5 nodes and 6 edges. More...
 
- Public Attributes inherited from TNEANet
TCRef CRef
 
- Protected Types inherited from TNEANet
enum  {
  IntType, StrType, FltType, IntVType,
  FltVType
}
 
- Protected Member Functions inherited from TNEANet
TNodeGetNode (const int &NId)
 
const TNodeGetNode (const int &NId) const
 
TEdgeGetEdge (const int &EId)
 
const TEdgeGetEdge (const int &EId) const
 
int AddAttributes (const int NId)
 
TInt GetIntAttrDefaultN (const TStr &attribute) const
 Gets Int node attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultN (const TStr &attribute) const
 Gets Str node attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultN (const TStr &attribute) const
 Gets Flt node attribute val. If not a proper attr, return default. More...
 
TInt GetIntAttrDefaultE (const TStr &attribute) const
 Gets Int edge attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultE (const TStr &attribute) const
 Gets Str edge attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultE (const TStr &attribute) const
 Gets Flt edge attribute val. If not a proper attr, return default. More...
 
TInt CheckDenseOrSparseN (const TStr &attr) const
 Return 1 if in Dense, 0 if in Sparse, -1 if neither. More...
 
TInt CheckDenseOrSparseE (const TStr &attr) const
 
 TNEANet (const TNEANet &Graph, bool modeSubGraph)
 
 TNEANet (bool copyAll, const TNEANet &Graph)
 
- Protected Attributes inherited from TNEANet
TInt MxNId
 
TInt MxEId
 
THash< TInt, TNodeNodeH
 
THash< TInt, TEdgeEdgeH
 
TStrIntPrH KeyToIndexTypeN
 KeyToIndexType[N|E]: Key->(Type,Index). More...
 
TStrIntPrH KeyToIndexTypeE
 
THash< TStr, TBoolKeyToDenseN
 KeyToDense[N|E]: Key->(True if Vec, False if Hash) More...
 
THash< TStr, TBoolKeyToDenseE
 
THash< TStr, TIntIntDefaultsN
 
THash< TStr, TIntIntDefaultsE
 
THash< TStr, TStrStrDefaultsN
 
THash< TStr, TStrStrDefaultsE
 
THash< TStr, TFltFltDefaultsN
 
THash< TStr, TFltFltDefaultsE
 
TVec< TIntVVecOfIntVecsN
 
TVec< TIntVVecOfIntVecsE
 
TVec< TStrVVecOfStrVecsN
 
TVec< TStrVVecOfStrVecsE
 
TVec< TFltVVecOfFltVecsN
 
TVec< TFltVVecOfFltVecsE
 
TVec< TVec< TIntV > > VecOfIntVecVecsN
 
TVec< TVec< TIntV > > VecOfIntVecVecsE
 
TVec< TVec< TFltV > > VecOfFltVecVecsN
 
TVec< TVec< TFltV > > VecOfFltVecVecsE
 
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
 
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
 
TVec< THash< TInt, TFltV > > VecOfFltHashVecsN
 
TVec< THash< TInt, TFltV > > VecOfFltHashVecsE
 
TAttr SAttrN
 
TAttr SAttrE
 

Detailed Description

The nodes of one particular mode in a TMMNet, and their neighbor vectors as TIntV attributes.

The class corresponding to one particular mode in a TMMNet. This class contains only the set of nodes in that mode, and does not explicitly model edges. For easy access to neighbors, there is a dense TIntV attribute for each CrossNet, which is a vector of edge ids of neighbors of our mode in that CrossNet.

Definition at line 23 of file mmnet.h.

Member Typedef Documentation

Definition at line 25 of file mmnet.h.

Constructor & Destructor Documentation

TModeNet::TModeNet ( )
inline

Definition at line 51 of file mmnet.h.

51 : TNEANet(), ModeId(-1), MMNet(), NeighborTypes() { }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( const int &  TypeId)
inline

Definition at line 52 of file mmnet.h.

52 : TNEANet(), ModeId(TypeId), MMNet(), NeighborTypes() { }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( const int &  Nodes,
const int &  Edges 
)
inlineexplicit

Constructor that reserves enough memory for a graph of nodes and edges.

Definition at line 54 of file mmnet.h.

54  : TNEANet(Nodes, Edges),
55  ModeId(-1), MMNet(), NeighborTypes(){ }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( const int &  Nodes,
const int &  Edges,
const int &  TypeId 
)
inlineexplicit

Definition at line 56 of file mmnet.h.

56  : TNEANet(Nodes, Edges),
57  ModeId(TypeId), MMNet(), NeighborTypes() { }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( const TModeNet Graph)
inline

Definition at line 58 of file mmnet.h.

58 : TNEANet(true, Graph), ModeId(Graph.ModeId), MMNet(Graph.MMNet), NeighborTypes(Graph.NeighborTypes) { }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( TSIn SIn)
inline

Constructor for loading the graph from a (binary) stream SIn.

Definition at line 60 of file mmnet.h.

60 : TNEANet(SIn), ModeId(SIn), MMNet(), NeighborTypes(SIn) { }
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet::TModeNet ( const TModeNet Graph,
bool  isSubModeGraph 
)
inlineprivate

Definition at line 62 of file mmnet.h.

62 : TNEANet(Graph, isSubModeGraph), ModeId(Graph.ModeId), MMNet(), NeighborTypes() {}
TMMNet * MMNet
Definition: mmnet.h:47
TInt ModeId
Definition: mmnet.h:46
TNEANet()
Definition: network.h:2124
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48

Member Function Documentation

int TModeNet::AddIntVAttrByHashN ( const TStr attr,
THash< TInt, TIntV > &  Attrs 
)
private

Definition at line 144 of file mmnet.cpp.

144  {
145  TInt CurrLen;
146  THash<TInt, TIntV> NewHash;
147  CurrLen = VecOfIntHashVecsN.Len();
148  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
149  KeyToDenseN.AddDat(attr, false);
150  for (int i=0; i< Attrs.Len(); i++) {
151  NewHash.AddDat(i, Attrs[i]);
152  }
153  VecOfIntHashVecsN.Add(NewHash);
154  return 0;
155 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
int TModeNet::AddIntVAttrByVecN ( const TStr attr,
TVec< TIntV > &  Attrs,
TBool  UseDense = true 
)
private

Adds a new TIntV node attribute to the hashmap.

Definition at line 124 of file mmnet.cpp.

124  {
125  TInt CurrLen;
126  if (UseDense) {
127  CurrLen = VecOfIntVecVecsN.Len();
128  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
129  KeyToDenseN.AddDat(attr, true);
130  VecOfIntVecVecsN.Add(Attrs);
131  } else {
132  THash<TInt, TIntV> NewHash;
133  CurrLen = VecOfIntHashVecsN.Len();
134  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
135  KeyToDenseN.AddDat(attr, false);
136  for (int i=0; i< Attrs.Len(); i++) {
137  NewHash.AddDat(i, Attrs[i]);
138  }
139  VecOfIntHashVecsN.Add(NewHash);
140  }
141  return 0;
142 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
int TModeNet::AddNbrType ( const TStr CrossName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 89 of file mmnet.cpp.

89  {
90  //IAssertR(!NeighborTypes.IsKey(CrossName),TStr::Fmt("Neighbor Cross Types already exists: %s", CrossName.CStr()));
91  if (NeighborTypes.IsKey(CrossName)) { return -1; } //Don't want to add nbr type multiple times
92  bool hasSingleVector = (!isDir || !sameMode);
93  NeighborTypes.AddDat(CrossName, hasSingleVector);
94  return 0;
95 }
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TModeNet::AddNeighbor ( const int &  NId,
const int &  EId,
const bool  outEdge,
const int  linkId,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 38 of file mmnet.cpp.

38  {
39  TStr CrossName = MMNet->GetCrossName(linkId);
40  return AddNeighbor(NId, EId, outEdge, CrossName, sameMode, isDir);
41 }
TMMNet * MMNet
Definition: mmnet.h:47
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:640
Definition: dt.h:412
int AddNeighbor(const int &NId, const int &EId, const bool outEdge, const int linkId, const bool sameMode, bool isDir)
Definition: mmnet.cpp:38
int TModeNet::AddNeighbor ( const int &  NId,
const int &  EId,
const bool  outEdge,
const TStr linkName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 43 of file mmnet.cpp.

43  {
44  if (!NeighborTypes.IsKey(CrossName)) {
45  AddNbrType(CrossName, sameMode, isDir);
46  }
47  TStr Name = GetNeighborCrossName(CrossName, outEdge, sameMode, isDir);
48  return AppendIntVAttrDatN(NId, EId, Name);
49 }
int AppendIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
Definition: network.h:2880
int AddNbrType(const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:89
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
Definition: dt.h:412
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:3
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TNodeI TModeNet::BegMMNI ( ) const
inline

Returns an iterator referring to the first node in the graph.

Definition at line 82 of file mmnet.h.

82 { return TNodeI(NodeH.BegI(), this); }
TIter BegI() const
Definition: hash.h:213
THash< TInt, TNode > NodeH
Definition: network.h:2053
void TModeNet::Clr ( )

Deletes all nodes from this mode and edges from associated crossnets.

Definition at line 29 of file mmnet.cpp.

29  {
30  TStrV CNets;
31  NeighborTypes.GetKeyV(CNets);
32  for (int i=0; i < CNets.Len(); i++) {
33  MMNet->GetCrossNetByName(CNets[i]).Clr();
34  }
35  TNEANet::Clr();
36 }
TMMNet * MMNet
Definition: mmnet.h:47
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void Clr()
Deletes all nodes and edges from the graph.
Definition: mmnet.cpp:219
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
void Clr()
Deletes all nodes and edges from the graph.
Definition: network.h:2836
TCrossNet & GetCrossNetByName(const TStr &CrossName) const
Gets a reference to the crossnet.
Definition: mmnet.cpp:758
void TModeNet::ClrNbr ( const TStr CrossNetName,
const bool &  outEdge,
const bool &  sameMode,
bool &  isDir 
)
private

Definition at line 14 of file mmnet.cpp.

14  {
15  TStr Name = GetNeighborCrossName(CrossNetName, outEdge, sameMode, isDir);
16  TInt location = CheckDenseOrSparseN(Name);
17  int index = KeyToIndexTypeN.GetDat(Name).Val2;
18  if (location == 1) {
19  TVec<TIntV> Attrs(MxNId);
20  VecOfIntVecVecsN[index] = Attrs;
21  } else {
22  THash<TInt, TIntV> Attrs;
23  VecOfIntHashVecsN[index] = Attrs;
24  }
25 
26 
27 }
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
TInt MxNId
Definition: network.h:2052
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
Definition: dt.h:1137
Definition: dt.h:412
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVal2 Val2
Definition: ds.h:35
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:3
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
int TModeNet::DelNbrType ( const TStr CrossName)
private

Definition at line 97 of file mmnet.cpp.

97  {
98  //IAssertR(!NeighborTypes.IsKey(CrossName),TStr::Fmt("Neighbor Cross Types already exists: %s", CrossName.CStr()));
99  bool hasSingleVector = NeighborTypes.GetDat(CrossName);
100  NeighborTypes.DelKey(CrossName);
101  if (hasSingleVector) {
102  return DelAttrN(CrossName);
103  } else {
104  TStr InName = GetNeighborCrossName(CrossName, true, true, true);
105  TStr OutName = GetNeighborCrossName(CrossName, false, true, true);
106  if (DelAttrN(InName) == -1 || DelAttrN(OutName) == -1) {
107  return -1;
108  }
109  }
110  return 0;
111 }
int DelAttrN(const TStr &attr)
Removes all the values for node attr.
Definition: network.cpp:1735
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
void DelKey(const TKey &Key)
Definition: hash.h:404
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
Definition: dt.h:412
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:3
int TModeNet::DelNeighbor ( const int &  NId,
const int &  EId,
bool  outEdge,
const TStr CrossName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 51 of file mmnet.cpp.

51  {
52  if (!NeighborTypes.IsKey(CrossName)) {
53  return -1;
54  }
55  TStr Name = GetNeighborCrossName(CrossName, outEdge, sameMode, isDir);
56  return DelFromIntVAttrDatN(NId, EId, Name);
57 }
int DelFromIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Deletes value from the TIntV attribute for the given node.
Definition: network.h:2883
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
Definition: dt.h:412
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:3
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int TModeNet::DelNeighbor ( const int &  NId,
const int &  EId,
bool  outEdge,
const TInt linkId,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 59 of file mmnet.cpp.

59  {
60  TStr CrossName = MMNet->GetCrossName(linkId);
61  return DelNeighbor(NId, EId, outEdge, CrossName, sameMode, isDir);
62 }
TMMNet * MMNet
Definition: mmnet.h:47
int DelNeighbor(const int &NId, const int &EId, bool outEdge, const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:51
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:640
Definition: dt.h:412
void TModeNet::DelNode ( const int &  NId)
virtual

Deletes the given node from this mode.

Reimplemented from TNEANet.

Definition at line 64 of file mmnet.cpp.

64  {
65  TStrV Names;
66  GetCrossNetNames(Names);
67  for (int i=0; i < Names.Len(); i++) {
68  TCrossNet& Cross = MMNet->GetCrossNetByName(Names[i]);
69  TIntV OutEIds;
70  GetNeighborsByCrossNet(NId, Names[i], OutEIds, true);
71  for (int j=0; j < OutEIds.Len(); j++) {
72  Cross.DelEdge(OutEIds[j].Val);
73  }
74  if (Cross.IsDirect && Cross.Mode1 == Cross.Mode2) {
75  TIntV InEIds;
76  GetNeighborsByCrossNet(NId, Names[i], InEIds, false);
77  for (int j=0; j < InEIds.Len(); j++) {
78  Cross.DelEdge(InEIds[j].Val);
79  }
80  }
81  }
82  TNEANet::DelNode(NId);
83 }
TMMNet * MMNet
Definition: mmnet.h:47
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
int DelEdge(const int &EId)
Deletes an edge by its id.
Definition: mmnet.cpp:301
virtual void DelNode(const int &NId)
Deletes node of ID NId from the graph.
Definition: network.cpp:631
void GetNeighborsByCrossNet(const int &NId, TStr &Name, TIntV &Neighbors, const bool isOutEId=false) const
For the given node, gets all the neighbors for the crossnet type. If this mode is both the source and...
Definition: mmnet.cpp:113
void GetCrossNetNames(TStrV &Names) const
Gets a list of CrossNets that have this Mode as either a source or destination type.
Definition: mmnet.h:77
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TCrossNet & GetCrossNetByName(const TStr &CrossName) const
Gets a reference to the crossnet.
Definition: mmnet.cpp:758
Implements a single CrossNet consisting of edges between two TModeNets (could be the same TModeNet) ...
Definition: mmnet.h:133
TNodeI TModeNet::EndMMNI ( ) const
inline

Returns an iterator referring to the past-the-end node in the graph.

Definition at line 84 of file mmnet.h.

84 { return TNodeI(NodeH.EndI(), this); }
TIter EndI() const
Definition: hash.h:218
THash< TInt, TNode > NodeH
Definition: network.h:2053
int TModeNet::GetAttrTypeN ( const TStr attr) const
private

Definition at line 204 of file mmnet.cpp.

204  {
205  if (KeyToIndexTypeN.IsKey(attr)) {
206  return KeyToIndexTypeN.GetDat(attr).Val1;
207  }
208  return -1;
209 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
void TModeNet::GetCrossNetNames ( TStrV Names) const
inline

Gets a list of CrossNets that have this Mode as either a source or destination type.

Definition at line 77 of file mmnet.h.

77 { NeighborTypes.GetKeyV(Names); }
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
TNodeI TModeNet::GetMMNI ( const int &  NId) const
inline

Returns an iterator referring to the node of ID NId in the graph.

Definition at line 86 of file mmnet.h.

86 { return TNodeI(NodeH.GetI(NId), this); }
THash< TInt, TNode > NodeH
Definition: network.h:2053
TIter GetI(const TKey &Key) const
Definition: hash.h:220
TStr TModeNet::GetNeighborCrossName ( const TStr CrossName,
bool  isOutEdge,
const bool  sameMode,
bool  isDir 
) const
private

Definition at line 3 of file mmnet.cpp.

3  {
4  TStr Cpy(CrossName);
5  if (!isDir || !sameMode) { return Cpy; }
6  if (isOutEdge) {
7  Cpy += ":SRC";
8  } else {
9  Cpy += ":DST";
10  }
11  return Cpy;
12 }
Definition: dt.h:412
void TModeNet::GetNeighborsByCrossNet ( const int &  NId,
TStr Name,
TIntV Neighbors,
const bool  isOutEId = false 
) const

For the given node, gets all the neighbors for the crossnet type. If this mode is both the source and dest type, use isOutEId to specify direction.

Definition at line 113 of file mmnet.cpp.

113  {
114  //IAssertR(NeighborTypes.IsKey(Name), TStr::Fmt("Cross Type does not exist: %s", Name));
115  TBool hasSingleVector = NeighborTypes.GetDat(Name);
116  if (hasSingleVector) {
117  Neighbors = GetIntVAttrDatN(NId, Name);
118  } else {
119  TStr DirectionalName = GetNeighborCrossName(Name, isOutEId, true, true);
120  Neighbors = GetIntVAttrDatN(NId, DirectionalName);
121  }
122 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIntV GetIntVAttrDatN(const TNodeI &NodeI, const TStr &attr) const
Gets the value of the intv attr from the node attr value vector.
Definition: network.h:2941
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
Definition: dt.h:412
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:3
Definition: dt.h:974
void TModeNet::LoadShM ( TShMIn ShMIn)
inline

Loads graph from shared memory.

Definition at line 68 of file mmnet.h.

68  {
70  ModeId = TInt(ShMIn);
71  MMNet = NULL;
72  NeighborTypes.LoadShM(ShMIn);
73  }
TMMNet * MMNet
Definition: mmnet.h:47
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
Definition: hash.h:157
TInt ModeId
Definition: mmnet.h:46
void LoadNetworkShM(TShMIn &ShMIn)
load network from shared memory for this network
Definition: network.cpp:2
Definition: dt.h:1137
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
TModeNet& TModeNet::operator= ( const TModeNet Graph)
inline

Definition at line 91 of file mmnet.h.

91  {
92  if (this!=&Graph) {
93  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH;
101  ModeId=Graph.ModeId; MMNet=Graph.MMNet; NeighborTypes=Graph.NeighborTypes;
102  }
103  return *this;
104  }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:2063
THash< TStr, TBool > KeyToDenseE
Definition: network.h:2058
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:2062
TVec< TStrV > VecOfStrVecsE
Definition: network.h:2064
THash< TStr, TInt > IntDefaultsE
Definition: network.h:2060
TVec< THash< TInt, TIntV > > VecOfIntHashVecsE
Definition: network.h:2068
TMMNet * MMNet
Definition: mmnet.h:47
TStrIntPrH KeyToIndexTypeE
Definition: network.h:2056
TAttr SAttrN
Definition: network.h:2072
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:2062
TInt MxNId
Definition: network.h:2052
TVec< TIntV > VecOfIntVecsE
Definition: network.h:2063
TVec< TStrV > VecOfStrVecsN
Definition: network.h:2064
THash< TInt, TEdge > EdgeH
Definition: network.h:2054
TAttr SAttrE
Definition: network.h:2073
TVec< TFltV > VecOfFltVecsE
Definition: network.h:2065
TInt ModeId
Definition: mmnet.h:46
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
THash< TStr, TStr > StrDefaultsN
Definition: network.h:2061
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:2066
TInt MxEId
Definition: network.h:2052
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
THash< TStr, TStr > StrDefaultsE
Definition: network.h:2061
TVec< TFltV > VecOfFltVecsN
Definition: network.h:2065
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
THash< TStr, TInt > IntDefaultsN
Definition: network.h:2060
THash< TInt, TNode > NodeH
Definition: network.h:2053
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
THash< TStr, TBool > KeyToDenseN
KeyToDense[N|E]: Key->(True if Vec, False if Hash)
Definition: network.h:2058
void TModeNet::RemoveCrossNets ( TModeNet Result,
TStrV CrossNets 
)
private

Definition at line 157 of file mmnet.cpp.

157  {
158  const TModeNet& self = *this;
159  Result = TModeNet(self, false);
160  for (TStrIntPrH::TIter it = KeyToIndexTypeN.BegI(); it < KeyToIndexTypeN.EndI(); it++) {
161  TStr AttrName = it.GetKey();
162  TInt AttrType = it.GetDat().GetVal1();
163  TInt AttrIndex = it.GetDat().GetVal2();
164  if (AttrType != IntVType) {
165  Result.KeyToIndexTypeN.AddDat(AttrName, it.GetDat());
166  } else {
167  TStr WithoutSuffix = AttrName;
168  bool removeSuffix = false;
169  if (AttrName.IsSuffix(":SRC") || AttrName.IsSuffix(":DST")) {
170  WithoutSuffix = AttrName.GetSubStr(0, AttrName.Len()-5);
171  removeSuffix = true;
172  }
173  bool isSingleVNbrAttr = (NeighborTypes.IsKey(AttrName) && NeighborTypes.GetDat(AttrName));
174  bool isMultiVNbrAttr = (removeSuffix && NeighborTypes.IsKey(WithoutSuffix) && !NeighborTypes.GetDat(WithoutSuffix));
175  if (isSingleVNbrAttr || isMultiVNbrAttr) {
176  TStr NbrName = isSingleVNbrAttr ? AttrName : WithoutSuffix;
177  if (CrossNets.IsIn(NbrName)) {
178  Result.AddNbrType(NbrName, removeSuffix, removeSuffix);
179  TInt location = CheckDenseOrSparseN(AttrName);
180  if (location == 1) {
181  TVec<TIntV>& Attrs = VecOfIntVecVecsN[AttrIndex];
182  Result.AddIntVAttrByVecN(AttrName, Attrs);
183  } else {
184  THash<TInt, TIntV>& Attrs = VecOfIntHashVecsN[AttrIndex];
185  Result.AddIntVAttrByHashN(AttrName, Attrs);
186  }
187 
188  }
189  } else {
190  TInt location = CheckDenseOrSparseN(AttrName);
191  if (location == 1) {
192  TVec<TIntV>& Attrs = VecOfIntVecVecsN[AttrIndex];
193  Result.AddIntVAttrByVecN(AttrName, Attrs);
194  } else {
195  THash<TInt, TIntV>& Attrs = VecOfIntHashVecsN[AttrIndex];
196  Result.AddIntVAttrByHashN(AttrName, Attrs);
197  }
198 
199  }
200  }
201  }
202 }
int Len() const
Definition: dt.h:490
int AddIntVAttrByVecN(const TStr &attr, TVec< TIntV > &Attrs, TBool UseDense=true)
Adds a new TIntV node attribute to the hashmap.
Definition: mmnet.cpp:124
int AddIntVAttrByHashN(const TStr &attr, THash< TInt, TIntV > &Attrs)
Definition: mmnet.cpp:144
TInt CheckDenseOrSparseN(const TStr &attr) const
Return 1 if in Dense, 0 if in Sparse, -1 if neither.
Definition: network.h:2110
bool IsIn(const TVal &Val) const
Checks whether element Val is a member of the vector.
Definition: ds.h:828
TIter BegI() const
Definition: hash.h:213
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter EndI() const
Definition: hash.h:218
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:2056
int AddNbrType(const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:89
bool IsSuffix(const char *Str) const
Definition: dt.cpp:1093
The nodes of one particular mode in a TMMNet, and their neighbor vectors as TIntV attributes...
Definition: mmnet.h:23
TModeNet()
Definition: mmnet.h:51
Definition: dt.h:1137
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
Definition: dt.h:412
TVec< THash< TInt, TIntV > > VecOfIntHashVecsN
Definition: network.h:2068
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:2066
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
void TModeNet::Save ( TSOut SOut) const
inline

Saves the graph to a (binary) stream SOut.

Definition at line 65 of file mmnet.h.

65  {
66  TNEANet::Save(SOut); ModeId.Save(SOut); NeighborTypes.Save(SOut); }
void Save(TSOut &SOut) const
Definition: dt.h:1153
void Save(TSOut &SOut) const
Definition: hash.h:183
TInt ModeId
Definition: mmnet.h:46
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
void Save(TSOut &SOut) const
Saves the graph to a (binary) stream SOut. Expects data structures for sparse attributes.
Definition: network.h:2187
void TModeNet::SetParentPointer ( TMMNet parent)
private

Definition at line 85 of file mmnet.cpp.

85  {
86  MMNet = parent;
87 }
TMMNet * MMNet
Definition: mmnet.h:47

Friends And Related Function Documentation

friend class TCrossNet
friend

Definition at line 124 of file mmnet.h.

friend class TMMNet
friend

Definition at line 123 of file mmnet.h.

Member Data Documentation

TMMNet* TModeNet::MMNet
private

Definition at line 47 of file mmnet.h.

TInt TModeNet::ModeId
private

Definition at line 46 of file mmnet.h.

THash<TStr, TBool> TModeNet::NeighborTypes
private

Definition at line 48 of file mmnet.h.


The documentation for this class was generated from the following files: