SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 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...
 
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 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 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...
 
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 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 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...
 
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)
 
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)
 
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 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)
 
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)
 
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
 
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)
 
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)
 Adds a new IntV 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)
 Adds a new IntV 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 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 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 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 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)
 Adds a new TIntV node attribute to the hashmap. More...
 
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 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 }
 
- 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
 
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...
 
 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, 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
 
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:1880
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:1880
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:1880
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:1880
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:1880
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:1880
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:1880
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48

Member Function Documentation

int TModeNet::AddIntVAttrByVecN ( const TStr attr,
TVec< TIntV > &  Attrs 
)
private

Adds a new TIntV node attribute to the hashmap.

Definition at line 117 of file mmnet.cpp.

117  {
118  TInt CurrLen;
119  TVec<TIntV> NewVec;
120  CurrLen = VecOfIntVecVecsN.Len();
121  KeyToIndexTypeN.AddDat(attr, TIntPr(IntVType, CurrLen));
122  VecOfIntVecVecsN.Add(Attrs);
123  return 0;
124 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:1044
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TModeNet::AddNbrType ( const TStr CrossName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 82 of file mmnet.cpp.

82  {
83  //IAssertR(!NeighborTypes.IsKey(CrossName),TStr::Fmt("Neighbor Cross Types already exists: %s", CrossName.CStr()));
84  if (NeighborTypes.IsKey(CrossName)) { return -1; } //Don't want to add nbr type multiple times
85  bool hasSingleVector = (!isDir || !sameMode);
86  NeighborTypes.AddDat(CrossName, hasSingleVector);
87  return 0;
88 }
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TModeNet::AddNeighbor ( const int &  NId,
const int &  EId,
const bool  outEdge,
const int  linkId,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 31 of file mmnet.cpp.

31  {
32  TStr CrossName = MMNet->GetCrossName(linkId);
33  return AddNeighbor(NId, EId, outEdge, CrossName, sameMode, isDir);
34 }
TMMNet * MMNet
Definition: mmnet.h:47
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:578
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:31
int TModeNet::AddNeighbor ( const int &  NId,
const int &  EId,
const bool  outEdge,
const TStr linkName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 36 of file mmnet.cpp.

36  {
37  if (!NeighborTypes.IsKey(CrossName)) {
38  AddNbrType(CrossName, sameMode, isDir);
39  }
40  TStr Name = GetNeighborCrossName(CrossName, outEdge, sameMode, isDir);
41  return AppendIntVAttrDatN(NId, EId, Name);
42 }
int AppendIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Appends value onto the TIntV attribute for the given node.
Definition: network.h:2275
int AddNbrType(const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:82
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:4
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TNodeI TModeNet::BegMMNI ( ) const
inline

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

Definition at line 76 of file mmnet.h.

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

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

Definition at line 22 of file mmnet.cpp.

22  {
23  TStrV CNets;
24  NeighborTypes.GetKeyV(CNets);
25  for (int i=0; i < CNets.Len(); i++) {
26  MMNet->GetCrossNetByName(CNets[i]).Clr();
27  }
28  TNEANet::Clr();
29 }
TMMNet * MMNet
Definition: mmnet.h:47
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
void Clr()
Deletes all nodes and edges from the graph.
Definition: mmnet.cpp:174
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:442
void Clr()
Deletes all nodes and edges from the graph.
Definition: network.h:2230
TCrossNet & GetCrossNetByName(const TStr &CrossName) const
Gets a reference to the crossnet.
Definition: mmnet.cpp:695
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
void TModeNet::ClrNbr ( const TStr CrossNetName,
const bool &  outEdge,
const bool &  sameMode,
bool &  isDir 
)
private

Definition at line 15 of file mmnet.cpp.

15  {
16  TStr Name = GetNeighborCrossName(CrossNetName, outEdge, sameMode, isDir);
17  TVec<TIntV> Attrs(MxNId);
18  int index = KeyToIndexTypeN.GetDat(Name).Val2;
19  VecOfIntVecVecsN[index] = Attrs;
20 }
TInt MxNId
Definition: network.h:1861
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
Definition: dt.h:412
TVal2 Val2
Definition: ds.h:35
TStr GetNeighborCrossName(const TStr &CrossName, bool isOutEdge, const bool sameMode, bool isDir) const
Definition: mmnet.cpp:4
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
int TModeNet::DelNbrType ( const TStr CrossName)
private

Definition at line 90 of file mmnet.cpp.

90  {
91  //IAssertR(!NeighborTypes.IsKey(CrossName),TStr::Fmt("Neighbor Cross Types already exists: %s", CrossName.CStr()));
92  bool hasSingleVector = NeighborTypes.GetDat(CrossName);
93  NeighborTypes.DelKey(CrossName);
94  if (hasSingleVector) {
95  return DelAttrN(CrossName);
96  } else {
97  TStr InName = GetNeighborCrossName(CrossName, true, true, true);
98  TStr OutName = GetNeighborCrossName(CrossName, false, true, true);
99  if (DelAttrN(InName) == -1 || DelAttrN(OutName) == -1) {
100  return -1;
101  }
102  }
103  return 0;
104 }
int DelAttrN(const TStr &attr)
Removes all the values for node attr.
Definition: network.cpp:1283
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
void DelKey(const TKey &Key)
Definition: hash.h:362
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:4
int TModeNet::DelNeighbor ( const int &  NId,
const int &  EId,
bool  outEdge,
const TStr CrossName,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 44 of file mmnet.cpp.

44  {
45  if (!NeighborTypes.IsKey(CrossName)) {
46  return -1;
47  }
48  TStr Name = GetNeighborCrossName(CrossName, outEdge, sameMode, isDir);
49  return DelFromIntVAttrDatN(NId, EId, Name);
50 }
int DelFromIntVAttrDatN(const TNodeI &NodeI, const TInt &value, const TStr &attr)
Deletes value from the TIntV attribute for the given node.
Definition: network.h:2278
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:4
bool IsKey(const TKey &Key) const
Definition: hash.h:216
int TModeNet::DelNeighbor ( const int &  NId,
const int &  EId,
bool  outEdge,
const TInt linkId,
const bool  sameMode,
bool  isDir 
)
private

Definition at line 52 of file mmnet.cpp.

52  {
53  TStr CrossName = MMNet->GetCrossName(linkId);
54  return DelNeighbor(NId, EId, outEdge, CrossName, sameMode, isDir);
55 }
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:44
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:578
Definition: dt.h:412
void TModeNet::DelNode ( const int &  NId)
virtual

Deletes the given node from this mode.

Reimplemented from TNEANet.

Definition at line 57 of file mmnet.cpp.

57  {
58  TStrV Names;
59  GetCrossNetNames(Names);
60  for (int i=0; i < Names.Len(); i++) {
61  TCrossNet& Cross = MMNet->GetCrossNetByName(Names[i]);
62  TIntV OutEIds;
63  GetNeighborsByCrossNet(NId, Names[i], OutEIds, true);
64  for (int j=0; j < OutEIds.Len(); j++) {
65  Cross.DelEdge(OutEIds[j].Val);
66  }
67  if (Cross.IsDirect && Cross.Mode1 == Cross.Mode2) {
68  TIntV InEIds;
69  GetNeighborsByCrossNet(NId, Names[i], InEIds, false);
70  for (int j=0; j < InEIds.Len(); j++) {
71  Cross.DelEdge(InEIds[j].Val);
72  }
73  }
74  }
75  TNEANet::DelNode(NId);
76 }
TMMNet * MMNet
Definition: mmnet.h:47
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
int DelEdge(const int &EId)
Deletes an edge by its id.
Definition: mmnet.cpp:256
virtual void DelNode(const int &NId)
Deletes node of ID NId from the graph.
Definition: network.cpp:451
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:106
void GetCrossNetNames(TStrV &Names) const
Gets a list of CrossNets that have this Mode as either a source or destination type.
Definition: mmnet.h:71
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TCrossNet & GetCrossNetByName(const TStr &CrossName) const
Gets a reference to the crossnet.
Definition: mmnet.cpp:695
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
Implements a single CrossNet consisting of edges between two TModeNets (could be the same TModeNet) ...
Definition: mmnet.h:124
TNodeI TModeNet::EndMMNI ( ) const
inline

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

Definition at line 78 of file mmnet.h.

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

Definition at line 159 of file mmnet.cpp.

159  {
160  if (KeyToIndexTypeN.IsKey(attr)) {
161  return KeyToIndexTypeN.GetDat(attr).Val1;
162  }
163  return -1;
164 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 71 of file mmnet.h.

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

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

Definition at line 80 of file mmnet.h.

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

Definition at line 4 of file mmnet.cpp.

4  {
5  TStr Cpy(CrossName);
6  if (!isDir || !sameMode) { return Cpy; }
7  if (isOutEdge) {
8  Cpy += ":SRC";
9  } else {
10  Cpy += ":DST";
11  }
12  return Cpy;
13 }
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 106 of file mmnet.cpp.

106  {
107  //IAssertR(NeighborTypes.IsKey(Name), TStr::Fmt("Cross Type does not exist: %s", Name));
108  TBool hasSingleVector = NeighborTypes.GetDat(Name);
109  if (hasSingleVector) {
110  Neighbors = GetIntVAttrDatN(NId, Name);
111  } else {
112  TStr DirectionalName = GetNeighborCrossName(Name, isOutEId, true, true);
113  Neighbors = GetIntVAttrDatN(NId, DirectionalName);
114  }
115 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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:2314
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:4
Definition: dt.h:881
TModeNet& TModeNet::operator= ( const TModeNet Graph)
inline

Definition at line 85 of file mmnet.h.

85  {
86  if (this!=&Graph) {
87  MxNId=Graph.MxNId; MxEId=Graph.MxEId; NodeH=Graph.NodeH; EdgeH=Graph.EdgeH;
93  ModeId=Graph.ModeId; MMNet=Graph.MMNet; NeighborTypes=Graph.NeighborTypes;
94  }
95  return *this;
96  }
TVec< TIntV > VecOfIntVecsN
Definition: network.h:1870
THash< TStr, TFlt > FltDefaultsE
Definition: network.h:1869
TVec< TStrV > VecOfStrVecsE
Definition: network.h:1871
THash< TStr, TInt > IntDefaultsE
Definition: network.h:1867
TMMNet * MMNet
Definition: mmnet.h:47
TStrIntPrH KeyToIndexTypeE
Definition: network.h:1865
TAttr SAttrN
Definition: network.h:1876
THash< TStr, TFlt > FltDefaultsN
Definition: network.h:1869
TInt MxNId
Definition: network.h:1861
TVec< TIntV > VecOfIntVecsE
Definition: network.h:1870
TVec< TStrV > VecOfStrVecsN
Definition: network.h:1871
THash< TInt, TEdge > EdgeH
Definition: network.h:1863
TAttr SAttrE
Definition: network.h:1877
TVec< TFltV > VecOfFltVecsE
Definition: network.h:1872
TInt ModeId
Definition: mmnet.h:46
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
THash< TStr, TStr > StrDefaultsN
Definition: network.h:1868
TVec< TVec< TIntV > > VecOfIntVecVecsE
Definition: network.h:1873
TInt MxEId
Definition: network.h:1861
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
THash< TStr, TStr > StrDefaultsE
Definition: network.h:1868
TVec< TFltV > VecOfFltVecsN
Definition: network.h:1872
THash< TStr, TInt > IntDefaultsN
Definition: network.h:1867
THash< TInt, TNode > NodeH
Definition: network.h:1862
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
void TModeNet::RemoveCrossNets ( TModeNet Result,
TStrV CrossNets 
)
private

Definition at line 126 of file mmnet.cpp.

126  {
127  const TModeNet& self = *this;
128  Result = TModeNet(self, false);
129  for (TStrIntPrH::TIter it = KeyToIndexTypeN.BegI(); it < KeyToIndexTypeN.EndI(); it++) {
130  TStr AttrName = it.GetKey();
131  TInt AttrType = it.GetDat().GetVal1();
132  TInt AttrIndex = it.GetDat().GetVal2();
133  if (AttrType != IntVType) {
134  Result.KeyToIndexTypeN.AddDat(AttrName, it.GetDat());
135  } else {
136  TStr WithoutSuffix = AttrName;
137  bool removeSuffix = false;
138  if (AttrName.IsSuffix(":SRC") || AttrName.IsSuffix(":DST")) {
139  WithoutSuffix = AttrName.GetSubStr(0, AttrName.Len()-5);
140  removeSuffix = true;
141  }
142  bool isSingleVNbrAttr = (NeighborTypes.IsKey(AttrName) && NeighborTypes.GetDat(AttrName));
143  bool isMultiVNbrAttr = (removeSuffix && NeighborTypes.IsKey(WithoutSuffix) && !NeighborTypes.GetDat(WithoutSuffix));
144  if (isSingleVNbrAttr || isMultiVNbrAttr) {
145  TStr NbrName = isSingleVNbrAttr ? AttrName : WithoutSuffix;
146  if (CrossNets.IsIn(NbrName)) {
147  Result.AddNbrType(NbrName, removeSuffix, removeSuffix);
148  TVec<TIntV>& Attrs = VecOfIntVecVecsN[AttrIndex];
149  Result.AddIntVAttrByVecN(AttrName, Attrs);
150  }
151  } else {
152  TVec<TIntV>& Attrs = VecOfIntVecVecsN[AttrIndex];
153  Result.AddIntVAttrByVecN(AttrName, Attrs);
154  }
155  }
156  }
157 }
int Len() const
Definition: dt.h:487
bool IsIn(const TVal &Val) const
Checks whether element Val is a member of the vector.
Definition: ds.h:797
TIter BegI() const
Definition: hash.h:171
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TIter EndI() const
Definition: hash.h:176
TStrIntPrH KeyToIndexTypeN
KeyToIndexType[N|E]: Key->(Type,Index).
Definition: network.h:1865
int AddNbrType(const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:82
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:1044
THash< TStr, TBool > NeighborTypes
Definition: mmnet.h:48
int AddIntVAttrByVecN(const TStr &attr, TVec< TIntV > &Attrs)
Adds a new TIntV node attribute to the hashmap.
Definition: mmnet.cpp:117
Definition: dt.h:412
TVec< TVec< TIntV > > VecOfIntVecVecsN
Definition: network.h:1873
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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:1060
void Save(TSOut &SOut) const
Definition: hash.h:141
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:1918
void TModeNet::SetParentPointer ( TMMNet parent)
private

Definition at line 78 of file mmnet.cpp.

78  {
79  MMNet = parent;
80 }
TMMNet * MMNet
Definition: mmnet.h:47

Friends And Related Function Documentation

friend class TCrossNet
friend

Definition at line 115 of file mmnet.h.

friend class TMMNet
friend

Definition at line 114 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: