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

Implements a single CrossNet consisting of edges between two TModeNets (could be the same TModeNet) More...

#include <mmnet.h>

Classes

class  TAFltI
 Node/edge float attribute iterator. Iterates through all nodes/edges for one float attribute. More...
 
class  TAIntI
 Node/edge integer attribute iterator. Iterates through all nodes/edges for one integer attribute. More...
 
class  TAStrI
 Node/edge string attribute iterator. Iterates through all nodes/edges for one string attribute. More...
 
class  TCrossEdge
 A single edge in the cross net. Has an Edge Id, and the source and destination node ids. (Mode ids are implicit from TCrossNet) More...
 
class  TCrossEdgeI
 Edge iterator. Only forward iteration (operator++) is supported. More...
 
class  TLoadVecInit
 

Public Member Functions

 TCrossNet ()
 
 TCrossNet (TInt MId1, TInt MId2, TInt LId)
 
 TCrossNet (TInt MId1, TInt MId2, TBool IsDir, TInt LId)
 
 TCrossNet (TSIn &SIn)
 
 TCrossNet (const TCrossNet &OtherTCrossNet)
 
TCrossNetoperator= (const TCrossNet &OtherTCrossNet)
 
bool IsEdge (const int &EId) const
 Tests whether an edge with edge ID EId exists in the graph. More...
 
int GetMxEId () const
 
int GetEdges () const
 Returns the number of edges in the graph. More...
 
void Clr ()
 Deletes all nodes and edges from the graph. More...
 
int AddEdge (const int &sourceNId, const int &destNId, int EId=-1)
 Adds an edge to the CrossNet; Mode1 NId should be the sourceNId always, regardless of whether edge is directed. More...
 
TCrossEdgeI GetEdgeI (const int &EId) const
 Edge iterators. More...
 
TCrossEdgeI BegEdgeI () const
 
TCrossEdgeI EndEdgeI () const
 
int DelEdge (const int &EId)
 Deletes an edge by its id. More...
 
int GetMode1 () const
 Gets the id of the src mode. More...
 
int GetMode2 () const
 Gets the id of the dst mode. More...
 
void Save (TSOut &SOut) const
 Saves the TCrossNet to the binary stream. More...
 
void LoadShM (TShMIn &ShMIn)
 Loads network from shared memory stream. More...
 
bool IsDirected () const
 Whether edges in the crossnet are directed. More...
 
void AttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of attr names for edge EId. More...
 
void AttrNameEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Names) const
 
void AttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr values for edge EId. More...
 
void AttrValueEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Values) const
 
void IntAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for edge EId. More...
 
void IntAttrNameEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Names) const
 
void IntAttrValueEI (const TInt &EId, TIntV &Values) const
 Returns a vector of attr values for edge EId. More...
 
void IntAttrValueEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TIntV &Values) const
 
void StrAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of str attr names for node NId. More...
 
void StrAttrNameEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Names) const
 
void StrAttrValueEI (const TInt &EId, TStrV &Values) const
 Returns a vector of attr values for node NId. More...
 
void StrAttrValueEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Values) const
 
void FltAttrNameEI (const TInt &EId, TStrV &Names) const
 Returns a vector of int attr names for node NId. More...
 
void FltAttrNameEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TStrV &Names) const
 
void FltAttrValueEI (const TInt &EId, TFltV &Values) const
 Returns a vector of attr values for node NId. More...
 
void FltAttrValueEI (const TInt &EId, TStrIntPrH::TIter CrossHI, TFltV &Values) const
 
int AddIntAttrDatE (const TCrossEdgeI &EdgeI, const TInt &value, const TStr &attr)
 Attribute based add function for attr to Int value. More...
 
int AddIntAttrDatE (const int &EId, const TInt &value, const TStr &attr)
 
int AddStrAttrDatE (const TCrossEdgeI &EdgeI, const TStr &value, const TStr &attr)
 Attribute based add function for attr to Str value. More...
 
int AddStrAttrDatE (const int &EId, const TStr &value, const TStr &attr)
 
int AddFltAttrDatE (const TCrossEdgeI &EdgeI, const TFlt &value, const TStr &attr)
 Attribute based add function for attr to Flt value. More...
 
int AddFltAttrDatE (const int &EId, const TFlt &value, const TStr &attr)
 
TInt GetIntAttrDatE (const TCrossEdgeI &EdgeI, const TStr &attr)
 Gets the value of int attr from the edge attr value vector. More...
 
TInt GetIntAttrDatE (const int &EId, const TStr &attr)
 
TStr GetStrAttrDatE (const TCrossEdgeI &EdgeI, const TStr &attr)
 Gets the value of str attr from the edge attr value vector. More...
 
TStr GetStrAttrDatE (const int &EId, const TStr &attr)
 
TFlt GetFltAttrDatE (const TCrossEdgeI &EdgeI, const TStr &attr)
 Gets the value of flt attr from the edge attr value vector. More...
 
TFlt GetFltAttrDatE (const int &EId, const TStr &attr)
 
TAIntI BegEAIntI (const TStr &attr) const
 Returns an iterator referring to the first edge's int attribute. More...
 
TAIntI EndEAIntI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAIntI GetEAIntI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAStrI BegEAStrI (const TStr &attr) const
 Returns an iterator referring to the first edge's str attribute. More...
 
TAStrI EndEAStrI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAStrI GetEAStrI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
TAFltI BegEAFltI (const TStr &attr) const
 Returns an iterator referring to the first edge's flt attribute. More...
 
TAFltI EndEAFltI (const TStr &attr) const
 Returns an iterator referring to the past-the-end edge's attribute. More...
 
TAFltI GetEAFltI (const TStr &attr, const int &EId) const
 Returns an iterator referring to the edge of ID EId in the graph. More...
 
