SNAP Library 2.1, Developer Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TNEANet Class Reference

TODO TNEANet describe time complexity for basic operations. More...

#include <network.h>

Collaboration diagram for TNEANet:

List of all members.

Classes

class  TAFltI
 NodeEdge Attr iterator. Iterate through all node for one attr value. More...
class  TAIntI
 Node/Edge Attr iterator. Iterate through all node for one attr value. More...
class  TAStrI
 Node/Edge Attr iterator. Iterate through all node for one attr value. More...
class  TEdge
class  TEdgeI
 Edge iterator. Only forward iteration (operator++) is supported. More...
class  TNode
class  TNodeI
 Node iterator. Only forward iteration (operator++) is supported. More...

Public Types

typedef TNEANet TNet
typedef TPt< TNEANetPNet

Public Member Functions

 TNEANet ()
 TNEANet (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a graph of nodes and edges.
 TNEANet (const TNEANet &Graph)
 TNEANet (TSIn &SIn)
 Constructor for loading the graph from a (binary) stream SIn.
void Save (TSOut &SOut) const
 Saves the graph to a (binary) stream SOut.
bool HasFlag (const TGraphFlag &Flag) const
 Allows for run-time checking the type of the graph (see the TGraphFlag for flags).
TNEANetoperator= (const TNEANet &Graph)
int GetNodes () const
 Returns the number of nodes in the graph.
int AddNode (int NId=-1)
 Adds a node of ID NId to the graph.
int AddNode (const TNodeI &NodeId)
 Adds a node of ID NodeI.GetId() to the graph.
void DelNode (const int &NId)
 Deletes node of ID NId from the graph.
void DelNode (const TNode &NodeI)
 Deletes node of ID NodeI.GetId() from the graph.
bool IsNode (const int &NId) const
 Tests whether ID NId is a node.
TNodeI BegNI () const
 Returns an iterator referring to the first node in the graph.
TNodeI EndNI () const
 Returns an iterator referring to the past-the-end node in the graph.
TNodeI GetNI (const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph.
TAIntI BegNAIntI (const TStr &attr) const
 Returns an iterator referring to the first node's int attribute.
TAIntI EndNAIntI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAIntI GetNAIntI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph.
TAStrI BegNAStrI (const TStr &attr) const
 Returns an iterator referring to the first node's str attribute.
TAStrI EndNAStrI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAStrI GetNAStrI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph.
TAFltI BegNAFltI (const TStr &attr) const
 Returns an iterator referring to the first node's flt attribute.
TAFltI EndNAFltI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAFltI GetNAFltI (const TStr &attr, const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph.
void AttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of attr names for node NId.
void AttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
void AttrValueNI (const TInt &NId, TStrV &Values) const
 Returns a vector of attr avlues for node NId.
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.
void IntAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
void IntAttrValueNI (const TInt &NId, TIntV &Values) const
 Returns a vector of attr avlues for node NId.
void IntAttrValueNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TIntV &Values) const
void StrAttrNameNI (const TInt &NId, TStrV &Names) const
 Returns a vector of str attr names for node NId.
void StrAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
void StrAttrValueNI (const TInt &NId, TStrV &Values) const
 Returns a vector of attr avlues for node NId.
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.
void FltAttrNameNI (const TInt &NId, TStrIntPrH::TIter NodeHI, TStrV &Names) const
void FltAttrValueNI (const TInt &NId, TFltV &Values) const
 Returns a vector of attr avlues for node NId.
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.
void AttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
void AttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr avlues for edge EId.
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.
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.
void IntAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TIntV &Values) const
void StrAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of str attr names for node NId.
void StrAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
void StrAttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr avlues for node NId.
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.
void FltAttrNameEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TStrV &Names) const
void FltAttrValueEI (const TInt &EId, TFltV &Values) const
 Returns a vector of attr avlues for node NId.
void FltAttrValueEI (const TInt &EId, TStrIntPrH::TIter EdgeHI, TFltV &Values) const
TAIntI BegEAIntI (const TStr &attr) const
 Returns an iterator referring to the first node's int attribute.
TAIntI EndEAIntI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAIntI GetEAIntI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the node of ID EId in the graph.
TAStrI BegEAStrI (const TStr &attr) const
 Returns an iterator referring to the first node's str attribute.
TAStrI EndEAStrI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAStrI GetEAStrI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the node of ID EId in the graph.
TAFltI BegEAFltI (const TStr &attr) const
 Returns an iterator referring to the first node's flt attribute.
TAFltI EndEAFltI (const TStr &attr) const
 Returns an iterator referring to the past-the-end node's attribute.
TAFltI GetEAFltI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the node of ID EId in the graph.
int GetMxNId () const
 Returns the maximum id of a any node in the graph.
int GetEdges () const
 Returns the number of edges in the graph.
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.
int AddEdge (const TEdgeI &EdgeI)
 Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph.
void DelEdge (const int &EId)
 Deletes an edge with edge ID EId from the graph.
void DelEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true)
 Deletes all edges between node IDs SrcNId and DstNId from the graph.
bool IsEdge (const int &EId) const
 Tests whether an edge with edge ID EId exists in the graph.
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.
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.
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.
TEdgeI BegEI () const
 Returns an iterator referring to the first edge in the graph.
TEdgeI EndEI () const
 Returns an iterator referring to the past-the-end edge in the graph.
TEdgeI GetEI (const int &EId) const
TEdgeI GetEI (const int &SrcNId, const int &DstNId) const
int GetRndNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random node in the graph.
TNodeI GetRndNI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random node in the graph.
int GetRndEId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random edge in the graph.
TEdgeI GetRndEI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random edge in the graph.
void GetNIdV (TIntV &NIdV) const
 Gets a vector IDs of all nodes in the graph.
void GetEIdV (TIntV &EIdV) const
 Gets a vector IDs of all edges in the graph.
bool Empty () const
 Tests whether the graph is empty (has zero nodes).
void Clr ()
 Deletes all nodes and edges from the graph.
void Reserve (const int &Nodes, const int &Edges)
 Reserves memory for a graph of Nodes nodes and Edges edges.
void Defrag (const bool &OnlyNodeLinks=false)
 Defragments the graph.
bool IsOk (const bool &ThrowExcept=true) const
 Checks the graph data structure for internal consistency.
void Dump (FILE *OutF=stdout) const
 Print the graph in a human readable form to an output stream OutF.
int AddIntAttrDatN (const TNodeI &NodeId, const TInt &value, const TStr &attr)
 Attribute based add function for attr to Int value.
int AddIntAttrDatN (const int &NId, const TInt &value, const TStr &attr)
int AddStrAttrDatN (const TNodeI &NodeId, const TStr &value, const TStr &attr)
 Attribute based add function for attr to Str value.
int AddStrAttrDatN (const int &NId, const TStr &value, const TStr &attr)
int AddFltAttrDatN (const TNodeI &NodeId, const TFlt &value, const TStr &attr)
 Attribute based add function for attr to Flt value.
int AddFltAttrDatN (const int &NId, const TFlt &value, const TStr &attr)
int AddIntAttrDatE (const TEdgeI &EdgeId, const TInt &value, const TStr &attr)
 Attribute based add function for attr to Int value.
int AddIntAttrDatE (const int &EId, const TInt &value, const TStr &attr)
int AddStrAttrDatE (const TEdgeI &EdgeId, const TStr &value, const TStr &attr)
 Attribute based add function for attr to Str value.
int AddStrAttrDatE (const int &EId, const TStr &value, const TStr &attr)
int AddFltAttrDatE (const TEdgeI &EdgeId, const TFlt &value, const TStr &attr)
 Attribute based add function for attr to Flt value.
int AddFltAttrDatE (const int &EId, const TFlt &value, const TStr &attr)
TInt GetIntAttrDatN (const TNodeI &NodeId, const TStr &attr)
 Gets the value of int attr from the node attr value vector.
TInt GetIntAttrDatN (const int &NId, const TStr &attr)
TStr GetStrAttrDatN (const TNodeI &NodeId, const TStr &attr)
 Gets the value of str attr from the node attr value vector.
TStr GetStrAttrDatN (const int &NId, const TStr &attr)
TFlt GetFltAttrDatN (const TNodeI &NodeId, const TStr &attr)
 Gets the value of flt attr from the node attr value vector.
TFlt GetFltAttrDatN (const int &NId, const TStr &attr)
TInt GetIntAttrDatE (const TEdgeI &EdgeId, const TStr &attr)
 Gets the value of int attr from the edge attr value vector.
TInt GetIntAttrDatE (const int &EId, const TStr &attr)
TStr GetStrAttrDatE (const TEdgeI &EdgeId, const TStr &attr)
 Gets the value of str attr from the edge attr value vector.
TStr GetStrAttrDatE (const int &EId, const TStr &attr)
TFlt GetFltAttrDatE (const TEdgeI &EdgeId, const TStr &attr)
 Gets the value of flt attr from the edge attr value vector.
TFlt GetFltAttrDatE (const int &EId, const TStr &attr)
int DelAttrDatN (const TNodeI &NodeId, const TStr &attr)
 Deletes the node attribute for NodeId.
int DelAttrDatN (const int &NId, const TStr &attr)
int DelAttrDatE (const TEdgeI &EdgeId, const TStr &attr)
 Deletes the edge attribute for NodeId.
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.
int AddStrAttrN (const TStr &attr, TStr defaultValue=TStr::GetNullStr())
 Adds a new Str node attribute to the hashmap.
int AddFltAttrN (const TStr &attr, TFlt defaultValue=TFlt::Mn)
 Adds a new Flt node attribute to the hashmap.
int AddIntAttrE (const TStr &attr, TInt defaultValue=TInt::Mn)
 Adds a new Int edge attribute to the hashmap.
int AddStrAttrE (const TStr &attr, TStr defaultValue=TStr::GetNullStr())
 Adds a new Str edge attribute to the hashmap.
int AddFltAttrE (const TStr &attr, TFlt defaultValue=TFlt::Mn)
 Adds a new Flt edge attribute to the hashmap.
int DelAttrN (const TStr &attr)
 Removes all the values for node attr.
int DelAttrE (const TStr &attr)
 Removes all the values for edge attr.