int DelAttrDatE (const TCrossEdgeI &EdgeI, const TStr &attr)
 Deletes the edge attribute for NodeI. More...
 
int DelAttrDatE (const int &EId, const TStr &attr)
 
int AddIntAttrE (const TStr &attr, TInt defaultValue=TInt::Mn)
 Adds a new Int edge attribute to the hashmap. More...
 
int AddStrAttrE (const TStr &attr, TStr defaultValue=TStr::GetNullStr())
 Adds a new Str edge attribute to the hashmap. More...
 
int AddFltAttrE (const TStr &attr, TFlt defaultValue=TFlt::Mn)
 Adds a new Flt edge attribute to the hashmap. More...
 
int DelAttrE (const TStr &attr)
 Removes all the values for edge attr. More...
 
bool IsAttrDeletedE (const int &EId, const TStr &attr) const
 
bool IsIntAttrDeletedE (const int &EId, const TStr &attr) const
 
bool IsStrAttrDeletedE (const int &EId, const TStr &attr) const
 
bool IsFltAttrDeletedE (const int &EId, const TStr &attr) const
 
bool EdgeAttrIsDeleted (const int &EId, const TStrIntPrH::TIter &CrossHI) const
 
bool EdgeAttrIsIntDeleted (const int &EId, const TStrIntPrH::TIter &CrossHI) const
 
bool EdgeAttrIsStrDeleted (const int &EId, const TStrIntPrH::TIter &CrossHI) const
 
bool EdgeAttrIsFltDeleted (const int &EId, const TStrIntPrH::TIter &CrossHI) const
 
TStr GetEdgeAttrValue (const int &EId, const TStrIntPrH::TIter &CrossHI) const
 

Private Types

enum  { IntType, StrType, FltType }
 

Private Member Functions

void SetParentPointer (TMMNet *parent)
 
TInt GetIntAttrDefaultE (const TStr &attribute) const
 Gets Int edge attribute val. If not a proper attr, return default. More...
 
TStr GetStrAttrDefaultE (const TStr &attribute) const
 Gets Str edge attribute val. If not a proper attr, return default. More...
 
TFlt GetFltAttrDefaultE (const TStr &attribute) const
 Gets Flt edge attribute val. If not a proper attr, return default. More...
 
int GetAttrTypeE (const TStr &attr) const
 
TCrossEdgeGetEdge (int eid)
 

Private Attributes

THash< TInt, TCrossEdgeCrossH
 
TInt MxEId
 The HashTable from Edge id to the corresponding Edge. More...
 
TInt Mode1
 
TInt Mode2
 The first mode. In the case of directed crossnets, this is implicitly understood to be the source mode. More...
 
TBool IsDirect
 The second mode. In the case of directed crossnets, this is implicitly understood to be the destination mode. More...
 
TInt CrossNetId
 
TMMNetNet
 
TStrIntPrH KeyToIndexTypeE
 
THash< TStr, TIntIntDefaultsE
 
THash< TStr, TStrStrDefaultsE
 
THash< TStr, TFltFltDefaultsE
 
TVec< TIntVVecOfIntVecsE
 
TVec< TStrVVecOfStrVecsE
 
TVec< TFltVVecOfFltVecsE
 

Friends

class TMMNet
 
class TModeNet
 

Detailed Description

Implements a single CrossNet consisting of edges between two TModeNets (could be the same TModeNet)

The class corresponding to one particular CrossNet in a TMMNet. Has a CrossNet name, and two modes. Can be either undirected or directed. If it is directed, it is directed in one direction only: from mode 1 to mode 2.

Definition at line 133 of file mmnet.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
IntType 
StrType 
FltType 

Definition at line 278 of file mmnet.h.

Constructor & Destructor Documentation

TCrossNet::TCrossNet ( )
inline

Definition at line 280 of file mmnet.h.

TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossNet::TCrossNet ( TInt  MId1,
TInt  MId2,
TInt  LId 
)
inline

Definition at line 282 of file mmnet.h.

282  : CrossH(), MxEId(0), Mode1(MId1), Mode2(MId2), IsDirect(true),CrossNetId(LId), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossNet::TCrossNet ( TInt  MId1,
TInt  MId2,
TBool  IsDir,
TInt  LId 
)
inline

Definition at line 284 of file mmnet.h.

284  : CrossH(), MxEId(0), Mode1(MId1), Mode2(MId2), IsDirect(IsDir),CrossNetId(LId), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossNet::TCrossNet ( TSIn SIn)
inline

Definition at line 286 of file mmnet.h.

286  : CrossH(SIn), MxEId(SIn), Mode1(SIn), Mode2(SIn), IsDirect(SIn), CrossNetId(SIn), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossNet::TCrossNet ( const TCrossNet OtherTCrossNet)
inline

Definition at line 288 of file mmnet.h.

288  : CrossH(OtherTCrossNet.CrossH), MxEId(OtherTCrossNet.MxEId), Mode1(OtherTCrossNet.Mode1),
289  Mode2(OtherTCrossNet.Mode2), IsDirect(OtherTCrossNet.IsDirect), CrossNetId(OtherTCrossNet.CrossNetId),Net(OtherTCrossNet.Net), KeyToIndexTypeE(OtherTCrossNet.KeyToIndexTypeE),
290  IntDefaultsE(OtherTCrossNet.IntDefaultsE), StrDefaultsE(OtherTCrossNet.StrDefaultsE), FltDefaultsE(OtherTCrossNet.FltDefaultsE), VecOfIntVecsE(OtherTCrossNet.VecOfIntVecsE),
291  VecOfStrVecsE(OtherTCrossNet.VecOfStrVecsE), VecOfFltVecsE(OtherTCrossNet.VecOfFltVecsE) {}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264

Member Function Documentation

int TCrossNet::AddEdge ( const int &  sourceNId,
const int &  destNId,
int  EId = -1 
)

Adds an edge to the CrossNet; Mode1 NId should be the sourceNId always, regardless of whether edge is directed.

Definition at line 233 of file mmnet.cpp.

233  {
234  if (EId == -1) { EId = MxEId; MxEId++; }
235  else { MxEId = TMath::Mx(EId+1, MxEId()); }
236  if (Net != NULL) {
237  TModeNet& M1 = Net->TModeNetH.GetDat(this->Mode1);
238  TModeNet& M2 = Net->TModeNetH.GetDat(this->Mode2);
239  if (!M1.IsNode(sourceNId) || !M2.IsNode(destNId)) { return -1; }
240  TStr ThisCrossName = Net->GetCrossName(this->CrossNetId);
241  M1.AddNeighbor(sourceNId, EId, true, ThisCrossName, Mode1==Mode2, IsDirect);
242  M2.AddNeighbor(destNId, EId, false, ThisCrossName, Mode1==Mode2, IsDirect);
243  }
244  TCrossNet::TCrossEdge newEdge(EId, sourceNId, destNId);
245  CrossH.AddDat(EId, newEdge);
246  int i;
247  // update attribute columns
248  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
249  TVec<TInt>& IntVec = VecOfIntVecsE[i];
250  int KeyId = CrossH.GetKeyId(EId);
251  if (IntVec.Len() > KeyId) {
252  IntVec[KeyId] = TInt::Mn;
253  } else {
254  IntVec.Ins(KeyId, TInt::Mn);
255  }
256  }
257  TVec<TStr> DefIntVec = TVec<TStr>();
258  IntDefaultsE.GetKeyV(DefIntVec);
259  for (i = 0; i < DefIntVec.Len(); i++) {
260  TStr attr = DefIntVec[i];
261  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
262  IntVec[CrossH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
263  }
264 
265  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
266  TVec<TStr>& StrVec = VecOfStrVecsE[i];
267  int KeyId = CrossH.GetKeyId(EId);
268  if (StrVec.Len() > KeyId) {
269  StrVec[KeyId] = TStr::GetNullStr();
270  } else {
271  StrVec.Ins(KeyId, TStr::GetNullStr());
272  }
273  }
274  TVec<TStr> DefStrVec = TVec<TStr>();
275  StrDefaultsE.GetKeyV(DefStrVec);
276  for (i = 0; i < DefStrVec.Len(); i++) {
277  TStr attr = DefStrVec[i];
278  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
279  StrVec[CrossH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
280  }
281 
282  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
283  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
284  int KeyId = CrossH.GetKeyId(EId);
285  if (FltVec.Len() > KeyId) {
286  FltVec[KeyId] = TFlt::Mn;
287  } else {
288  FltVec.Ins(KeyId, TFlt::Mn);
289  }
290  }
291  TVec<TStr> DefFltVec = TVec<TStr>();
292  FltDefaultsE.GetKeyV(DefFltVec);
293  for (i = 0; i < DefFltVec.Len(); i++) {
294  TStr attr = DefFltVec[i];
295  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
296  FltVec[CrossH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
297  }
298  return EId;
299 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
static const T & Mx(const T &LVal, const T &RVal)
Definition: xmath.h:32
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:314
A single edge in the cross net. Has an Edge Id, and the source and destination node ids...
Definition: mmnet.h:138
TMMNet * Net
Definition: mmnet.h:270
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:318
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
static const int Mn
Definition: dt.h:1141
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:640
static TStr GetNullStr()
Definition: dt.cpp:1626
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
The nodes of one particular mode in a TMMNet, and their neighbor vectors as TIntV attributes...
Definition: mmnet.h:23
THash< TInt, TModeNet > TModeNetH
Keeps track of the max crossnet id.
Definition: mmnet.h:562
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:484
Definition: dt.h:412
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TVal2 Val2
Definition: ds.h:35
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:2385
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:316
static const double Mn
Definition: dt.h:1390
int AddNeighbor(const int &NId, const int &EId, const bool outEdge, const int linkId, const bool sameMode, bool isDir)
Definition: mmnet.cpp:38
int TCrossNet::AddFltAttrDatE ( const TCrossEdgeI EdgeI,
const TFlt value,
const TStr attr 
)
inline

Attribute based add function for attr to Flt value.

Definition at line 410 of file mmnet.h.

410 { return AddFltAttrDatE(EdgeI.GetId(), value, attr); }
int AddFltAttrDatE(const TCrossEdgeI &EdgeI, const TFlt &value, const TStr &attr)
Attribute based add function for attr to Flt value.
Definition: mmnet.h:410
int TCrossNet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 516 of file mmnet.cpp.

516  {
517  int i;
518  TInt CurrLen;
519 
520  if (!IsEdge(EId)) {
521  //AddEdge(EId);
522  return -1;
523  }
524  if (KeyToIndexTypeE.IsKey(attr)) {
526  NewVec[CrossH.GetKeyId(EId)] = value;
527  } else {
528  CurrLen = VecOfFltVecsE.Len();
529  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
530  TVec<TFlt> NewVec = TVec<TFlt>();
531  for (i = 0; i < MxEId; i++) {
532  NewVec.Ins(i, GetFltAttrDefaultE(attr));
533  }
534  NewVec[CrossH.GetKeyId(EId)] = value;
535  VecOfFltVecsE.Add(NewVec);
536  }
537  return 0;
538 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:318
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: mmnet.h:323
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TCrossNet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 606 of file mmnet.cpp.

606  {
607  int i;
608  TInt CurrLen;
609  TVec<TFlt> NewVec;
610  CurrLen = VecOfFltVecsE.Len();
611  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
612  NewVec = TVec<TFlt>();
613  for (i = 0; i < MxEId; i++) {
614  NewVec.Ins(i, defaultValue);
615  }
616  VecOfFltVecsE.Add(NewVec);
617  if (!FltDefaultsE.IsKey(attr)) {
618  FltDefaultsE.AddDat(attr, defaultValue);
619  } else {
620  return -1;
621  }
622  return 0;
623 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TCrossNet::AddIntAttrDatE ( const TCrossEdgeI EdgeI,
const TInt value,
const TStr attr 
)
inline

Attribute based add function for attr to Int value.

Definition at line 404 of file mmnet.h.

404 { return AddIntAttrDatE(EdgeI.GetId(), value, attr); }
int AddIntAttrDatE(const TCrossEdgeI &EdgeI, const TInt &value, const TStr &attr)
Attribute based add function for attr to Int value.
Definition: mmnet.h:404
int TCrossNet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 470 of file mmnet.cpp.

470  {
471  int i;
472  TInt CurrLen;
473  if (!IsEdge(EId)) {
474  //AddEdge(EId);
475  return -1;
476  }
477  if (KeyToIndexTypeE.IsKey(attr)) {
479  NewVec[CrossH.GetKeyId(EId)] = value;
480  } else {
481  CurrLen = VecOfIntVecsE.Len();
482  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
483  TVec<TInt> NewVec = TVec<TInt>();
484  for (i = 0; i < MxEId; i++) {
485  NewVec.Ins(i, GetIntAttrDefaultE(attr));
486  }
487  NewVec[CrossH.GetKeyId(EId)] = value;
488  VecOfIntVecsE.Add(NewVec);
489  }
490  return 0;
491 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:314
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: mmnet.h:323
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TCrossNet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 567 of file mmnet.cpp.

567  {
568  // TODO(nkhadke): add error checking
569  int i;
570  TInt CurrLen;
571  TVec<TInt> NewVec;
572  CurrLen = VecOfIntVecsE.Len();
573  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
574  NewVec = TVec<TInt>();
575  for (i = 0; i < MxEId; i++) {
576  NewVec.Ins(i, defaultValue);
577  }
578  VecOfIntVecsE.Add(NewVec);
579  if (!IntDefaultsE.IsKey(attr)) {
580  IntDefaultsE.AddDat(attr, defaultValue);
581  } else {
582  return -1;
583  }
584  return 0;
585 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int TCrossNet::AddStrAttrDatE ( const TCrossEdgeI EdgeI,
const TStr value,
const TStr attr 
)
inline

Attribute based add function for attr to Str value.

Definition at line 407 of file mmnet.h.

407 { return AddStrAttrDatE(EdgeI.GetId(), value, attr); }
int AddStrAttrDatE(const TCrossEdgeI &EdgeI, const TStr &value, const TStr &attr)
Attribute based add function for attr to Str value.
Definition: mmnet.h:407
int TCrossNet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 493 of file mmnet.cpp.

493  {
494  int i;
495  TInt CurrLen;
496  if (!IsEdge(EId)) {
497  //AddEdge(EId);
498  return -1;
499  }
500  if (KeyToIndexTypeE.IsKey(attr)) {
502  NewVec[CrossH.GetKeyId(EId)] = value;
503  } else {
504  CurrLen = VecOfStrVecsE.Len();
505  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
506  TVec<TStr> NewVec = TVec<TStr>();
507  for (i = 0; i < MxEId; i++) {
508  NewVec.Ins(i, GetStrAttrDefaultE(attr));
509  }
510  NewVec[CrossH.GetKeyId(EId)] = value;
511  VecOfStrVecsE.Add(NewVec);
512  }
513  return 0;
514 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TVal2 Val2
Definition: ds.h:35
bool IsEdge(const int &EId) const
Tests whether an edge with edge ID EId exists in the graph.
Definition: mmnet.h:323
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:316
int TCrossNet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 587 of file mmnet.cpp.

587  {
588  int i;
589  TInt CurrLen;
590  TVec<TStr> NewVec;
591  CurrLen = VecOfStrVecsE.Len();
592  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
593  NewVec = TVec<TStr>();
594  for (i = 0; i < MxEId; i++) {
595  NewVec.Ins(i, defaultValue);
596  }
597  VecOfStrVecsE.Add(NewVec);
598  if (!StrDefaultsE.IsKey(attr)) {
599  StrDefaultsE.AddDat(attr, defaultValue);
600  } else {
601  return -1;
602  }
603  return 0;
604 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
Definition: dt.h:1137
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1180
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
void TCrossNet::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 369 of file mmnet.h.

369  {
370  AttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void AttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of attr names for edge EId.
Definition: mmnet.h:369
void TCrossNet::AttrNameEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Names 
) const

Definition at line 329 of file mmnet.cpp.

329  {
330  Names = TVec<TStr>();
331  while (!CrossHI.IsEnd()) {
332  if (!EdgeAttrIsDeleted(EId, CrossHI)) {
333  Names.Add(CrossHI.GetKey());
334  }
335  CrossHI++;
336  }
337 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:431
const TKey & GetKey() const
Definition: hash.h:80
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TCrossNet::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 373 of file mmnet.h.

373  {
374  AttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
void AttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for edge EId.
Definition: mmnet.h:373
TIter BegI() const
Definition: hash.h:213
void TCrossNet::AttrValueEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Values 
) const

Definition at line 339 of file mmnet.cpp.

339  {
340  Values = TVec<TStr>();
341  while (!CrossHI.IsEnd()) {
342  if (!EdgeAttrIsDeleted(EId, CrossHI)) {
343  Values.Add(GetEdgeAttrValue(EId, CrossHI));
344  }
345  CrossHI++;
346  }
347 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:431
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:456
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TAFltI TCrossNet::BegEAFltI ( const TStr attr) const
inline

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

Definition at line 448 of file mmnet.h.

448  {
449  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, this);
450  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TAIntI TCrossNet::BegEAIntI ( const TStr attr) const
inline

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

Definition at line 424 of file mmnet.h.

424  {
425  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, this);
426  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVal2 Val2
Definition: ds.h:35
TAStrI TCrossNet::BegEAStrI ( const TStr attr) const
inline

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

Definition at line 437 of file mmnet.h.

437  {
438  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, this); }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TVal2 Val2
Definition: ds.h:35
TCrossEdgeI TCrossNet::BegEdgeI ( ) const
inline

Definition at line 335 of file mmnet.h.

335 { return TCrossEdgeI(CrossH.BegI(), this); }
TIter BegI() const
Definition: hash.h:213
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
void TCrossNet::Clr ( )

Deletes all nodes and edges from the graph.

Definition at line 219 of file mmnet.cpp.

219  {
220  CrossH.Clr();
221  MxEId=0;
223  IntDefaultsE.Clr();
224  StrDefaultsE.Clr();
225  FltDefaultsE.Clr();
226  VecOfIntVecsE.Clr();
227  VecOfStrVecsE.Clr();
228  VecOfFltVecsE.Clr();
231 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TInt CrossNetId
Definition: mmnet.h:269
bool Val
Definition: dt.h:976
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
void ClrNbr(const TInt &ModeId, const TInt &CrossNetId, const bool &outEdge, const bool &sameMode, bool &isDir)
Definition: mmnet.cpp:786
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
int TCrossNet::DelAttrDatE ( const TCrossEdgeI EdgeI,
const TStr attr 
)
inline

Deletes the edge attribute for NodeI.

Definition at line 461 of file mmnet.h.

461 { return DelAttrDatE(EdgeI.GetId(), attr); }
int DelAttrDatE(const TCrossEdgeI &EdgeI, const TStr &attr)
Deletes the edge attribute for NodeI.
Definition: mmnet.h:461
int TCrossNet::DelAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 552 of file mmnet.cpp.

552  {
553  // TODO(nkhadke): add error checking
554  TInt vecType = KeyToIndexTypeE(attr).Val1;
555  if (vecType == IntType) {
557  } else if (vecType == StrType) {
559  } else if (vecType == FltType) {
561  } else {
562  return -1;
563  }
564  return 0;
565 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:314
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:318
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
Definition: dt.h:1137
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:316
int TCrossNet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 625 of file mmnet.cpp.

625  {
626  TInt vecType = KeyToIndexTypeE(attr).Val1;
627  if (vecType == IntType) {
629  if (IntDefaultsE.IsKey(attr)) {
630  IntDefaultsE.DelKey(attr);
631  }
632  } else if (vecType == StrType) {
634  if (StrDefaultsE.IsKey(attr)) {
635  StrDefaultsE.DelKey(attr);
636  }
637  } else if (vecType == FltType) {
639  if (FltDefaultsE.IsKey(attr)) {
640  FltDefaultsE.DelKey(attr);
641  }
642  } else {
643  return -1;
644  }
645  KeyToIndexTypeE.DelKey(attr);
646  return 0;
647 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
void DelKey(const TKey &Key)
Definition: hash.h:404
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
Definition: dt.h:1137
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int TCrossNet::DelEdge ( const int &  EId)

Deletes an edge by its id.

Definition at line 301 of file mmnet.cpp.

301  {
302  TCrossEdge& Edge = CrossH.GetDat(EId);
303  int srcNode = Edge.SrcNId;
304  int dstNode = Edge.DstNId;
305  TStr ThisCrossName = Net->GetCrossName(this->CrossNetId);
306  Net->GetModeNetById(this->Mode1).DelNeighbor(srcNode, EId, true, ThisCrossName, Mode1==Mode2, IsDirect);
307  Net->GetModeNetById(this->Mode2).DelNeighbor(dstNode, EId, false, ThisCrossName, Mode1==Mode2, IsDirect);
308  int i;
309  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
310  TVec<TInt>& IntVec = VecOfIntVecsE[i];
311  IntVec[CrossH.GetKeyId(EId)] = TInt::Mn;
312  }
313  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
314  TVec<TStr>& StrVec = VecOfStrVecsE[i];
315  StrVec[CrossH.GetKeyId(EId)] = TStr::GetNullStr();
316  }
317  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
318  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
319  FltVec[CrossH.GetKeyId(EId)] = TFlt::Mn;
320  }
321  CrossH.DelKey(EId);
322  return 0;
323 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TMMNet * Net
Definition: mmnet.h:270
int DelNeighbor(const int &NId, const int &EId, bool outEdge, const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:51
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
void DelKey(const TKey &Key)
Definition: hash.h:404
static const int Mn
Definition: dt.h:1141
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:640
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TModeNet & GetModeNetById(const TInt &ModeId) const
Definition: mmnet.cpp:753
Definition: dt.h:412
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
static const double Mn
Definition: dt.h:1390
bool TCrossNet::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 431 of file mmnet.cpp.

431  {
432  bool IntDel = EdgeAttrIsIntDeleted(EId, CrossHI);
433  bool StrDel = EdgeAttrIsStrDeleted(EId, CrossHI);
434  bool FltDel = EdgeAttrIsFltDeleted(EId, CrossHI);
435  return IntDel || StrDel || FltDel;
436 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:444
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:438
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:450
bool TCrossNet::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 450 of file mmnet.cpp.

450  {
451  return (CrossHI.GetDat().Val1 == FltType &&
452  GetFltAttrDefaultE(CrossHI.GetKey()) == this->VecOfFltVecsE.GetVal(
453  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
454 }
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:318
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
bool TCrossNet::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 438 of file mmnet.cpp.

438  {
439  return (CrossHI.GetDat().Val1 == IntType &&
440  GetIntAttrDefaultE(CrossHI.GetKey()) == this->VecOfIntVecsE.GetVal(
441  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
442 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:314
const TKey & GetKey() const
Definition: hash.h:80
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
bool TCrossNet::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 444 of file mmnet.cpp.

444  {
445  return (CrossHI.GetDat().Val1 == StrType &&
446  GetStrAttrDefaultE(CrossHI.GetKey()) == this->VecOfStrVecsE.GetVal(
447  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
448 }
const TKey & GetKey() const
Definition: hash.h:80
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
const TDat & GetDat() const
Definition: hash.h:81
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:316
TAFltI TCrossNet::EndEAFltI ( const TStr attr) const
inline

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

Definition at line 452 of file mmnet.h.

452  {
453  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
454  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TAIntI TCrossNet::EndEAIntI ( const TStr attr) const
inline

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

Definition at line 428 of file mmnet.h.

428  {
429  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
430  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal2 Val2
Definition: ds.h:35
TAStrI TCrossNet::EndEAStrI ( const TStr attr) const
inline

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

Definition at line 440 of file mmnet.h.

440  {
441  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
442  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TVal2 Val2
Definition: ds.h:35
TCrossEdgeI TCrossNet::EndEdgeI ( ) const
inline

Definition at line 336 of file mmnet.h.

336 { return TCrossEdgeI(CrossH.EndI(), this); }
TIter EndI() const
Definition: hash.h:218
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
void TCrossNet::FltAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for node NId.

Definition at line 395 of file mmnet.h.

395  {
396  FltAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
void FltAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for node NId.
Definition: mmnet.h:395
TIter BegI() const
Definition: hash.h:213
void TCrossNet::FltAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Names 
) const

Definition at line 391 of file mmnet.cpp.

391  {
392  Names = TVec<TStr>();
393  while (!CrossHI.IsEnd()) {
394  if (CrossHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, CrossHI)) {
395  Names.Add(CrossHI.GetKey());
396  }
397  CrossHI++;
398  }
399 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:450
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TCrossNet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 399 of file mmnet.h.

399  {
400  FltAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
void FltAttrValueEI(const TInt &EId, TFltV &Values) const
Returns a vector of attr values for node NId.
Definition: mmnet.h:399
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void TCrossNet::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TFltV Values 
) const

Definition at line 401 of file mmnet.cpp.

401  {
402  Values = TVec<TFlt>();
403  while (!CrossHI.IsEnd()) {
404  if (CrossHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, CrossHI)) {
405  TFlt val = (this->VecOfFltVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId));
406  Values.Add(val);
407  }
408  CrossHI++;
409  }
410 }
Definition: dt.h:1386
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:450
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int TCrossNet::GetAttrTypeE ( const TStr attr) const
private

Definition at line 212 of file mmnet.cpp.

212  {
213  if (KeyToIndexTypeE.IsKey(attr)) {
214  return KeyToIndexTypeE.GetDat(attr).Val1;
215  }
216  return -1;
217 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TAFltI TCrossNet::GetEAFltI ( const TStr attr,
const int &  EId 
) const
inline

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

Definition at line 456 of file mmnet.h.

456  {
457  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
458  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAIntI TCrossNet::GetEAIntI ( const TStr attr,
const int &  EId 
) const
inline

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

Definition at line 432 of file mmnet.h.

432  {
433  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
434  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:597
TAStrI TCrossNet::GetEAStrI ( const TStr attr,
const int &  EId 
) const
inline

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

Definition at line 444 of file mmnet.h.

444  {
445  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
446  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossEdge& TCrossNet::GetEdge ( int  eid)
inlineprivate

Definition at line 320 of file mmnet.h.

320 { return CrossH[eid]; }
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TStr TCrossNet::GetEdgeAttrValue ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 456 of file mmnet.cpp.

456  {
457  if (CrossHI.GetDat().Val1 == IntType) {
458  return (this->VecOfIntVecsE.GetVal(
459  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId))).GetStr();
460  } else if(CrossHI.GetDat().Val1 == StrType) {
461  return this->VecOfStrVecsE.GetVal(
462  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId));
463  } else if (CrossHI.GetDat().Val1 == FltType) {
464  return (this->VecOfFltVecsE.GetVal(
465  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId))).GetStr();
466  }
467  return TStr::GetNullStr();
468 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
const TKey & GetKey() const
Definition: hash.h:80
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossEdgeI TCrossNet::GetEdgeI ( const int &  EId) const
inline

Edge iterators.

Definition at line 334 of file mmnet.h.

334 { return TCrossEdgeI(CrossH.GetI(EId), this); }
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TIter GetI(const TKey &Key) const
Definition: hash.h:220
int TCrossNet::GetEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 327 of file mmnet.h.

327 { return CrossH.Len(); }
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
int Len() const
Definition: hash.h:228
TFlt TCrossNet::GetFltAttrDatE ( const TCrossEdgeI EdgeI,
const TStr attr 
)
inline

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

Definition at line 420 of file mmnet.h.

420 { return GetFltAttrDatE(EdgeI.GetId(), attr); }
TFlt GetFltAttrDatE(const TCrossEdgeI &EdgeI, const TStr &attr)
Gets the value of flt attr from the edge attr value vector.
Definition: mmnet.h:420
TFlt TCrossNet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 548 of file mmnet.cpp.

548  {
550 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TFlt TCrossNet::GetFltAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 318 of file mmnet.h.

318 { return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: dt.h:1386
bool IsKey(const TKey &Key) const
Definition: hash.h:258
static const double Mn
Definition: dt.h:1390
TInt TCrossNet::GetIntAttrDatE ( const TCrossEdgeI EdgeI,
const TStr attr 
)
inline

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

Definition at line 414 of file mmnet.h.

414 { return GetIntAttrDatE(EdgeI.GetId(), attr); }
TInt GetIntAttrDatE(const TCrossEdgeI &EdgeI, const TStr &attr)
Gets the value of int attr from the edge attr value vector.
Definition: mmnet.h:414
TInt TCrossNet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 540 of file mmnet.cpp.

540  {
542 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TInt TCrossNet::GetIntAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 314 of file mmnet.h.

314 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static const int Mn
Definition: dt.h:1141
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
Definition: dt.h:1137
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int TCrossNet::GetMode1 ( ) const
inline

Gets the id of the src mode.

Definition at line 340 of file mmnet.h.

340 { return Mode1; }
TInt Mode1
Definition: mmnet.h:266
int TCrossNet::GetMode2 ( ) const
inline

Gets the id of the dst mode.

Definition at line 342 of file mmnet.h.

342 {return Mode2; }
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
int TCrossNet::GetMxEId ( ) const
inline

Definition at line 325 of file mmnet.h.

325 { return MxEId; }
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
TStr TCrossNet::GetStrAttrDatE ( const TCrossEdgeI EdgeI,
const TStr attr 
)
inline

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

Definition at line 417 of file mmnet.h.

417 { return GetStrAttrDatE(EdgeI.GetId(), attr); }
TStr GetStrAttrDatE(const TCrossEdgeI &EdgeI, const TStr &attr)
Gets the value of str attr from the edge attr value vector.
Definition: mmnet.h:417
TStr TCrossNet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 544 of file mmnet.cpp.

544  {
546 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TStr TCrossNet::GetStrAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 316 of file mmnet.h.

316 { return StrDefaultsE.IsKey(attribute) ? StrDefaultsE.GetDat(attribute) : (TStr) TStr::GetNullStr(); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
bool IsKey(const TKey &Key) const
Definition: hash.h:258
void TCrossNet::IntAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of int attr names for edge EId.

Definition at line 377 of file mmnet.h.

377  {
378  IntAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void IntAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of int attr names for edge EId.
Definition: mmnet.h:377
void TCrossNet::IntAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Names 
) const

Definition at line 349 of file mmnet.cpp.

349  {
350  Names = TVec<TStr>();
351  while (!CrossHI.IsEnd()) {
352  if (CrossHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, CrossHI)) {
353  Names.Add(CrossHI.GetKey());
354  }
355  CrossHI++;
356  }
357 }
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:438
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TCrossNet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 381 of file mmnet.h.

381  {
382  IntAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void IntAttrValueEI(const TInt &EId, TIntV &Values) const
Returns a vector of attr values for edge EId.
Definition: mmnet.h:381
void TCrossNet::IntAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TIntV Values 
) const

Definition at line 359 of file mmnet.cpp.

359  {
360  Values = TVec<TInt>();
361  while (!CrossHI.IsEnd()) {
362  if (CrossHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, CrossHI)) {
363  TInt val = (this->VecOfIntVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId));
364  Values.Add(val);
365  }
366  CrossHI++;
367  }
368 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:649
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:438
Definition: dt.h:1137
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool TCrossNet::IsAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 412 of file mmnet.cpp.

412  {
413  bool IntDel = IsIntAttrDeletedE(EId, attr);
414  bool StrDel = IsStrAttrDeletedE(EId, attr);
415  bool FltDel = IsFltAttrDeletedE(EId, attr);
416  return IntDel || StrDel || FltDel;
417 }
bool IsFltAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:427
bool IsIntAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:419
bool IsStrAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:423
bool TCrossNet::IsDirected ( ) const
inline

Whether edges in the crossnet are directed.

Definition at line 367 of file mmnet.h.

367 { return IsDirect;}
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
bool TCrossNet::IsEdge ( const int &  EId) const
inline

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

Definition at line 323 of file mmnet.h.

323 { return CrossH.IsKey(EId); }
bool IsKey(const TKey &Key) const
Definition: hash.h:258
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
bool TCrossNet::IsFltAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 427 of file mmnet.cpp.

427  {
428  return EdgeAttrIsFltDeleted(EId, KeyToIndexTypeE.GetI(attr));
429 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:450
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TCrossNet::IsIntAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 419 of file mmnet.cpp.

419  {
420  return EdgeAttrIsIntDeleted(EId, KeyToIndexTypeE.GetI(attr));
421 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:438
TIter GetI(const TKey &Key) const
Definition: hash.h:220
bool TCrossNet::IsStrAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 423 of file mmnet.cpp.

423  {
424  return EdgeAttrIsStrDeleted(EId, KeyToIndexTypeE.GetI(attr));
425 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:444
TIter GetI(const TKey &Key) const
Definition: hash.h:220
void TCrossNet::LoadShM ( TShMIn ShMIn)
inline

Loads network from shared memory stream.

Definition at line 348 of file mmnet.h.

348  {
349  CrossH.LoadShM(ShMIn);
350  MxEId = TInt(ShMIn);
351  Mode1 = TInt(ShMIn);
352  Mode2 = TInt(ShMIn);
353  IsDirect = TBool(ShMIn);
354  CrossNetId = TInt(ShMIn);
355  Net = NULL;
356  KeyToIndexTypeE.LoadShM(ShMIn);
357  IntDefaultsE.LoadShM(ShMIn);
358  StrDefaultsE.LoadShM(ShMIn);
359  FltDefaultsE.LoadShM(ShMIn);
360  TLoadVecInit VecFn;
361  VecOfIntVecsE.LoadShM(ShMIn, VecFn);
362  VecOfStrVecsE.Load(ShMIn);
363  VecOfFltVecsE.Load(ShMIn);
364  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
void Load(TSIn &SIn)
Definition: ds.h:946
void LoadShM(TShMIn &ShMIn)
Load THash from shared memory file. Copying/Deleting Keys is illegal.
Definition: hash.h:157
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
Definition: dt.h:1137
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
Definition: ds.h:932
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
Definition: dt.h:974
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
TCrossNet& TCrossNet::operator= ( const TCrossNet OtherTCrossNet)
inline

Definition at line 293 of file mmnet.h.

293  {
294  CrossH = OtherTCrossNet.CrossH;
295  MxEId = OtherTCrossNet.MxEId;
296  Mode1 = OtherTCrossNet.Mode1;
297  Mode2 = OtherTCrossNet.Mode2;
298  CrossNetId = OtherTCrossNet.CrossNetId;
299  IsDirect = OtherTCrossNet.IsDirect;
300  Net = OtherTCrossNet.Net;
301  KeyToIndexTypeE = OtherTCrossNet.KeyToIndexTypeE;
302  IntDefaultsE = OtherTCrossNet.IntDefaultsE;
303  StrDefaultsE = OtherTCrossNet.StrDefaultsE;
304  FltDefaultsE = OtherTCrossNet.FltDefaultsE;
305  VecOfIntVecsE = OtherTCrossNet.VecOfIntVecsE;
306  VecOfStrVecsE = OtherTCrossNet.VecOfStrVecsE;
307  VecOfFltVecsE = OtherTCrossNet.VecOfFltVecsE;
308  return *this;
309  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
TMMNet * Net
Definition: mmnet.h:270
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
void TCrossNet::Save ( TSOut SOut) const
inline

Saves the TCrossNet to the binary stream.

Definition at line 344 of file mmnet.h.

344  { CrossH.Save(SOut); MxEId.Save(SOut); Mode1.Save(SOut); Mode2.Save(SOut); IsDirect.Save(SOut); CrossNetId.Save(SOut);
346  VecOfStrVecsE.Save(SOut); VecOfFltVecsE.Save(SOut); }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:274
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:275
void Save(TSOut &SOut) const
Definition: dt.h:1153
void Save(TSOut &SOut) const
Definition: hash.h:183
void Save(TSOut &SOut) const
Definition: dt.h:995
void Save(TSOut &SOut) const
Definition: ds.h:954
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:273
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
TInt CrossNetId
Definition: mmnet.h:269
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:272
TInt Mode1
Definition: mmnet.h:266
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:267
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:268
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:277
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:265
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:264
void TCrossNet::SetParentPointer ( TMMNet parent)
private

Definition at line 325 of file mmnet.cpp.

325  {
326  Net = parent;
327 }
TMMNet * Net
Definition: mmnet.h:270
void TCrossNet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 387 of file mmnet.h.

387  {
388  StrAttrNameEI(EId, KeyToIndexTypeE.BegI(), Names);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void StrAttrNameEI(const TInt &EId, TStrV &Names) const
Returns a vector of str attr names for node NId.
Definition: mmnet.h:387
void TCrossNet::StrAttrNameEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Names 
) const

Definition at line 370 of file mmnet.cpp.

370  {
371  Names = TVec<TStr>();
372  while (!CrossHI.IsEnd()) {
373  if (CrossHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, CrossHI)) {
374  Names.Add(CrossHI.GetKey());
375  }
376  CrossHI++;
377  }
378 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:444
const TKey & GetKey() const
Definition: hash.h:80
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void TCrossNet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 391 of file mmnet.h.

391  {
392  StrAttrValueEI(EId, KeyToIndexTypeE.BegI(), Values);}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:271
TIter BegI() const
Definition: hash.h:213
void StrAttrValueEI(const TInt &EId, TStrV &Values) const
Returns a vector of attr values for node NId.
Definition: mmnet.h:391
void TCrossNet::StrAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TStrV Values 
) const

Definition at line 380 of file mmnet.cpp.

380  {
381  Values = TVec<TStr>();
382  while (!CrossHI.IsEnd()) {
383  if (CrossHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, CrossHI)) {
384  TStr val = this->VecOfStrVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId);
385  Values.Add(val);
386  }
387  CrossHI++;
388  }
389 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:444
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:276
const TDat & GetDat() const
Definition: hash.h:81
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:78
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Friends And Related Function Documentation

friend class TMMNet
friend

Definition at line 495 of file mmnet.h.

friend class TModeNet
friend

Definition at line 496 of file mmnet.h.

Member Data Documentation

THash<TInt,TCrossEdge> TCrossNet::CrossH
private

Definition at line 264 of file mmnet.h.

TInt TCrossNet::CrossNetId
private

Definition at line 269 of file mmnet.h.

THash<TStr, TFlt> TCrossNet::FltDefaultsE
private

Definition at line 274 of file mmnet.h.

THash<TStr, TInt> TCrossNet::IntDefaultsE
private

Definition at line 272 of file mmnet.h.

TBool TCrossNet::IsDirect
private

The second mode. In the case of directed crossnets, this is implicitly understood to be the destination mode.

Definition at line 268 of file mmnet.h.

TStrIntPrH TCrossNet::KeyToIndexTypeE
private

Definition at line 271 of file mmnet.h.

TInt TCrossNet::Mode1
private

Definition at line 266 of file mmnet.h.

TInt TCrossNet::Mode2
private

The first mode. In the case of directed crossnets, this is implicitly understood to be the source mode.

Definition at line 267 of file mmnet.h.

TInt TCrossNet::MxEId
private

The HashTable from Edge id to the corresponding Edge.

Definition at line 265 of file mmnet.h.

TMMNet* TCrossNet::Net
private

Definition at line 270 of file mmnet.h.

THash<TStr, TStr> TCrossNet::StrDefaultsE
private

Definition at line 273 of file mmnet.h.

TVec<TFltV> TCrossNet::VecOfFltVecsE
private

Definition at line 277 of file mmnet.h.

TVec<TIntV> TCrossNet::VecOfIntVecsE
private

Definition at line 275 of file mmnet.h.

TVec<TStrV> TCrossNet::VecOfStrVecsE
private

Definition at line 276 of file mmnet.h.


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