bool NodeAttrIsDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
bool NodeAttrIsIntDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
bool NodeAttrIsStrDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
bool NodeAttrIsFltDeleted (const int &NId, const TStrIntPrH::TIter &NodeHI) const
bool EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
bool EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
bool EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
bool EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &EdgeHI) const
TStr GetNodeAttrValue (const int &NId, const TStrIntPrH::TIter &NodeHI) const
TStr GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &EdgeHI) const

Static Public Member Functions

static PNEANet New ()
 Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().
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.
static PNEANet Load (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it.
static PNEGraph GetSmallGraph ()
 TODO implement and document TNEANet::GetSmallGraph()

Private Types

enum  { IntType, StrType, FltType }

Private Member Functions

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
 Get Int node attribute val. If not a proper attr, return default.
TStr GetStrAttrDefaultN (const TStr &attribute) const
 Get Str node attribute val. If not a proper attr, return default.
TFlt GetFltAttrDefaultN (const TStr &attribute) const
 Get Flt node attribute val. If not a proper attr, return default.
TInt GetIntAttrDefaultE (const TStr &attribute) const
 Get Int edge attribute val. If not a proper attr, return default.
TStr GetStrAttrDefaultE (const TStr &attribute) const
 Get Str edge attribute val. If not a proper attr, return default.
TFlt GetFltAttrDefaultE (const TStr &attribute) const
 Get Flt edge attribute val. If not a proper attr, return default.

Private Attributes

TCRef CRef
TInt MxNId
TInt MxEId
THash< TInt, TNodeNodeH
THash< TInt, TEdgeEdgeH
TStrIntPrH KeyToIndexTypeN
 KeyToIndexType[N|E]: Key->(Type,Index).
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

Friends

class TPt< TNEANet >

Detailed Description

TODO TNEANet describe time complexity for basic operations.

Definition at line 1575 of file network.h.


Member Typedef Documentation

Definition at line 1578 of file network.h.

Definition at line 1577 of file network.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IntType 
StrType 
FltType 

Definition at line 1828 of file network.h.


Constructor & Destructor Documentation

TNEANet::TNEANet ( ) [inline]

Definition at line 1830 of file network.h.

Referenced by Load(), and New().

Here is the caller graph for this function:

TNEANet::TNEANet ( const int &  Nodes,
const int &  Edges 
) [inline, explicit]

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

Definition at line 1836 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::Reserve().

Here is the call graph for this function:

TNEANet::TNEANet ( TSIn SIn) [inline]

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

Definition at line 1848 of file network.h.


Member Function Documentation

int TNEANet::AddEdge ( const int &  SrcNId,
const int &  DstNId,
int  EId = -1 
)

Adds an edge with ID EId between node IDs SrcNId and DstNId to the graph.

Returns the ID of the edge being added. If EId is -1, edge ID is automatically assigned. Aborts, if an edge with ID EId already exists. Aborts, if SrcNId or DstNId are not nodes in the graph.

Definition at line 375 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::AddSorted(), EdgeH, FltDefaultsE, TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), GetIntAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), THash< TKey, TDat, THashFunc >::GetKeyV(), GetNode(), TStr::GetNullStr(), GetStrAttrDefaultE(), IAssertR, TNEANet::TNode::InEIdV, TVec< TVal, TSizeTy >::Ins(), IntDefaultsE, IsEdge(), IsNode(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, TMath::Mx(), MxEId, NodeH, TNEANet::TNode::OutEIdV, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

                                                                  {
  int i;

  if (EId == -1) { EId = MxEId;  MxEId++; }
  else { MxEId = TMath::Mx(EId+1, MxEId()); }
  IAssertR(!IsEdge(EId), TStr::Fmt("EdgeId %d already exists", EId));
  IAssertR(IsNode(SrcNId) && IsNode(DstNId), TStr::Fmt("%d or %d not a node.", SrcNId, DstNId).CStr());
  EdgeH.AddDat(EId, TEdge(EId, SrcNId, DstNId));
  GetNode(SrcNId).OutEIdV.AddSorted(EId);
  GetNode(DstNId).InEIdV.AddSorted(EId);

  // update attribute columns
  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
    TVec<TInt>& IntVec = VecOfIntVecsE[i];
    IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
  }
  TVec<TStr> DefIntVec = TVec<TStr>();
  IntDefaultsE.GetKeyV(DefIntVec);
  for (i = 0; i < DefIntVec.Len(); i++) {
    TStr attr = DefIntVec[i];
    TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
    IntVec[EdgeH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
  }

  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
    TVec<TStr>& StrVec = VecOfStrVecsE[i];
    StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
  }
  TVec<TStr> DefStrVec = TVec<TStr>();
  IntDefaultsE.GetKeyV(DefStrVec);
  for (i = 0; i < DefStrVec.Len(); i++) {
    TStr attr = DefStrVec[i];
    TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
    StrVec[EdgeH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
  }

  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
    TVec<TFlt>& FltVec = VecOfFltVecsE[i];
    FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
  }
  TVec<TStr> DefFltVec = TVec<TStr>();
  FltDefaultsE.GetKeyV(DefFltVec);
  for (i = 0; i < DefFltVec.Len(); i++) {
    TStr attr = DefFltVec[i];
    TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
    FltVec[NodeH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
  }
  return EId;
}

Here is the call graph for this function:

int TNEANet::AddEdge ( const TEdgeI EdgeI) [inline]

Adds an edge between EdgeI.GetSrcNId() and EdgeI.GetDstNId() to the graph.

Definition at line 2044 of file network.h.

References AddEdge(), TNEANet::TEdgeI::GetDstNId(), TNEANet::TEdgeI::GetId(), and TNEANet::TEdgeI::GetSrcNId().

Referenced by AddEdge().

{ return AddEdge(EdgeI.GetSrcNId(), EdgeI.GetDstNId(), EdgeI.GetId()); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatE ( const TEdgeI EdgeId,
const TFlt value,
const TStr attr 
) [inline]

Attribute based add function for attr to Flt value.

Adds the key flt value pair to the corresponding edge attribute value vector.

Definition at line 2138 of file network.h.

References AddFltAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddFltAttrDatE().

{ return AddFltAttrDatE(EdgeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 730 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

                                                                               {
  int i;
  TInt CurrLen;

  if (!IsEdge(EId)) {
    //AddEdge(EId);
     return -1;
  }
  if (KeyToIndexTypeE.IsKey(attr)) {
    TVec<TFlt>& NewVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
    NewVec[EdgeH.GetKeyId(EId)] = value;
  } else {
    CurrLen = VecOfFltVecsE.Len();
    KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
    TVec<TFlt> NewVec = TVec<TFlt>();
    for (i = 0; i < MxEId; i++) {
      NewVec.Ins(i, GetFltAttrDefaultE(attr));
    }
    NewVec[EdgeH.GetKeyId(EId)] = value;
    VecOfFltVecsE.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddFltAttrDatN ( const TNodeI NodeId,
const TFlt value,
const TStr attr 
) [inline]

Attribute based add function for attr to Flt value.

Adds the key flt value pair to the corresponding node attribute value vector.

Definition at line 2122 of file network.h.

References AddFltAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddFltAttrDatN().

{ return AddFltAttrDatN(NodeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddFltAttrDatN ( const int &  NId,
const TFlt value,
const TStr attr 
)

Definition at line 660 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

                                                                               {
  int i;
  TInt CurrLen;

  if (!IsNode(NId)) {
    // AddNode(NId);
    return -1;
  }
  if (KeyToIndexTypeN.IsKey(attr)) {
    TVec<TFlt>& NewVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2];
    NewVec[NodeH.GetKeyId(NId)] = value;
  } else {
    CurrLen = VecOfFltVecsN.Len();
    KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
    TVec<TFlt> NewVec = TVec<TFlt>();
    for (i = 0; i < MxNId; i++) {
      NewVec.Ins(i, GetFltAttrDefaultN(attr));
    }
    NewVec[NodeH.GetKeyId(NId)] = value;
    VecOfFltVecsN.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 904 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsE, FltType, TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, VecOfFltVecsE, and VecOfStrVecsE.

                                                            {
  int i;
  TInt CurrLen;
  TVec<TFlt> NewVec;
  CurrLen = VecOfStrVecsE.Len();
  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
  NewVec = TVec<TFlt>();
  for (i = 0; i < MxEId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfFltVecsE.Add(NewVec);
  if (!FltDefaultsE.IsKey(attr)) {
    FltDefaultsE.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::AddFltAttrN ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt node attribute to the hashmap.

Definition at line 845 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsN, FltType, TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, VecOfFltVecsN, and VecOfStrVecsN.

                                                            {
  // TODO(nkhadke): add error checking
  int i;
  TInt CurrLen;
  TVec<TFlt> NewVec;
  CurrLen = VecOfStrVecsN.Len();
  KeyToIndexTypeN.AddDat(attr, TIntPr(FltType, CurrLen));
  NewVec = TVec<TFlt>();
  for (i = 0; i < MxNId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfFltVecsN.Add(NewVec);
  if (!FltDefaultsN.IsKey(attr)) {
    FltDefaultsN.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::AddIntAttrDatE ( const TEdgeI EdgeId,
const TInt value,
const TStr attr 
) [inline]

Attribute based add function for attr to Int value.

Adds the key int value pair to the corresponding edge attribute value vector.

Definition at line 2128 of file network.h.

References AddIntAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddIntAttrDatE().

{ return AddIntAttrDatE(EdgeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 684 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), GetIntAttrDefaultE(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IntType, IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

                                                                               {
  int i;
  TInt CurrLen;
  if (!IsEdge(EId)) {
    //AddEdge(EId);
     return -1;
  }
  if (KeyToIndexTypeE.IsKey(attr)) {
    TVec<TInt>& NewVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
    NewVec[EdgeH.GetKeyId(EId)] = value;
  } else {
    CurrLen = VecOfIntVecsE.Len();
    KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
    TVec<TInt> NewVec = TVec<TInt>();
    for (i = 0; i < MxEId; i++) {
      NewVec.Ins(i, GetIntAttrDefaultE(attr));
    }
    NewVec[EdgeH.GetKeyId(EId)] = value;
    VecOfIntVecsE.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddIntAttrDatN ( const TNodeI NodeId,
const TInt value,
const TStr attr 
) [inline]

Attribute based add function for attr to Int value.

Adds the key int value pair to the corresponding node attribute value vector.

Definition at line 2112 of file network.h.

References AddIntAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddIntAttrDatN().

{ return AddIntAttrDatN(NodeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddIntAttrDatN ( const int &  NId,
const TInt value,
const TStr attr 
)

Definition at line 614 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDat(), GetIntAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), TVec< TVal, TSizeTy >::Ins(), IntType, THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

                                                                               {
  int i;
  TInt CurrLen;
  if (!IsNode(NId)) {
    // AddNode(NId);
    return -1;
  }
  if (KeyToIndexTypeN.IsKey(attr)) {
    TVec<TInt>& NewVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2];
    NewVec[NodeH.GetKeyId(NId)] = value;
  } else {
    CurrLen = VecOfIntVecsN.Len();
    KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
    TVec<TInt> NewVec = TVec<TInt>();
    for (i = 0; i < MxNId; i++) {
      NewVec.Ins(i, GetIntAttrDefaultN(attr));
    }
    NewVec[NodeH.GetKeyId(NId)] = value;
    VecOfIntVecsN.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 865 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), IntDefaultsE, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, and VecOfIntVecsE.

                                                           {
  // TODO(nkhadke): add error checking
  int i;
  TInt CurrLen;
  TVec<TInt> NewVec;
  CurrLen = VecOfIntVecsE.Len();
  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
  NewVec = TVec<TInt>();
  for (i = 0; i < MxEId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfIntVecsE.Add(NewVec);
  if (!IntDefaultsE.IsKey(attr)) {
    IntDefaultsE.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::AddIntAttrN ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int node attribute to the hashmap.

Definition at line 807 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), IntDefaultsN, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, and VecOfIntVecsN.

                                                           {
  int i;
  TInt CurrLen;
  TVec<TInt> NewVec;
  CurrLen = VecOfIntVecsN.Len();
  KeyToIndexTypeN.AddDat(attr, TIntPr(IntType, CurrLen));
  NewVec = TVec<TInt>();
  for (i = 0; i < MxNId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfIntVecsN.Add(NewVec);
  if (!IntDefaultsN.IsKey(attr)) {
    IntDefaultsN.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::AddNode ( int  NId = -1)

Adds a node of ID NId to the graph.

Returns the ID of the node being added. If NId is -1, node ID is automatically assigned. Aborts, if a node with ID NId already exists.

Definition at line 269 of file network.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), FltDefaultsN, TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), GetIntAttrDefaultN(), THash< TKey, TDat, THashFunc >::GetKeyId(), THash< TKey, TDat, THashFunc >::GetKeyV(), TStr::GetNullStr(), GetStrAttrDefaultN(), IAssertR, TVec< TVal, TSizeTy >::Ins(), IntDefaultsN, IsNode(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, TMath::Mx(), MxNId, NodeH, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

                            {
  int i;
  if (NId == -1) {
    NId = MxNId;  MxNId++;
  } else {
    IAssertR(!IsNode(NId), TStr::Fmt("NodeId %d already exists", NId));
    MxNId = TMath::Mx(NId+1, MxNId());
  }
  // update attribute columns
  NodeH.AddDat(NId, TNode(NId));
  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
    TVec<TInt>& IntVec = VecOfIntVecsN[i];
    IntVec.Ins(NodeH.GetKeyId(NId), TInt::Mn);
  }
  TVec<TStr> DefIntVec = TVec<TStr>();
  IntDefaultsN.GetKeyV(DefIntVec);
  for (i = 0; i < DefIntVec.Len(); i++) {
    TStr attr = DefIntVec[i];
    TVec<TInt>& IntVec = VecOfIntVecsN[KeyToIndexTypeN.GetDat(DefIntVec[i]).Val2];
    IntVec[NodeH.GetKeyId(NId)] = GetIntAttrDefaultN(attr);
  }
  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
    TVec<TStr>& StrVec = VecOfStrVecsN[i];
    StrVec.Ins(NodeH.GetKeyId(NId), TStr::GetNullStr());
  }
  TVec<TStr> DefStrVec = TVec<TStr>();
  IntDefaultsN.GetKeyV(DefStrVec);
  for (i = 0; i < DefStrVec.Len(); i++) {
    TStr attr = DefStrVec[i];
    TVec<TStr>& StrVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(DefStrVec[i]).Val2];
    StrVec[NodeH.GetKeyId(NId)] = GetStrAttrDefaultN(attr);
  }
  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
    TVec<TFlt>& FltVec = VecOfFltVecsN[i];
    FltVec.Ins(NodeH.GetKeyId(NId), TFlt::Mn);
  }
  TVec<TStr> DefFltVec = TVec<TStr>();
  FltDefaultsN.GetKeyV(DefFltVec);
  for (i = 0; i < DefFltVec.Len(); i++) {
    TStr attr = DefFltVec[i];
    TVec<TFlt>& FltVec = VecOfFltVecsN[KeyToIndexTypeN.GetDat(DefFltVec[i]).Val2];
    FltVec[NodeH.GetKeyId(NId)] = GetFltAttrDefaultN(attr);
  }
  return NId;
}

Here is the call graph for this function:

int TNEANet::AddNode ( const TNodeI NodeId) [inline]

Adds a node of ID NodeI.GetId() to the graph.

Definition at line 1886 of file network.h.

References AddNode(), and TNEANet::TNodeI::GetId().

Referenced by AddNode().

{ return AddNode(NodeId.GetId()); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatE ( const TEdgeI EdgeId,
const TStr value,
const TStr attr 
) [inline]

Attribute based add function for attr to Str value.

Adds the key str value pair to the corresponding edge attribute value vector.

Definition at line 2133 of file network.h.

References AddStrAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by AddStrAttrDatE().

{ return AddStrAttrDatE(EdgeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 707 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), EdgeH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultE(), TVec< TVal, TSizeTy >::Ins(), IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, StrType, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

                                                                               {
  int i;
  TInt CurrLen;
  if (!IsEdge(EId)) {
    //AddEdge(EId);
     return -1;
  }
  if (KeyToIndexTypeE.IsKey(attr)) {
    TVec<TStr>& NewVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2];
    NewVec[EdgeH.GetKeyId(EId)] = value;
  } else {
    CurrLen = VecOfStrVecsE.Len();
    KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
    TVec<TStr> NewVec = TVec<TStr>();
    for (i = 0; i < MxEId; i++) {
      NewVec.Ins(i, GetStrAttrDefaultE(attr));
    }
    NewVec[EdgeH.GetKeyId(EId)] = value;
    VecOfStrVecsE.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddStrAttrDatN ( const TNodeI NodeId,
const TStr value,
const TStr attr 
) [inline]

Attribute based add function for attr to Str value.

Adds the key str value pair to the corresponding node attribute value vector.

Definition at line 2117 of file network.h.

References AddStrAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by AddStrAttrDatN().

{ return AddStrAttrDatN(NodeId.GetId(), value, attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::AddStrAttrDatN ( const int &  NId,
const TStr value,
const TStr attr 
)

Definition at line 637 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetStrAttrDefaultN(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), IsNode(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, NodeH, StrType, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

                                                                               {
  int i;
  TInt CurrLen;
  if (!IsNode(NId)) {
    // AddNode(NId);
    return -1;
  }
  if (KeyToIndexTypeN.IsKey(attr)) {
    TVec<TStr>& NewVec = VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2];
    NewVec[NodeH.GetKeyId(NId)] = value;
  } else {
    CurrLen = VecOfStrVecsN.Len();
    KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
    TVec<TStr> NewVec = TVec<TStr>();
    for (i = 0; i < MxNId; i++) {
        NewVec.Ins(i, GetStrAttrDefaultN(attr));
    }
    NewVec[NodeH.GetKeyId(NId)] = value;
    VecOfStrVecsN.Add(NewVec);
  }
  return 0;
} 

Here is the call graph for this function:

int TNEANet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 885 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, TVec< TVal, TSizeTy >::Len(), MxEId, StrDefaultsE, StrType, and VecOfStrVecsE.

                                                            {
  int i;
  TInt CurrLen;
  TVec<TStr> NewVec;
  CurrLen = VecOfStrVecsE.Len();
  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
  NewVec = TVec<TStr>();
  for (i = 0; i < MxEId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfStrVecsE.Add(NewVec);
  if (!StrDefaultsE.IsKey(attr)) {
    StrDefaultsE.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::AddStrAttrN ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str node attribute to the hashmap.

Definition at line 826 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TVec< TVal, TSizeTy >::Ins(), THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, TVec< TVal, TSizeTy >::Len(), MxNId, StrDefaultsN, StrType, and VecOfStrVecsN.

                                                            {
  int i;
  TInt CurrLen;
  TVec<TStr> NewVec;
  CurrLen = VecOfStrVecsN.Len();
  KeyToIndexTypeN.AddDat(attr, TIntPr(StrType, CurrLen));
  NewVec = TVec<TStr>();
  for (i = 0; i < MxNId; i++) {
    NewVec.Ins(i, defaultValue);
  }
  VecOfStrVecsN.Add(NewVec);
  if (!StrDefaultsN.IsKey(attr)) {
    StrDefaultsN.AddDat(attr, defaultValue);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

void TNEANet::AttrNameEI ( const TInt EId,
TStrV Names 
) const [inline]

Returns a vector of attr names for edge EId.

Definition at line 1964 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

                                                       {
    AttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 147 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsDeleted(), THashKeyDatI< TKey, TDat >::GetKey(), and THashKeyDatI< TKey, TDat >::IsEnd().

                                                                                    {
  Names = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
      Names.Add(EdgeHI.GetKey());
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::AttrNameNI ( const TInt NId,
TStrV Names 
) const [inline]

Returns a vector of attr names for node NId.

Definition at line 1931 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

                                                       {
    AttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::AttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 25 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsDeleted().

                                                                                    {
  Names = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (!NodeAttrIsDeleted(NId, NodeHI)) {
      Names.Add(NodeHI.GetKey());
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::AttrValueEI ( const TInt EId,
TStrV Values 
) const [inline]

Returns a vector of attr avlues for edge EId.

Definition at line 1968 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

                                                         {
    AttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}

Here is the call graph for this function:

void TNEANet::AttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 157 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsDeleted(), GetNodeAttrValue(), and THashKeyDatI< TKey, TDat >::IsEnd().

                                                                                      {
  Values = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (!EdgeAttrIsDeleted(EId, EdgeHI)) {
      Values.Add(GetNodeAttrValue(EId, EdgeHI));
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::AttrValueNI ( const TInt NId,
TStrV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1935 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

                                                         {
    AttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}

Here is the call graph for this function:

void TNEANet::AttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 35 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), GetNodeAttrValue(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsDeleted().

                                                                                       {
  Values = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (!NodeAttrIsDeleted(NId, NodeHI)) {
      Values.Add(GetNodeAttrValue(NId, NodeHI));
    }
    NodeHI++;
  }
}

Here is the call graph for this function:

TAFltI TNEANet::BegEAFltI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's flt attribute.

Definition at line 2020 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

                                           {
    return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
  }

Here is the call graph for this function:

TAIntI TNEANet::BegEAIntI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's int attribute.

Definition at line 1997 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

                                           {
    return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);
  }

Here is the call graph for this function:

TAStrI TNEANet::BegEAStrI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's str attribute.

Definition at line 2009 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

                                           {
    return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, true, this);   }

Here is the call graph for this function:

TEdgeI TNEANet::BegEI ( ) const [inline]

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

Definition at line 2062 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH.

Referenced by Dump().

{ return TEdgeI(EdgeH.BegI(), this); }

Here is the call graph for this function:

Here is the caller graph for this function:

TAFltI TNEANet::BegNAFltI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's flt attribute.

Definition at line 1921 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

                                           {
    return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }

Here is the call graph for this function:

TAIntI TNEANet::BegNAIntI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's int attribute.

Definition at line 1902 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

                                           {
    return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }

Here is the call graph for this function:

TAStrI TNEANet::BegNAStrI ( const TStr attr) const [inline]

Returns an iterator referring to the first node's str attribute.

Definition at line 1911 of file network.h.

References TVec< TVal, TSizeTy >::BegI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

                                           {

    return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].BegI(), attr, false, this); }

Here is the call graph for this function:

TNodeI TNEANet::BegNI ( ) const [inline]

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

Definition at line 1896 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump().

{ return TNodeI(NodeH.BegI(), this); }

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::Defrag ( const bool &  OnlyNodeLinks = false)

Defragments the graph.

After performing many node and edge insertions and deletions to a graph, the graph data structure will be fragmented in memory. This function compacts down the graph data structure and frees unneeded memory.

Definition at line 495 of file network.cpp.

References THash< TKey, TDat, THashFunc >::Defrag(), EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNEANet::TNode::InEIdV, THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN(), NodeH, TNEANet::TNode::OutEIdV, and TVec< TVal, TSizeTy >::Pack().

                                              {
  for (int kid = NodeH.FFirstKeyId(); NodeH.FNextKeyId(kid); ) {
    TNode& Node = NodeH[kid];
    Node.InEIdV.Pack();  Node.OutEIdV.Pack();
  }
  if (! OnlyNodeLinks && ! NodeH.IsKeyIdEqKeyN()) { NodeH.Defrag(); }
  if (! OnlyNodeLinks && ! EdgeH.IsKeyIdEqKeyN()) { EdgeH.Defrag(); }
}

Here is the call graph for this function:

int TNEANet::DelAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
) [inline]

Deletes the edge attribute for NodeId.

Definition at line 2165 of file network.h.

References DelAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by DelAttrDatE().

{ return DelAttrDatE(EdgeId.GetId(), attr); } 

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::DelAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 792 of file network.cpp.

References FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultE(), GetIntAttrDefaultE(), GetStrAttrDefaultE(), IntType, KeyToIndexTypeE, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

                                                         {
  // TODO(nkhadke): add error checking
  TInt vecType = KeyToIndexTypeE(attr).Val1;
  if (vecType == IntType) {
    VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId] = GetIntAttrDefaultE(attr);
  } else if (vecType == StrType) {
    VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId] = GetStrAttrDefaultE(attr);
  } else if (vecType == FltType) {
    VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId] = GetFltAttrDefaultE(attr);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::DelAttrDatN ( const TNodeI NodeId,
const TStr attr 
) [inline]

Deletes the node attribute for NodeId.

Definition at line 2162 of file network.h.

References DelAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by DelAttrDatN().

{ return DelAttrDatN(NodeId.GetId(), attr); } 

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::DelAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 778 of file network.cpp.

References FltType, THash< TKey, TDat, THashFunc >::GetDat(), GetFltAttrDefaultN(), GetIntAttrDefaultN(), GetStrAttrDefaultN(), IntType, KeyToIndexTypeN, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

                                                         {
  TInt vecType = KeyToIndexTypeN(attr).Val1;
  if (vecType == IntType) {
    VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId] = GetIntAttrDefaultN(attr);
  } else if (vecType == StrType) {
    VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId] = GetStrAttrDefaultN(attr);
  } else if (vecType == FltType) {
    VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId] = GetFltAttrDefaultN(attr);
  } else {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

int TNEANet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 947 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), FltDefaultsE, FltType, THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsE, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeE, StrDefaultsE, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

                                      {
  TInt vecType = KeyToIndexTypeE(attr).Val1;
  if (vecType == IntType) {
    VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2] = TVec<TInt>();
    if (IntDefaultsE.IsKey(attr)) {
      IntDefaultsE.DelKey(attr);
    }
  } else if (vecType == StrType) {
    VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2] = TVec<TStr>();
    if (StrDefaultsE.IsKey(attr)) {
      StrDefaultsE.DelKey(attr);
    }  
  } else if (vecType == FltType) {
    VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2] = TVec<TFlt>();
    if (FltDefaultsE.IsKey(attr)) {
      FltDefaultsE.DelKey(attr);
    }
  } else {
    return -1;
  }
  KeyToIndexTypeE.DelKey(attr);
  return 0;
}

Here is the call graph for this function:

int TNEANet::DelAttrN ( const TStr attr)

Removes all the values for node attr.

Definition at line 923 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), FltDefaultsN, FltType, THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsN, IntType, THash< TKey, TDat, THashFunc >::IsKey(), KeyToIndexTypeN, StrDefaultsN, StrType, TPair< TVal1, TVal2 >::Val2, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

                                      {
  TInt vecType = KeyToIndexTypeN(attr).Val1;
  if (vecType == IntType) {
    VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TInt>();
    if (IntDefaultsN.IsKey(attr)) {
      IntDefaultsN.DelKey(attr);
    }
  } else if (vecType == StrType) {
    VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TStr>();  
    if (StrDefaultsN.IsKey(attr)) {
      StrDefaultsN.DelKey(attr);
    }
  } else if (vecType == FltType) {
    VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2] = TVec<TFlt>();
    if (FltDefaultsN.IsKey(attr)) {
      FltDefaultsN.DelKey(attr);
    }
  } else {
    return -1;
  }
  KeyToIndexTypeN.DelKey(attr);
  return 0;
}

Here is the call graph for this function:

void TNEANet::DelEdge ( const int &  EId)

Deletes an edge with edge ID EId from the graph.

Definition at line 425 of file network.cpp.

References TVec< TVal, TSizeTy >::DelIfIn(), THash< TKey, TDat, THashFunc >::DelKey(), EdgeH, TNEANet::TEdge::GetDstNId(), GetEdge(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetNode(), TStr::GetNullStr(), TNEANet::TEdge::GetSrcNId(), IAssert, TNEANet::TNode::InEIdV, TVec< TVal, TSizeTy >::Ins(), IsEdge(), TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, TNEANet::TNode::OutEIdV, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

                                    {
  int i;

  IAssert(IsEdge(EId));
  const int SrcNId = GetEdge(EId).GetSrcNId();
  const int DstNId = GetEdge(EId).GetDstNId();
  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
  GetNode(DstNId).InEIdV.DelIfIn(EId);
  EdgeH.DelKey(EId);

  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
    TVec<TInt>& IntVec = VecOfIntVecsE[i];
    IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
  }
  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
    TVec<TStr>& StrVec = VecOfStrVecsE[i];
    StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
  }
  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
    TVec<TFlt>& FltVec = VecOfFltVecsE[i];
    FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
  }
}

Here is the call graph for this function:

void TNEANet::DelEdge ( const int &  SrcNId,
const int &  DstNId,
const bool &  IsDir = true 
)

Deletes all edges between node IDs SrcNId and DstNId from the graph.

If the edge (SrcNId, DstNId) does not exist in the graph function still completes. But the function aborts if SrcNId or DstNId are not nodes in the graph.

Definition at line 450 of file network.cpp.

References TVec< TVal, TSizeTy >::DelIfIn(), THash< TKey, TDat, THashFunc >::DelKey(), EdgeH, GetNode(), IAssert, TNEANet::TNode::InEIdV, IsEdge(), and TNEANet::TNode::OutEIdV.

                                                                             {
  int EId;
  IAssert(IsEdge(SrcNId, DstNId, EId, IsDir)); // there is at least one edge
  while (IsEdge(SrcNId, DstNId, EId, IsDir)) {
    GetNode(SrcNId).OutEIdV.DelIfIn(EId);
    GetNode(DstNId).InEIdV.DelIfIn(EId);
  }
  EdgeH.DelKey(EId);
}

Here is the call graph for this function:

void TNEANet::DelNode ( const int &  NId)

Deletes node of ID NId from the graph.

If the node of ID NId does not exist the function aborts.

Definition at line 315 of file network.cpp.

References THash< TKey, TDat, THashFunc >::DelKey(), EdgeH, TNEANet::TEdge::GetDstNId(), GetEdge(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), THash< TKey, TDat, THashFunc >::GetKeyId(), GetNode(), TStr::GetNullStr(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), TNEANet::TEdge::GetSrcNId(), IAssert, TVec< TVal, TSizeTy >::Ins(), TVec< TVal, TSizeTy >::Len(), TInt::Mn, TFlt::Mn, NodeH, VecOfFltVecsE, VecOfFltVecsN, VecOfIntVecsE, VecOfIntVecsN, VecOfStrVecsE, and VecOfStrVecsN.

                                    {
  int i;
  
  const TNode& Node = GetNode(NId);
  for (int out = 0; out < Node.GetOutDeg(); out++) {
    const int EId = Node.GetOutEId(out);
    const TEdge& Edge = GetEdge(EId);
    IAssert(Edge.GetSrcNId() == NId);
    GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
    EdgeH.DelKey(EId);
    // Delete from Edge Attributes
    for (i = 0; i < VecOfIntVecsE.Len(); i++) {
      TVec<TInt>& IntVec = VecOfIntVecsE[i];
      IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
    }
    for (i = 0; i < VecOfStrVecsE.Len(); i++) {
      TVec<TStr>& StrVec = VecOfStrVecsE[i];
      StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
    }
    for (i = 0; i < VecOfFltVecsE.Len(); i++) {
      TVec<TFlt>& FltVec = VecOfFltVecsE[i];
      FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
    }
  }
  for (int in = 0; in < Node.GetInDeg(); in++) {
    const int EId = Node.GetInEId(in);
    const TEdge& Edge = GetEdge(EId);
    IAssert(Edge.GetDstNId() == NId);
    GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
    EdgeH.DelKey(EId);
    // Delete from Edge Attributes
    for (i = 0; i < VecOfIntVecsE.Len(); i++) {
      TVec<TInt>& IntVec = VecOfIntVecsE[i];
      IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
    }
    for (i = 0; i < VecOfStrVecsE.Len(); i++) {
      TVec<TStr>& StrVec = VecOfStrVecsE[i];
      StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
    }
    for (i = 0; i < VecOfFltVecsE.Len(); i++) {
      TVec<TFlt>& FltVec = VecOfFltVecsE[i];
      FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
    }
  }

  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
    TVec<TInt>& IntVec = VecOfIntVecsN[i];
    IntVec.Ins(NodeH.GetKeyId(NId), TInt::Mn);
  }
  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
    TVec<TStr>& StrVec = VecOfStrVecsN[i];
    StrVec.Ins(NodeH.GetKeyId(NId), TStr::GetNullStr());
  }
  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
    TVec<TFlt>& FltVec = VecOfFltVecsN[i];
    FltVec.Ins(NodeH.GetKeyId(NId), TFlt::Mn);
  }
  NodeH.DelKey(NId);
}

Here is the call graph for this function:

void TNEANet::DelNode ( const TNode NodeI) [inline]

Deletes node of ID NodeI.GetId() from the graph.

Definition at line 1892 of file network.h.

References DelNode(), and TNEANet::TNode::GetId().

Referenced by DelNode().

{ DelNode(NodeI.GetId()); }

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::Dump ( FILE *  OutF = stdout) const

Print the graph in a human readable form to an output stream OutF.

Definition at line 557 of file network.cpp.

References BegEI(), BegNI(), EndEI(), EndNI(), FltAttrValueEI(), FltAttrValueNI(), GetEdges(), GetNodes(), IntAttrValueEI(), IntAttrValueNI(), TVec< TVal, TSizeTy >::Len(), StrAttrValueEI(), and StrAttrValueNI().

                                   {
  const int NodePlaces = (int) ceil(log10((double) GetNodes()));
  const int EdgePlaces = (int) ceil(log10((double) GetEdges()));
  fprintf(OutF, "-------------------------------------------------\nDirected Node-Edge Network: nodes: %d, edges: %d\n", GetNodes(), GetEdges());
  for (TNodeI NodeI = BegNI(); NodeI < EndNI(); NodeI++) {
    fprintf(OutF, "  %*d]\n", NodePlaces, NodeI.GetId());
    // load node attributes
    TIntV IntAttrN;
    IntAttrValueNI(NodeI.GetId(), IntAttrN);
    fprintf(OutF, "    nai[%d]", IntAttrN.Len());
    for (int i = 0; i < IntAttrN.Len(); i++) {
      fprintf(OutF, " %*i", NodePlaces, IntAttrN[i]()); }
    TStrV StrAttrN;
    StrAttrValueNI(NodeI.GetId(), StrAttrN);
    fprintf(OutF, "    nas[%d]", StrAttrN.Len());
    for (int i = 0; i < StrAttrN.Len(); i++) {
      fprintf(OutF, " %*s", NodePlaces, StrAttrN[i]()); }
    TFltV FltAttrN;
    FltAttrValueNI(NodeI.GetId(), FltAttrN);
    fprintf(OutF, "    naf[%d]", FltAttrN.Len());
    for (int i = 0; i < FltAttrN.Len(); i++) {
      fprintf(OutF, " %*f", NodePlaces, FltAttrN[i]()); }

    fprintf(OutF, "    in[%d]", NodeI.GetInDeg());
    for (int edge = 0; edge < NodeI.GetInDeg(); edge++) {
      fprintf(OutF, " %*d", EdgePlaces, NodeI.GetInEId(edge)); }
    fprintf(OutF, "\n    out[%d]", NodeI.GetOutDeg());
    for (int edge = 0; edge < NodeI.GetOutDeg(); edge++) {
      fprintf(OutF, " %*d", EdgePlaces, NodeI.GetOutEId(edge)); }
   
    fprintf(OutF, "\n");
  }
  for (TEdgeI EdgeI = BegEI(); EdgeI < EndEI(); EdgeI++) {
    fprintf(OutF, "  %*d]  %*d  ->  %*d\n", EdgePlaces, EdgeI.GetId(), NodePlaces, EdgeI.GetSrcNId(), NodePlaces, EdgeI.GetDstNId());

    // load edge attributes
    TIntV IntAttrE;
    IntAttrValueEI(EdgeI.GetId(), IntAttrE);
    fprintf(OutF, "    eai[%d]", IntAttrE.Len());
    for (int i = 0; i < IntAttrE.Len(); i++) {
      fprintf(OutF, " %*i", EdgePlaces, IntAttrE[i]()); }
    TStrV StrAttrE;
    StrAttrValueEI(EdgeI.GetId(), StrAttrE);
    fprintf(OutF, "    eas[%d]", StrAttrE.Len());
    for (int i = 0; i < StrAttrE.Len(); i++) {
      fprintf(OutF, " %*s", EdgePlaces, StrAttrE[i]()); }
    TFltV FltAttrE;
    FltAttrValueEI(EdgeI.GetId(), FltAttrE);
    fprintf(OutF, "    eaf[%d]", FltAttrE.Len());
    for (int i = 0; i < FltAttrE.Len(); i++) {
      fprintf(OutF, " %*f", EdgePlaces, FltAttrE[i]()); }
  }
  fprintf(OutF, "\n");
}

Here is the call graph for this function:

bool TNEANet::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 230 of file network.cpp.

References EdgeAttrIsFltDeleted(), EdgeAttrIsIntDeleted(), and EdgeAttrIsStrDeleted().

Referenced by AttrNameEI(), and AttrValueEI().

                                                                                   {
  bool IntDel = EdgeAttrIsIntDeleted(EId, EdgeHI);
  bool StrDel = EdgeAttrIsStrDeleted(EId, EdgeHI);
  bool FltDel = EdgeAttrIsFltDeleted(EId, EdgeHI);
  return IntDel || StrDel || FltDel;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 249 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), GetFltAttrDefaultE(), THashKeyDatI< TKey, TDat >::GetKey(), TVec< TVal, TSizeTy >::GetVal(), and VecOfFltVecsE.

Referenced by EdgeAttrIsDeleted(), FltAttrNameEI(), and FltAttrValueEI().

                                                                                      {
  return (EdgeHI.GetDat().Val1 == FltType &&
    GetFltAttrDefaultE(EdgeHI.GetKey()) == this->VecOfFltVecsE.GetVal(
    this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 237 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), GetIntAttrDefaultE(), THashKeyDatI< TKey, TDat >::GetKey(), TVec< TVal, TSizeTy >::GetVal(), IntType, and VecOfIntVecsE.

Referenced by EdgeAttrIsDeleted(), IntAttrNameEI(), and IntAttrValueEI().

                                                                                      {
  return (EdgeHI.GetDat().Val1 == IntType &&
    GetIntAttrDefaultE(EdgeHI.GetKey()) == this->VecOfIntVecsE.GetVal(
    this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 243 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), GetStrAttrDefaultE(), TVec< TVal, TSizeTy >::GetVal(), StrType, and VecOfStrVecsE.

Referenced by EdgeAttrIsDeleted(), StrAttrNameEI(), and StrAttrValueEI().

                                                                                      {
  return (EdgeHI.GetDat().Val1 == StrType &&
    GetStrAttrDefaultE(EdgeHI.GetKey()) == this->VecOfStrVecsE.GetVal(
    this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::Empty ( ) const [inline]

Tests whether the graph is empty (has zero nodes).

Definition at line 2084 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetNodes().

{ return GetNodes()==0; }

Here is the call graph for this function:

TAFltI TNEANet::EndEAFltI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2024 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

                                           {
    return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
  }

Here is the call graph for this function:

TAIntI TNEANet::EndEAIntI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2001 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

                                           {
    return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
  }

Here is the call graph for this function:

TAStrI TNEANet::EndEAStrI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 2012 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

                                           {
    return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, true, this);
  }

Here is the call graph for this function:

TEdgeI TNEANet::EndEI ( ) const [inline]

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

Definition at line 2064 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::EndI().

Referenced by Dump().

{ return TEdgeI(EdgeH.EndI(), this); }

Here is the call graph for this function:

Here is the caller graph for this function:

TAFltI TNEANet::EndNAFltI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 1924 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

                                           {
    return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }

Here is the call graph for this function:

TAIntI TNEANet::EndNAIntI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 1905 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

                                           {
    return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }

Here is the call graph for this function:

TAStrI TNEANet::EndNAStrI ( const TStr attr) const [inline]

Returns an iterator referring to the past-the-end node's attribute.

Definition at line 1915 of file network.h.

References TVec< TVal, TSizeTy >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

                                           {
    return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].EndI(), attr, false, this); }

Here is the call graph for this function:

TNodeI TNEANet::EndNI ( ) const [inline]

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

Definition at line 1898 of file network.h.

References THash< TKey, TDat, THashFunc >::EndI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump().

{ return TNodeI(NodeH.EndI(), this); }

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrNameEI ( const TInt EId,
TStrV Names 
) const [inline]

Returns a vector of int attr names for node NId.

Definition at line 1988 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

                                                          {
    FltAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::FltAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 209 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsFltDeleted(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), and THashKeyDatI< TKey, TDat >::IsEnd().

                                                                                       {
  Names = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
      Names.Add(EdgeHI.GetKey());
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::FltAttrNameNI ( const TInt NId,
TStrV Names 
) const [inline]

Returns a vector of int attr names for node NId.

Definition at line 1955 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

                                                          {
    FltAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::FltAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 87 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsFltDeleted().

                                                                                       {
  Names = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
      Names.Add(NodeHI.GetKey());
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1992 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), FltAttrValueNI(), and KeyToIndexTypeE.

Referenced by Dump().

                                                            {
    FltAttrValueNI(EId, KeyToIndexTypeE.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TFltV Values 
) const

Definition at line 219 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsFltDeleted(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), THashKeyDatI< TKey, TDat >::IsEnd(), and VecOfFltVecsE.

                                                                                         {
  Values = TVec<TFlt>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
      TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
      Values.Add(val);
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::FltAttrValueNI ( const TInt NId,
TFltV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1959 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump(), and FltAttrValueEI().

                                                            {
    FltAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::FltAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TFltV Values 
) const

Definition at line 97 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), FltType, THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsFltDeleted(), and VecOfFltVecsN.

                                                                                         {
  Values = TVec<TFlt>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
      TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NId));
      Values.Add(val);
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

TAFltI TNEANet::GetEAFltI ( const TStr attr,
const int &  EId 
) const [inline]

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

Definition at line 2028 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

                                                           {
    return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EId), attr, true, this);
  }

Here is the call graph for this function:

TAIntI TNEANet::GetEAIntI ( const TStr attr,
const int &  EId 
) const [inline]

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

Definition at line 2005 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

                                                           {
    return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EId), attr, true, this);
  }

Here is the call graph for this function:

TAStrI TNEANet::GetEAStrI ( const TStr attr,
const int &  EId 
) const [inline]

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

Definition at line 2016 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

                                                           {
    return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(EId), attr, true, this);
  }

Here is the call graph for this function:

TEdge& TNEANet::GetEdge ( const int &  EId) [inline, private]

Definition at line 1798 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetDat().

Referenced by DelEdge(), DelNode(), IsEdge(), and TNEANet::TNodeI::IsInNId().

{ return EdgeH.GetDat(EId); }

Here is the call graph for this function:

Here is the caller graph for this function:

const TEdge& TNEANet::GetEdge ( const int &  EId) const [inline, private]

Definition at line 1799 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetDat().

{ return EdgeH.GetDat(EId); }

Here is the call graph for this function:

TStr TNEANet::GetEdgeAttrValue ( const int &  EId,
const TStrIntPrH::TIter EdgeHI 
) const

Definition at line 255 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), TStr::GetNullStr(), TVec< TVal, TSizeTy >::GetVal(), IntType, KeyToIndexTypeE, StrType, VecOfFltVecsE, VecOfIntVecsE, and VecOfStrVecsE.

                                                                                  {
  if (EdgeHI.GetDat().Val1 == IntType) {
    return (this->VecOfIntVecsE.GetVal(
      this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId)).GetStr();
  } else if(EdgeHI.GetDat().Val1 == StrType) {
    return this->VecOfStrVecsE.GetVal(
    this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId);
  } else if (EdgeHI.GetDat().Val1 == FltType) {
    return (this->VecOfFltVecsE.GetVal(
      this->KeyToIndexTypeE.GetDat(EdgeHI.GetKey()).Val2).GetVal(EId)).GetStr();
  }
  return TStr::GetNullStr();
}

Here is the call graph for this function:

int TNEANet::GetEdges ( ) const [inline]

Returns the number of edges in the graph.

Definition at line 2035 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::Len().

Referenced by Dump(), and GetEIdV().

{ return EdgeH.Len(); }

Here is the call graph for this function:

Here is the caller graph for this function:

TEdgeI TNEANet::GetEI ( const int &  EId) const [inline]

Definition at line 2066 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::GetI().

{ return TEdgeI(EdgeH.GetI(EId), this); }

Here is the call graph for this function:

TEdgeI TNEANet::GetEI ( const int &  SrcNId,
const int &  DstNId 
) const [inline]

Definition at line 2068 of file network.h.

References GetEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetEId().

Referenced by GetEI().

{ return GetEI(GetEId(SrcNId, DstNId)); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::GetEId ( const int &  SrcNId,
const int &  DstNId 
) const [inline]

Returns an edge ID between node IDs SrcNId and DstNId, if such an edge exists. Otherwise, return -1.

Definition at line 2060 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::IsEdge().

{ int EId; return IsEdge(SrcNId, DstNId, EId)?EId:-1; }

Here is the call graph for this function:

void TNEANet::GetEIdV ( TIntV EIdV) const

Gets a vector IDs of all edges in the graph.

Definition at line 488 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeH, THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), GetEdges(), and THash< TKey, TDat, THashFunc >::GetKey().

                                       {
  EIdV.Gen(GetEdges(), 0);
  for (int E=EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
    EIdV.Add(EdgeH.GetKey(E));
  }
}

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
) [inline]

Gets the value of flt attr from the edge attr value vector.

Definition at line 2158 of file network.h.

References GetFltAttrDatE(), and TNEANet::TEdgeI::GetId().

Referenced by GetFltAttrDatE().

{ return GetFltAttrDatE(EdgeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 774 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsE.

                                                             {
  return VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId];
}

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDatN ( const TNodeI NodeId,
const TStr attr 
) [inline]

Gets the value of flt attr from the node attr value vector.

Definition at line 2148 of file network.h.

References GetFltAttrDatN(), and TNEANet::TNodeI::GetId().

Referenced by GetFltAttrDatN().

{ return GetFltAttrDatN(NodeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 762 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

                                                             {
  return VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId];
}

Here is the call graph for this function:

TFlt TNEANet::GetFltAttrDefaultE ( const TStr attribute) const [inline, private]

Get Flt edge attribute val. If not a proper attr, return default.

Definition at line 1812 of file network.h.

References FltDefaultsE, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and TFlt::Mn.

Referenced by AddEdge(), AddFltAttrDatE(), DelAttrDatE(), and EdgeAttrIsFltDeleted().

{ return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }

Here is the call graph for this function:

Here is the caller graph for this function:

TFlt TNEANet::GetFltAttrDefaultN ( const TStr attribute) const [inline, private]

Get Flt node attribute val. If not a proper attr, return default.

Definition at line 1806 of file network.h.

References FltDefaultsN, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and TFlt::Mn.

Referenced by AddFltAttrDatN(), AddNode(), DelAttrDatN(), and NodeAttrIsFltDeleted().

{ return FltDefaultsN.IsKey(attribute) ? FltDefaultsN.GetDat(attribute) : (TFlt) TFlt::Mn; }

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
) [inline]

Gets the value of int attr from the edge attr value vector.

Definition at line 2152 of file network.h.

References TNEANet::TEdgeI::GetId(), and GetIntAttrDatE().

Referenced by GetIntAttrDatE().

{ return GetIntAttrDatE(EdgeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 766 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsE.

                                                             {
  return VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId];
}

Here is the call graph for this function:

TInt TNEANet::GetIntAttrDatN ( const TNodeI NodeId,
const TStr attr 
) [inline]

Gets the value of int attr from the node attr value vector.

Definition at line 2142 of file network.h.

References TNEANet::TNodeI::GetId(), and GetIntAttrDatN().

Referenced by GetIntAttrDatN().

{ return GetIntAttrDatN(NodeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 754 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

                                                             {
  return VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId];
}

Here is the call graph for this function:

TInt TNEANet::GetIntAttrDefaultE ( const TStr attribute) const [inline, private]

Get Int edge attribute val. If not a proper attr, return default.

Definition at line 1808 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsE, THash< TKey, TDat, THashFunc >::IsKey(), and TInt::Mn.

Referenced by AddEdge(), AddIntAttrDatE(), DelAttrDatE(), and EdgeAttrIsIntDeleted().

{ return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }

Here is the call graph for this function:

Here is the caller graph for this function:

TInt TNEANet::GetIntAttrDefaultN ( const TStr attribute) const [inline, private]

Get Int node attribute val. If not a proper attr, return default.

Definition at line 1802 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), IntDefaultsN, THash< TKey, TDat, THashFunc >::IsKey(), and TInt::Mn.

Referenced by AddIntAttrDatN(), AddNode(), DelAttrDatN(), and NodeAttrIsIntDeleted().

{ return IntDefaultsN.IsKey(attribute) ? IntDefaultsN.GetDat(attribute) : (TInt) TInt::Mn; }

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::GetMxNId ( ) const [inline]

Returns the maximum id of a any node in the graph.

Definition at line 2032 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::MxNId.

{ return MxNId; }
TAFltI TNEANet::GetNAFltI ( const TStr attr,
const int &  NId 
) const [inline]

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

Definition at line 1927 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfFltVecsN.

                                                           {
    return TAFltI(VecOfFltVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NId), attr, false, this); }

Here is the call graph for this function:

TAIntI TNEANet::GetNAIntI ( const TStr attr,
const int &  NId 
) const [inline]

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

Definition at line 1908 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfIntVecsN.

                                                           {
    return TAIntI(VecOfIntVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NId), attr, false, this); }

Here is the call graph for this function:

TAStrI TNEANet::GetNAStrI ( const TStr attr,
const int &  NId 
) const [inline]

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

Definition at line 1918 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetI(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

                                                           {
    return TAStrI(VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2].GetI(NId), attr, false, this); }

Here is the call graph for this function:

TNodeI TNEANet::GetNI ( const int &  NId) const [inline]

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

Definition at line 1900 of file network.h.

References THash< TKey, TDat, THashFunc >::GetI(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

{ return TNodeI(NodeH.GetI(NId), this); }

Here is the call graph for this function:

void TNEANet::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the graph.

Definition at line 481 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TVec< TVal, TSizeTy >::Gen(), THash< TKey, TDat, THashFunc >::GetKey(), GetNodes(), and NodeH.

                                       {
  NIdV.Gen(GetNodes(), 0);
  for (int N=NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
    NIdV.Add(NodeH.GetKey(N));
  }
}

Here is the call graph for this function:

TNode& TNEANet::GetNode ( const int &  NId) [inline, private]

Definition at line 1796 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by AddEdge(), DelEdge(), DelNode(), and IsEdge().

{ return NodeH.GetDat(NId); }

Here is the call graph for this function:

Here is the caller graph for this function:

const TNode& TNEANet::GetNode ( const int &  NId) const [inline, private]

Definition at line 1797 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

{ return NodeH.GetDat(NId); }

Here is the call graph for this function:

TStr TNEANet::GetNodeAttrValue ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 133 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), TStr::GetNullStr(), TVec< TVal, TSizeTy >::GetVal(), IntType, KeyToIndexTypeN, StrType, VecOfFltVecsN, VecOfIntVecsN, and VecOfStrVecsN.

Referenced by AttrValueEI(), and AttrValueNI().

                                                                                  {
  if (NodeHI.GetDat().Val1 == IntType) {
    return (this->VecOfIntVecsN.GetVal(
      this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId)).GetStr();
  } else if(NodeHI.GetDat().Val1 == StrType) {
    return this->VecOfStrVecsN.GetVal(
    this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId);
  } else if (NodeHI.GetDat().Val1 == FltType) {
    return (this->VecOfFltVecsN.GetVal(
      this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId)).GetStr();
  }
  return TStr::GetNullStr();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TNEANet::GetNodes ( ) const [inline]

Returns the number of nodes in the graph.

Definition at line 1878 of file network.h.

References THash< TKey, TDat, THashFunc >::Len(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by Dump(), and GetNIdV().

{ return NodeH.Len(); }

Here is the call graph for this function:

Here is the caller graph for this function:

TEdgeI TNEANet::GetRndEI ( TRnd Rnd = TInt::Rnd) [inline]

Returns an interator referring to a random edge in the graph.

Definition at line 2077 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetEI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetRndEId().

{ return GetEI(GetRndEId(Rnd)); }

Here is the call graph for this function:

int TNEANet::GetRndEId ( TRnd Rnd = TInt::Rnd) [inline]

Returns an ID of a random edge in the graph.

Definition at line 2075 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::GetKey(), and THash< TKey, TDat, THashFunc >::GetRndKeyId().

{ return EdgeH.GetKey(EdgeH.GetRndKeyId(Rnd, 0.8)); }

Here is the call graph for this function:

TNodeI TNEANet::GetRndNI ( TRnd Rnd = TInt::Rnd) [inline]

Returns an interator referring to a random node in the graph.

Definition at line 2073 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::GetNI(), and TNodeEdgeNet< TNodeData, TEdgeData >::GetRndNId().

{ return GetNI(GetRndNId(Rnd)); }

Here is the call graph for this function:

int TNEANet::GetRndNId ( TRnd Rnd = TInt::Rnd) [inline]

Returns an ID of a random node in the graph.

Definition at line 2071 of file network.h.

References THash< TKey, TDat, THashFunc >::GetKey(), THash< TKey, TDat, THashFunc >::GetRndKeyId(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

{ return NodeH.GetKey(NodeH.GetRndKeyId(Rnd, 0.8)); }

Here is the call graph for this function:

static PNEGraph TNEANet::GetSmallGraph ( ) [static]

TODO implement and document TNEANet::GetSmallGraph()

TStr TNEANet::GetStrAttrDatE ( const TEdgeI EdgeId,
const TStr attr 
) [inline]

Gets the value of str attr from the edge attr value vector.

Definition at line 2155 of file network.h.

References TNEANet::TEdgeI::GetId(), and GetStrAttrDatE().

Referenced by GetStrAttrDatE().

{ return GetStrAttrDatE(EdgeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 770 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeE, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsE.

                                                             {
  return VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2][EId];
}

Here is the call graph for this function:

TStr TNEANet::GetStrAttrDatN ( const TNodeI NodeId,
const TStr attr 
) [inline]

Gets the value of str attr from the node attr value vector.

Definition at line 2145 of file network.h.

References TNEANet::TNodeI::GetId(), and GetStrAttrDatN().

Referenced by GetStrAttrDatN().

{ return GetStrAttrDatN(NodeId.GetId(), attr); }

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDatN ( const int &  NId,
const TStr attr 
)

Definition at line 758 of file network.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), KeyToIndexTypeN, TPair< TVal1, TVal2 >::Val2, and VecOfStrVecsN.

                                                             {
  return VecOfStrVecsN[KeyToIndexTypeN.GetDat(attr).Val2][NId];
}

Here is the call graph for this function:

TStr TNEANet::GetStrAttrDefaultE ( const TStr attribute) const [inline, private]

Get Str edge attribute val. If not a proper attr, return default.

Definition at line 1810 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), THash< TKey, TDat, THashFunc >::IsKey(), and StrDefaultsE.

Referenced by AddEdge(), AddStrAttrDatE(), DelAttrDatE(), and EdgeAttrIsStrDeleted().

{ return StrDefaultsE.IsKey(attribute) ? StrDefaultsE.GetDat(attribute) : (TStr) TStr::GetNullStr(); }

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TNEANet::GetStrAttrDefaultN ( const TStr attribute) const [inline, private]

Get Str node attribute val. If not a proper attr, return default.

Definition at line 1804 of file network.h.

References THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), THash< TKey, TDat, THashFunc >::IsKey(), and StrDefaultsN.

Referenced by AddNode(), AddStrAttrDatN(), DelAttrDatN(), and NodeAttrIsStrDeleted().

{ return StrDefaultsN.IsKey(attribute) ? StrDefaultsN.GetDat(attribute) : (TStr) TStr::GetNullStr(); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::HasFlag ( const TGraphFlag Flag) const

Allows for run-time checking the type of the graph (see the TGraphFlag for flags).

Definition at line 3 of file network.cpp.

References HasGraphFlag.

                                                  {
  return HasGraphFlag(TNEANet::TNet, Flag);
}
void TNEANet::IntAttrNameEI ( const TInt EId,
TStrV Names 
) const [inline]

Returns a vector of int attr names for edge EId.

Definition at line 1972 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

                                                          {
    IntAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::IntAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 167 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsIntDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), IntType, and THashKeyDatI< TKey, TDat >::IsEnd().

                                                                                       {
  Names = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
      Names.Add(EdgeHI.GetKey());
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::IntAttrNameNI ( const TInt NId,
TStrV Names 
) const [inline]

Returns a vector of int attr names for node NId.

Definition at line 1939 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

                                                          {
    IntAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::IntAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 45 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), and NodeAttrIsIntDeleted().

                                                                                       {
  Names = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
      Names.Add(NodeHI.GetKey());
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const [inline]

Returns a vector of attr values for edge EId.

Definition at line 1976 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

Referenced by Dump().

                                                            {
    IntAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::IntAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TIntV Values 
) const

Definition at line 177 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsIntDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), and VecOfIntVecsE.

                                                                                         {
  Values = TVec<TInt>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, EdgeHI)) {
      TInt val = (this->VecOfIntVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
      Values.Add(val);
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::IntAttrValueNI ( const TInt NId,
TIntV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1943 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump().

                                                            {
    IntAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::IntAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TIntV Values 
) const

Definition at line 55 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), IntType, THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsIntDeleted(), and VecOfIntVecsN.

                                                                                         {
  Values = TVec<TInt>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == IntType && !NodeAttrIsIntDeleted(NId, NodeHI)) {
      TInt val = this->VecOfIntVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NId);
      Values.Add(val);
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

bool TNEANet::IsEdge ( const int &  EId) const [inline]

Tests whether an edge with edge ID EId exists in the graph.

Definition at line 2054 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, and THash< TKey, TDat, THashFunc >::IsKey().

Referenced by AddEdge(), AddFltAttrDatE(), AddIntAttrDatE(), AddStrAttrDatE(), DelEdge(), and IsOk().

{ return EdgeH.IsKey(EId); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::IsEdge ( const int &  SrcNId,
const int &  DstNId,
const bool &  IsDir = true 
) const [inline]

Tests whether an edge between node IDs SrcNId and DstNId exists in the graph.

Definition at line 2056 of file network.h.

References IsEdge().

Referenced by IsEdge().

{ int EId; return IsEdge(SrcNId, DstNId, EId, IsDir); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::IsEdge ( const int &  SrcNId,
const int &  DstNId,
int &  EId,
const bool &  IsDir = true 
) const

Tests whether an edge between node IDs SrcNId and DstNId exists in the graph. if an edge exists, return its edge ID in EId.

Definition at line 460 of file network.cpp.

References TNEANet::TEdge::GetDstNId(), GetEdge(), TNEANet::TEdge::GetId(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), GetNode(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), and TNEANet::TEdge::GetSrcNId().

                                                                                            {
  const TNode& SrcNode = GetNode(SrcNId);
  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
    const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
    if (DstNId == Edge.GetDstNId()) {
      EId = Edge.GetId();
      return true;
    }
  }
  if (! IsDir) {
    for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
      const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
      if (DstNId == Edge.GetSrcNId()) {
        EId = Edge.GetId();
        return true;
      }
    }
  }
  return false;
}

Here is the call graph for this function:

bool TNEANet::IsNode ( const int &  NId) const [inline]

Tests whether ID NId is a node.

Definition at line 1894 of file network.h.

References THash< TKey, TDat, THashFunc >::IsKey(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

Referenced by AddEdge(), AddFltAttrDatN(), AddIntAttrDatN(), AddNode(), AddStrAttrDatN(), and IsOk().

{ return NodeH.IsKey(NId); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::IsOk ( const bool &  ThrowExcept = true) const

Checks the graph data structure for internal consistency.

For each node in the graph check that its neighbors are also nodes in the graph.

Definition at line 504 of file network.cpp.

References TStr::CStr(), EAssertR, EdgeH, ErrNotify(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::FNextKeyId(), TNEANet::TEdge::GetDstNId(), TNEANet::TNode::GetId(), TNEANet::TEdge::GetId(), TNEANet::TNode::GetInDeg(), TNEANet::TNode::GetInEId(), TNEANet::TNode::GetOutDeg(), TNEANet::TNode::GetOutEId(), TNEANet::TEdge::GetSrcNId(), TNEANet::TNode::InEIdV, IsEdge(), IsNode(), TVec< TVal, TSizeTy >::IsSorted(), NodeH, and TNEANet::TNode::OutEIdV.

                                                {
  bool RetVal = true;
  for (int N = NodeH.FFirstKeyId(); NodeH.FNextKeyId(N); ) {
    const TNode& Node = NodeH[N];
    if (! Node.OutEIdV.IsSorted()) {
      const TStr Msg = TStr::Fmt("Out-edge list of node %d is not sorted.", Node.GetId());
      if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
    }
    if (! Node.InEIdV.IsSorted()) {
      const TStr Msg = TStr::Fmt("In-edge list of node %d is not sorted.", Node.GetId());
      if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
    }
    // check out-edge ids
    int prevEId = -1;
    for (int e = 0; e < Node.GetOutDeg(); e++) {
      if (! IsEdge(Node.GetOutEId(e))) {
        const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.",  Node.GetOutEId(e), Node.GetId());
        if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
      }
      if (e > 0 && prevEId == Node.GetOutEId(e)) {
        const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetOutEId(e));
        if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
      }
      prevEId = Node.GetOutEId(e);
    }
    // check in-edge ids
    prevEId = -1;
    for (int e = 0; e < Node.GetInDeg(); e++) {
      if (! IsEdge(Node.GetInEId(e))) {
      const TStr Msg = TStr::Fmt("Out-edge id %d of node %d does not exist.",  Node.GetInEId(e), Node.GetId());
      if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
      }
      if (e > 0 && prevEId == Node.GetInEId(e)) {
        const TStr Msg = TStr::Fmt("Node %d has duplidate out-edge id %d.", Node.GetId(), Node.GetInEId(e));
        if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
      }
      prevEId = Node.GetInEId(e);
    }
  }
  for (int E = EdgeH.FFirstKeyId(); EdgeH.FNextKeyId(E); ) {
    const TEdge& Edge = EdgeH[E];
    if (! IsNode(Edge.GetSrcNId())) {
      const TStr Msg = TStr::Fmt("Edge %d source node %d does not exist.", Edge.GetId(), Edge.GetSrcNId());
      if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
    }
    if (! IsNode(Edge.GetDstNId())) {
      const TStr Msg = TStr::Fmt("Edge %d destination node %d does not exist.", Edge.GetId(), Edge.GetDstNId());
      if (ThrowExcept) { EAssertR(false, Msg); } else { ErrNotify(Msg.CStr()); } RetVal=false;
    }
  }
  return RetVal;
}

Here is the call graph for this function:

static PNEANet TNEANet::Load ( TSIn SIn) [inline, static]

Static constructor that loads the graph from a stream SIn and returns a pointer to it.

Definition at line 1870 of file network.h.

References TNEANet().

{ return PNEANet(new TNEANet(SIn)); }

Here is the call graph for this function:

static PNEANet TNEANet::New ( ) [inline, static]

Static cons returns pointer to graph. Ex: PNEANet Graph=TNEANet::New().

Definition at line 1864 of file network.h.

References TNEANet().

{ return PNEANet(new TNEANet()); }

Here is the call graph for this function:

static PNEANet TNEANet::New ( const int &  Nodes,
const int &  Edges 
) [inline, static]

Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges.

Call: PNEANet Graph = TNEANet::New(Nodes, Edges).

Definition at line 1868 of file network.h.

References TNEANet().

{ return PNEANet(new TNEANet(Nodes, Edges)); }

Here is the call graph for this function:

bool TNEANet::NodeAttrIsDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 108 of file network.cpp.

References NodeAttrIsFltDeleted(), NodeAttrIsIntDeleted(), and NodeAttrIsStrDeleted().

Referenced by AttrNameNI(), and AttrValueNI().

                                                                                   {
  bool IntDel = NodeAttrIsIntDeleted(NId, NodeHI);
  bool StrDel = NodeAttrIsStrDeleted(NId, NodeHI);
  bool FltDel = NodeAttrIsFltDeleted(NId, NodeHI);
  return IntDel || StrDel || FltDel;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsFltDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 127 of file network.cpp.

References FltType, THashKeyDatI< TKey, TDat >::GetDat(), GetFltAttrDefaultN(), THashKeyDatI< TKey, TDat >::GetKey(), TVec< TVal, TSizeTy >::GetVal(), and VecOfFltVecsN.

Referenced by FltAttrNameNI(), FltAttrValueNI(), and NodeAttrIsDeleted().

                                                                                      {
  return (NodeHI.GetDat().Val1 == FltType &&
    GetFltAttrDefaultN(NodeHI.GetKey()) == this->VecOfFltVecsN.GetVal(
    this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsIntDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 115 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), GetIntAttrDefaultN(), THashKeyDatI< TKey, TDat >::GetKey(), TVec< TVal, TSizeTy >::GetVal(), IntType, and VecOfIntVecsN.

Referenced by IntAttrNameNI(), IntAttrValueNI(), and NodeAttrIsDeleted().

                                                                                      {
  return (NodeHI.GetDat().Val1 == IntType &&
    GetIntAttrDefaultN(NodeHI.GetKey()) == this->VecOfIntVecsN.GetVal(
    this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEANet::NodeAttrIsStrDeleted ( const int &  NId,
const TStrIntPrH::TIter NodeHI 
) const

Definition at line 121 of file network.cpp.

References THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), GetStrAttrDefaultN(), TVec< TVal, TSizeTy >::GetVal(), StrType, and VecOfStrVecsN.

Referenced by NodeAttrIsDeleted(), StrAttrNameNI(), and StrAttrValueNI().

                                                                                      {
  return (NodeHI.GetDat().Val1 == StrType &&
    GetStrAttrDefaultN(NodeHI.GetKey()) == this->VecOfStrVecsN.GetVal(
    this->KeyToIndexTypeN.GetDat(NodeHI.GetKey()).Val2).GetVal(NId));
}

Here is the call graph for this function:

Here is the caller graph for this function:

TNEANet& TNEANet::operator= ( const TNEANet Graph) [inline]
void TNEANet::Reserve ( const int &  Nodes,
const int &  Edges 
) [inline]

Reserves memory for a graph of Nodes nodes and Edges edges.

Definition at line 2092 of file network.h.

References TNodeEdgeNet< TNodeData, TEdgeData >::EdgeH, THash< TKey, TDat, THashFunc >::Gen(), and TNodeEdgeNet< TNodeData, TEdgeData >::NodeH.

                                                   {
    if (Nodes>0) { NodeH.Gen(Nodes/2); } if (Edges>0) { EdgeH.Gen(Edges/2); } }

Here is the call graph for this function:

void TNEANet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const [inline]

Returns a vector of str attr names for node NId.

Definition at line 1980 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

                                                          {
    StrAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::StrAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Names 
) const

Definition at line 188 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsStrDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), and StrType.

                                                                                       {
  Names = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
      Names.Add(EdgeHI.GetKey());
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::StrAttrNameNI ( const TInt NId,
TStrV Names 
) const [inline]

Returns a vector of str attr names for node NId.

Definition at line 1947 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

                                                          {
    StrAttrNameNI(NId, KeyToIndexTypeN.BegI(), Names);}

Here is the call graph for this function:

void TNEANet::StrAttrNameNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Names 
) const

Definition at line 66 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), THashKeyDatI< TKey, TDat >::GetKey(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsStrDeleted(), and StrType.

                                                                                       {
  Names = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
      Names.Add(NodeHI.GetKey());
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1984 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeE.

Referenced by Dump().

                                                            {
    StrAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::StrAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  EdgeHI,
TStrV Values 
) const

Definition at line 198 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), EdgeAttrIsStrDeleted(), THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), THashKeyDatI< TKey, TDat >::IsEnd(), StrType, and VecOfStrVecsE.

                                                                                         {
  Values = TVec<TStr>();
  while (!EdgeHI.IsEnd()) {
    if (EdgeHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, EdgeHI)) {
      TStr val = this->VecOfStrVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId);
      Values.Add(val);
    }
    EdgeHI++;
  }  
}

Here is the call graph for this function:

void TNEANet::StrAttrValueNI ( const TInt NId,
TStrV Values 
) const [inline]

Returns a vector of attr avlues for node NId.

Definition at line 1951 of file network.h.

References THash< TKey, TDat, THashFunc >::BegI(), and KeyToIndexTypeN.

Referenced by Dump().

                                                            {
    StrAttrValueNI(NId, KeyToIndexTypeN.BegI(), Values);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TNEANet::StrAttrValueNI ( const TInt NId,
TStrIntPrH::TIter  NodeHI,
TStrV Values 
) const

Definition at line 76 of file network.cpp.

References TVec< TVal, TSizeTy >::Add(), THashKeyDatI< TKey, TDat >::GetDat(), TVec< TVal, TSizeTy >::GetVal(), THashKeyDatI< TKey, TDat >::IsEnd(), NodeAttrIsStrDeleted(), StrType, and VecOfStrVecsN.

                                                                                         {
  Values = TVec<TStr>();
  while (!NodeHI.IsEnd()) {
    if (NodeHI.GetDat().Val1 == StrType && !NodeAttrIsStrDeleted(NId, NodeHI)) {
      TStr val = this->VecOfStrVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NId);
      Values.Add(val);
    }
    NodeHI++;
  }  
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class TPt< TNEANet > [friend]

Definition at line 2212 of file network.h.


Member Data Documentation

TCRef TNEANet::CRef [private]

Definition at line 1815 of file network.h.

Definition at line 1824 of file network.h.

Referenced by AddEdge(), AddFltAttrE(), Clr(), DelAttrE(), GetFltAttrDefaultE(), and Save().

Definition at line 1824 of file network.h.

Referenced by AddFltAttrN(), AddNode(), Clr(), DelAttrN(), GetFltAttrDefaultN(), and Save().

Definition at line 1822 of file network.h.

Referenced by AddEdge(), AddIntAttrE(), Clr(), DelAttrE(), GetIntAttrDefaultE(), and Save().

Definition at line 1822 of file network.h.

Referenced by AddIntAttrN(), AddNode(), Clr(), DelAttrN(), GetIntAttrDefaultN(), and Save().

Definition at line 1823 of file network.h.

Referenced by AddStrAttrE(), Clr(), DelAttrE(), GetStrAttrDefaultE(), and Save().

Definition at line 1823 of file network.h.

Referenced by AddStrAttrN(), Clr(), DelAttrN(), GetStrAttrDefaultN(), and Save().


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