SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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...
 

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...
 
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 124 of file mmnet.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
IntType 
StrType 
FltType 

Definition at line 260 of file mmnet.h.

Constructor & Destructor Documentation

TCrossNet::TCrossNet ( )
inline

Definition at line 262 of file mmnet.h.

TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossNet::TCrossNet ( TInt  MId1,
TInt  MId2,
TInt  LId 
)
inline

Definition at line 264 of file mmnet.h.

264  : CrossH(), MxEId(0), Mode1(MId1), Mode2(MId2), IsDirect(true),CrossNetId(LId), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossNet::TCrossNet ( TInt  MId1,
TInt  MId2,
TBool  IsDir,
TInt  LId 
)
inline

Definition at line 266 of file mmnet.h.

266  : CrossH(), MxEId(0), Mode1(MId1), Mode2(MId2), IsDirect(IsDir),CrossNetId(LId), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossNet::TCrossNet ( TSIn SIn)
inline

Definition at line 268 of file mmnet.h.

268  : CrossH(SIn), MxEId(SIn), Mode1(SIn), Mode2(SIn), IsDirect(SIn), CrossNetId(SIn), Net(),
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossNet::TCrossNet ( const TCrossNet OtherTCrossNet)
inline

Definition at line 270 of file mmnet.h.

270  : CrossH(OtherTCrossNet.CrossH), MxEId(OtherTCrossNet.MxEId), Mode1(OtherTCrossNet.Mode1),
271  Mode2(OtherTCrossNet.Mode2), IsDirect(OtherTCrossNet.IsDirect), CrossNetId(OtherTCrossNet.CrossNetId),Net(OtherTCrossNet.Net), KeyToIndexTypeE(OtherTCrossNet.KeyToIndexTypeE),
272  IntDefaultsE(OtherTCrossNet.IntDefaultsE), StrDefaultsE(OtherTCrossNet.StrDefaultsE), FltDefaultsE(OtherTCrossNet.FltDefaultsE), VecOfIntVecsE(OtherTCrossNet.VecOfIntVecsE),
273  VecOfStrVecsE(OtherTCrossNet.VecOfStrVecsE), VecOfFltVecsE(OtherTCrossNet.VecOfFltVecsE) {}
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246

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 188 of file mmnet.cpp.

188  {
189  if (EId == -1) { EId = MxEId; MxEId++; }
190  else { MxEId = TMath::Mx(EId+1, MxEId()); }
191  if (Net != NULL) {
192  TModeNet& M1 = Net->TModeNetH.GetDat(this->Mode1);
193  TModeNet& M2 = Net->TModeNetH.GetDat(this->Mode2);
194  if (!M1.IsNode(sourceNId) || !M2.IsNode(destNId)) { return -1; }
195  TStr ThisCrossName = Net->GetCrossName(this->CrossNetId);
196  M1.AddNeighbor(sourceNId, EId, true, ThisCrossName, Mode1==Mode2, IsDirect);
197  M2.AddNeighbor(destNId, EId, false, ThisCrossName, Mode1==Mode2, IsDirect);
198  }
199  TCrossNet::TCrossEdge newEdge(EId, sourceNId, destNId);
200  CrossH.AddDat(EId, newEdge);
201  int i;
202  // update attribute columns
203  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
204  TVec<TInt>& IntVec = VecOfIntVecsE[i];
205  int KeyId = CrossH.GetKeyId(EId);
206  if (IntVec.Len() > KeyId) {
207  IntVec[KeyId] = TInt::Mn;
208  } else {
209  IntVec.Ins(KeyId, TInt::Mn);
210  }
211  }
212  TVec<TStr> DefIntVec = TVec<TStr>();
213  IntDefaultsE.GetKeyV(DefIntVec);
214  for (i = 0; i < DefIntVec.Len(); i++) {
215  TStr attr = DefIntVec[i];
216  TVec<TInt>& IntVec = VecOfIntVecsE[KeyToIndexTypeE.GetDat(DefIntVec[i]).Val2];
217  IntVec[CrossH.GetKeyId(EId)] = GetIntAttrDefaultE(attr);
218  }
219 
220  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
221  TVec<TStr>& StrVec = VecOfStrVecsE[i];
222  int KeyId = CrossH.GetKeyId(EId);
223  if (StrVec.Len() > KeyId) {
224  StrVec[KeyId] = TStr::GetNullStr();
225  } else {
226  StrVec.Ins(KeyId, TStr::GetNullStr());
227  }
228  }
229  TVec<TStr> DefStrVec = TVec<TStr>();
230  StrDefaultsE.GetKeyV(DefStrVec);
231  for (i = 0; i < DefStrVec.Len(); i++) {
232  TStr attr = DefStrVec[i];
233  TVec<TStr>& StrVec = VecOfStrVecsE[KeyToIndexTypeE.GetDat(DefStrVec[i]).Val2];
234  StrVec[CrossH.GetKeyId(EId)] = GetStrAttrDefaultE(attr);
235  }
236 
237  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
238  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
239  int KeyId = CrossH.GetKeyId(EId);
240  if (FltVec.Len() > KeyId) {
241  FltVec[KeyId] = TFlt::Mn;
242  } else {
243  FltVec.Ins(KeyId, TFlt::Mn);
244  }
245  }
246  TVec<TStr> DefFltVec = TVec<TStr>();
247  FltDefaultsE.GetKeyV(DefFltVec);
248  for (i = 0; i < DefFltVec.Len(); i++) {
249  TStr attr = DefFltVec[i];
250  TVec<TFlt>& FltVec = VecOfFltVecsE[KeyToIndexTypeE.GetDat(DefFltVec[i]).Val2];
251  FltVec[CrossH.GetKeyId(EId)] = GetFltAttrDefaultE(attr);
252  }
253  return EId;
254 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
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:547
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:296
A single edge in the cross net. Has an Edge Id, and the source and destination node ids...
Definition: mmnet.h:129
TMMNet * Net
Definition: mmnet.h:252
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:300
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
static const int Mn
Definition: dt.h:1048
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:578
static TStr GetNullStr()
Definition: dt.cpp:1626
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
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:526
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
void GetKeyV(TVec< TKey > &KeyV) const
Definition: hash.h:442
Definition: dt.h:412
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
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:250
bool IsNode(const int &NId) const
Tests whether ID NId is a node.
Definition: network.h:1985
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:298
static const double Mn
Definition: dt.h:1297
int AddNeighbor(const int &NId, const int &EId, const bool outEdge, const int linkId, const bool sameMode, bool isDir)
Definition: mmnet.cpp:31
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 374 of file mmnet.h.

374 { 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:374
int TCrossNet::AddFltAttrDatE ( const int &  EId,
const TFlt value,
const TStr attr 
)

Definition at line 471 of file mmnet.cpp.

471  {
472  int i;
473  TInt CurrLen;
474 
475  if (!IsEdge(EId)) {
476  //AddEdge(EId);
477  return -1;
478  }
479  if (KeyToIndexTypeE.IsKey(attr)) {
481  NewVec[CrossH.GetKeyId(EId)] = value;
482  } else {
483  CurrLen = VecOfFltVecsE.Len();
484  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
485  TVec<TFlt> NewVec = TVec<TFlt>();
486  for (i = 0; i < MxEId; i++) {
487  NewVec.Ins(i, GetFltAttrDefaultE(attr));
488  }
489  NewVec[CrossH.GetKeyId(EId)] = value;
490  VecOfFltVecsE.Add(NewVec);
491  }
492  return 0;
493 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:300
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
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:305
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TCrossNet::AddFltAttrE ( const TStr attr,
TFlt  defaultValue = TFlt::Mn 
)

Adds a new Flt edge attribute to the hashmap.

Definition at line 561 of file mmnet.cpp.

561  {
562  int i;
563  TInt CurrLen;
564  TVec<TFlt> NewVec;
565  CurrLen = VecOfFltVecsE.Len();
566  KeyToIndexTypeE.AddDat(attr, TIntPr(FltType, CurrLen));
567  NewVec = TVec<TFlt>();
568  for (i = 0; i < MxEId; i++) {
569  NewVec.Ins(i, defaultValue);
570  }
571  VecOfFltVecsE.Add(NewVec);
572  if (!FltDefaultsE.IsKey(attr)) {
573  FltDefaultsE.AddDat(attr, defaultValue);
574  } else {
575  return -1;
576  }
577  return 0;
578 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 368 of file mmnet.h.

368 { 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:368
int TCrossNet::AddIntAttrDatE ( const int &  EId,
const TInt value,
const TStr attr 
)

Definition at line 425 of file mmnet.cpp.

425  {
426  int i;
427  TInt CurrLen;
428  if (!IsEdge(EId)) {
429  //AddEdge(EId);
430  return -1;
431  }
432  if (KeyToIndexTypeE.IsKey(attr)) {
434  NewVec[CrossH.GetKeyId(EId)] = value;
435  } else {
436  CurrLen = VecOfIntVecsE.Len();
437  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
438  TVec<TInt> NewVec = TVec<TInt>();
439  for (i = 0; i < MxEId; i++) {
440  NewVec.Ins(i, GetIntAttrDefaultE(attr));
441  }
442  NewVec[CrossH.GetKeyId(EId)] = value;
443  VecOfIntVecsE.Add(NewVec);
444  }
445  return 0;
446 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:296
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
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:305
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int TCrossNet::AddIntAttrE ( const TStr attr,
TInt  defaultValue = TInt::Mn 
)

Adds a new Int edge attribute to the hashmap.

Definition at line 522 of file mmnet.cpp.

522  {
523  // TODO(nkhadke): add error checking
524  int i;
525  TInt CurrLen;
526  TVec<TInt> NewVec;
527  CurrLen = VecOfIntVecsE.Len();
528  KeyToIndexTypeE.AddDat(attr, TIntPr(IntType, CurrLen));
529  NewVec = TVec<TInt>();
530  for (i = 0; i < MxEId; i++) {
531  NewVec.Ins(i, defaultValue);
532  }
533  VecOfIntVecsE.Add(NewVec);
534  if (!IntDefaultsE.IsKey(attr)) {
535  IntDefaultsE.AddDat(attr, defaultValue);
536  } else {
537  return -1;
538  }
539  return 0;
540 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
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 371 of file mmnet.h.

371 { 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:371
int TCrossNet::AddStrAttrDatE ( const int &  EId,
const TStr value,
const TStr attr 
)

Definition at line 448 of file mmnet.cpp.

448  {
449  int i;
450  TInt CurrLen;
451  if (!IsEdge(EId)) {
452  //AddEdge(EId);
453  return -1;
454  }
455  if (KeyToIndexTypeE.IsKey(attr)) {
457  NewVec[CrossH.GetKeyId(EId)] = value;
458  } else {
459  CurrLen = VecOfStrVecsE.Len();
460  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
461  TVec<TStr> NewVec = TVec<TStr>();
462  for (i = 0; i < MxEId; i++) {
463  NewVec.Ins(i, GetStrAttrDefaultE(attr));
464  }
465  NewVec[CrossH.GetKeyId(EId)] = value;
466  VecOfStrVecsE.Add(NewVec);
467  }
468  return 0;
469 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
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:305
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:298
int TCrossNet::AddStrAttrE ( const TStr attr,
TStr  defaultValue = TStr::GetNullStr() 
)

Adds a new Str edge attribute to the hashmap.

Definition at line 542 of file mmnet.cpp.

542  {
543  int i;
544  TInt CurrLen;
545  TVec<TStr> NewVec;
546  CurrLen = VecOfStrVecsE.Len();
547  KeyToIndexTypeE.AddDat(attr, TIntPr(StrType, CurrLen));
548  NewVec = TVec<TStr>();
549  for (i = 0; i < MxEId; i++) {
550  NewVec.Ins(i, defaultValue);
551  }
552  VecOfStrVecsE.Add(NewVec);
553  if (!StrDefaultsE.IsKey(attr)) {
554  StrDefaultsE.AddDat(attr, defaultValue);
555  } else {
556  return -1;
557  }
558  return 0;
559 }
TPair< TInt, TInt > TIntPr
Definition: ds.h:83
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
Definition: dt.h:1044
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1122
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
void TCrossNet::AttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of attr names for edge EId.

Definition at line 333 of file mmnet.h.

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

Definition at line 284 of file mmnet.cpp.

284  {
285  Names = TVec<TStr>();
286  while (!CrossHI.IsEnd()) {
287  if (!EdgeAttrIsDeleted(EId, CrossHI)) {
288  Names.Add(CrossHI.GetKey());
289  }
290  CrossHI++;
291  }
292 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:386
const TKey & GetKey() const
Definition: hash.h:71
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TCrossNet::AttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 337 of file mmnet.h.

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

Definition at line 294 of file mmnet.cpp.

294  {
295  Values = TVec<TStr>();
296  while (!CrossHI.IsEnd()) {
297  if (!EdgeAttrIsDeleted(EId, CrossHI)) {
298  Values.Add(GetEdgeAttrValue(EId, CrossHI));
299  }
300  CrossHI++;
301  }
302 }
bool EdgeAttrIsDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:386
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TStr GetEdgeAttrValue(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:411
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TAFltI TCrossNet::BegEAFltI ( const TStr attr) const
inline

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

Definition at line 412 of file mmnet.h.

412  {
413  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, this);
414  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TAIntI TCrossNet::BegEAIntI ( const TStr attr) const
inline

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

Definition at line 388 of file mmnet.h.

388  {
389  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].BegI(), attr, this);
390  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:565
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 401 of file mmnet.h.

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

Definition at line 317 of file mmnet.h.

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

Deletes all nodes and edges from the graph.

Definition at line 174 of file mmnet.cpp.

174  {
175  CrossH.Clr();
176  MxEId=0;
178  IntDefaultsE.Clr();
179  StrDefaultsE.Clr();
180  FltDefaultsE.Clr();
181  VecOfIntVecsE.Clr();
182  VecOfStrVecsE.Clr();
183  VecOfFltVecsE.Clr();
186 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
TInt CrossNetId
Definition: mmnet.h:251
bool Val
Definition: dt.h:883
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:319
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
void ClrNbr(const TInt &ModeId, const TInt &CrossNetId, const bool &outEdge, const bool &sameMode, bool &isDir)
Definition: mmnet.cpp:723
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
int TCrossNet::DelAttrDatE ( const TCrossEdgeI EdgeI,
const TStr attr 
)
inline

Deletes the edge attribute for NodeI.

Definition at line 425 of file mmnet.h.

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

Definition at line 507 of file mmnet.cpp.

507  {
508  // TODO(nkhadke): add error checking
509  TInt vecType = KeyToIndexTypeE(attr).Val1;
510  if (vecType == IntType) {
512  } else if (vecType == StrType) {
514  } else if (vecType == FltType) {
516  } else {
517  return -1;
518  }
519  return 0;
520 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:296
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:300
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
Definition: dt.h:1044
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:298
int TCrossNet::DelAttrE ( const TStr attr)

Removes all the values for edge attr.

Definition at line 580 of file mmnet.cpp.

580  {
581  TInt vecType = KeyToIndexTypeE(attr).Val1;
582  if (vecType == IntType) {
584  if (IntDefaultsE.IsKey(attr)) {
585  IntDefaultsE.DelKey(attr);
586  }
587  } else if (vecType == StrType) {
589  if (StrDefaultsE.IsKey(attr)) {
590  StrDefaultsE.DelKey(attr);
591  }
592  } else if (vecType == FltType) {
594  if (FltDefaultsE.IsKey(attr)) {
595  FltDefaultsE.DelKey(attr);
596  }
597  } else {
598  return -1;
599  }
600  KeyToIndexTypeE.DelKey(attr);
601  return 0;
602 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
void DelKey(const TKey &Key)
Definition: hash.h:362
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
Definition: dt.h:1044
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
bool IsKey(const TKey &Key) const
Definition: hash.h:216
int TCrossNet::DelEdge ( const int &  EId)

Deletes an edge by its id.

Definition at line 256 of file mmnet.cpp.

256  {
257  TCrossEdge& Edge = CrossH.GetDat(EId);
258  int srcNode = Edge.SrcNId;
259  int dstNode = Edge.DstNId;
260  TStr ThisCrossName = Net->GetCrossName(this->CrossNetId);
261  Net->GetModeNetById(this->Mode1).DelNeighbor(srcNode, EId, true, ThisCrossName, Mode1==Mode2, IsDirect);
262  Net->GetModeNetById(this->Mode2).DelNeighbor(dstNode, EId, false, ThisCrossName, Mode1==Mode2, IsDirect);
263  int i;
264  for (i = 0; i < VecOfIntVecsE.Len(); i++) {
265  TVec<TInt>& IntVec = VecOfIntVecsE[i];
266  IntVec[CrossH.GetKeyId(EId)] = TInt::Mn;
267  }
268  for (i = 0; i < VecOfStrVecsE.Len(); i++) {
269  TVec<TStr>& StrVec = VecOfStrVecsE[i];
270  StrVec[CrossH.GetKeyId(EId)] = TStr::GetNullStr();
271  }
272  for (i = 0; i < VecOfFltVecsE.Len(); i++) {
273  TVec<TFlt>& FltVec = VecOfFltVecsE[i];
274  FltVec[CrossH.GetKeyId(EId)] = TFlt::Mn;
275  }
276  CrossH.DelKey(EId);
277  return 0;
278 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TMMNet * Net
Definition: mmnet.h:252
int DelNeighbor(const int &NId, const int &EId, bool outEdge, const TStr &CrossName, const bool sameMode, bool isDir)
Definition: mmnet.cpp:44
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
void DelKey(const TKey &Key)
Definition: hash.h:362
static const int Mn
Definition: dt.h:1048
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
TStr GetCrossName(const TInt &CrossId) const
Gets the crossnet name from the crossnet id.
Definition: mmnet.h:578
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TModeNet & GetModeNetById(const TInt &ModeId) const
Definition: mmnet.cpp:690
Definition: dt.h:412
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
static const double Mn
Definition: dt.h:1297
bool TCrossNet::EdgeAttrIsDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 386 of file mmnet.cpp.

386  {
387  bool IntDel = EdgeAttrIsIntDeleted(EId, CrossHI);
388  bool StrDel = EdgeAttrIsStrDeleted(EId, CrossHI);
389  bool FltDel = EdgeAttrIsFltDeleted(EId, CrossHI);
390  return IntDel || StrDel || FltDel;
391 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:399
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:393
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:405
bool TCrossNet::EdgeAttrIsFltDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 405 of file mmnet.cpp.

405  {
406  return (CrossHI.GetDat().Val1 == FltType &&
407  GetFltAttrDefaultE(CrossHI.GetKey()) == this->VecOfFltVecsE.GetVal(
408  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
409 }
TFlt GetFltAttrDefaultE(const TStr &attribute) const
Gets Flt edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:300
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
bool TCrossNet::EdgeAttrIsIntDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 393 of file mmnet.cpp.

393  {
394  return (CrossHI.GetDat().Val1 == IntType &&
395  GetIntAttrDefaultE(CrossHI.GetKey()) == this->VecOfIntVecsE.GetVal(
396  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
397 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TInt GetIntAttrDefaultE(const TStr &attribute) const
Gets Int edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:296
const TKey & GetKey() const
Definition: hash.h:71
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
bool TCrossNet::EdgeAttrIsStrDeleted ( const int &  EId,
const TStrIntPrH::TIter CrossHI 
) const

Definition at line 399 of file mmnet.cpp.

399  {
400  return (CrossHI.GetDat().Val1 == StrType &&
401  GetStrAttrDefaultE(CrossHI.GetKey()) == this->VecOfStrVecsE.GetVal(
402  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId)));
403 }
const TKey & GetKey() const
Definition: hash.h:71
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
const TDat & GetDat() const
Definition: hash.h:72
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TStr GetStrAttrDefaultE(const TStr &attribute) const
Gets Str edge attribute val. If not a proper attr, return default.
Definition: mmnet.h:298
TAFltI TCrossNet::EndEAFltI ( const TStr attr) const
inline

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

Definition at line 416 of file mmnet.h.

416  {
417  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
418  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TAIntI TCrossNet::EndEAIntI ( const TStr attr) const
inline

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

Definition at line 392 of file mmnet.h.

392  {
393  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
394  }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:567
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
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 404 of file mmnet.h.

404  {
405  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].EndI(), attr, this);
406  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TVal2 Val2
Definition: ds.h:35
TCrossEdgeI TCrossNet::EndEdgeI ( ) const
inline

Definition at line 318 of file mmnet.h.

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

Returns a vector of int attr names for node NId.

Definition at line 359 of file mmnet.h.

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

Definition at line 346 of file mmnet.cpp.

346  {
347  Names = TVec<TStr>();
348  while (!CrossHI.IsEnd()) {
349  if (CrossHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, CrossHI)) {
350  Names.Add(CrossHI.GetKey());
351  }
352  CrossHI++;
353  }
354 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:405
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TCrossNet::FltAttrValueEI ( const TInt EId,
TFltV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 363 of file mmnet.h.

363  {
364  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:363
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TIter BegI() const
Definition: hash.h:171
void TCrossNet::FltAttrValueEI ( const TInt EId,
TStrIntPrH::TIter  CrossHI,
TFltV Values 
) const

Definition at line 356 of file mmnet.cpp.

356  {
357  Values = TVec<TFlt>();
358  while (!CrossHI.IsEnd()) {
359  if (CrossHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, CrossHI)) {
360  TFlt val = (this->VecOfFltVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId));
361  Values.Add(val);
362  }
363  CrossHI++;
364  }
365 }
Definition: dt.h:1293
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:405
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
int TCrossNet::GetAttrTypeE ( const TStr attr) const
private

Definition at line 167 of file mmnet.cpp.

167  {
168  if (KeyToIndexTypeE.IsKey(attr)) {
169  return KeyToIndexTypeE.GetDat(attr).Val1;
170  }
171  return -1;
172 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVal1 Val1
Definition: ds.h:34
bool IsKey(const TKey &Key) const
Definition: hash.h:216
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 420 of file mmnet.h.

420  {
421  return TAFltI(VecOfFltVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
422  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
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 396 of file mmnet.h.

396  {
397  return TAIntI(VecOfIntVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
398  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TIter GetI(const TSizeTy &ValN) const
Returns an iterator an element at position ValN.
Definition: ds.h:569
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 408 of file mmnet.h.

408  {
409  return TAStrI(VecOfStrVecsE[KeyToIndexTypeE.GetDat(attr).Val2].GetI(CrossH.GetKeyId(EId)), attr, this);
410  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossEdge& TCrossNet::GetEdge ( int  eid)
inlineprivate

Definition at line 302 of file mmnet.h.

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

Definition at line 411 of file mmnet.cpp.

411  {
412  if (CrossHI.GetDat().Val1 == IntType) {
413  return (this->VecOfIntVecsE.GetVal(
414  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId))).GetStr();
415  } else if(CrossHI.GetDat().Val1 == StrType) {
416  return this->VecOfStrVecsE.GetVal(
417  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId));
418  } else if (CrossHI.GetDat().Val1 == FltType) {
419  return (this->VecOfFltVecsE.GetVal(
420  this->KeyToIndexTypeE.GetDat(CrossHI.GetKey()).Val2).GetVal(CrossH.GetKeyId(EId))).GetStr();
421  }
422  return TStr::GetNullStr();
423 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
const TKey & GetKey() const
Definition: hash.h:71
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
static TStr GetNullStr()
Definition: dt.cpp:1626
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TCrossEdgeI TCrossNet::GetEdgeI ( const int &  EId) const
inline

Edge iterators.

Definition at line 316 of file mmnet.h.

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

Returns the number of edges in the graph.

Definition at line 309 of file mmnet.h.

309 { return CrossH.Len(); }
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
int Len() const
Definition: hash.h:186
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 384 of file mmnet.h.

384 { 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:384
TFlt TCrossNet::GetFltAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 503 of file mmnet.cpp.

503  {
505 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TFlt TCrossNet::GetFltAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 300 of file mmnet.h.

300 { return FltDefaultsE.IsKey(attribute) ? FltDefaultsE.GetDat(attribute) : (TFlt) TFlt::Mn; }
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
Definition: dt.h:1293
bool IsKey(const TKey &Key) const
Definition: hash.h:216
static const double Mn
Definition: dt.h:1297
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 378 of file mmnet.h.

378 { 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:378
TInt TCrossNet::GetIntAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 495 of file mmnet.cpp.

495  {
497 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TInt TCrossNet::GetIntAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 296 of file mmnet.h.

296 { return IntDefaultsE.IsKey(attribute) ? IntDefaultsE.GetDat(attribute) : (TInt) TInt::Mn; }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
static const int Mn
Definition: dt.h:1048
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
Definition: dt.h:1044
bool IsKey(const TKey &Key) const
Definition: hash.h:216
int TCrossNet::GetMode1 ( ) const
inline

Gets the id of the src mode.

Definition at line 322 of file mmnet.h.

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

Gets the id of the dst mode.

Definition at line 324 of file mmnet.h.

324 {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:249
int TCrossNet::GetMxEId ( ) const
inline

Definition at line 307 of file mmnet.h.

307 { return MxEId; }
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
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 381 of file mmnet.h.

381 { 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:381
TStr TCrossNet::GetStrAttrDatE ( const int &  EId,
const TStr attr 
)

Definition at line 499 of file mmnet.cpp.

499  {
501 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TVal2 Val2
Definition: ds.h:35
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
TStr TCrossNet::GetStrAttrDefaultE ( const TStr attribute) const
inlineprivate

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

Definition at line 298 of file mmnet.h.

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

Returns a vector of int attr names for edge EId.

Definition at line 341 of file mmnet.h.

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

Definition at line 304 of file mmnet.cpp.

304  {
305  Names = TVec<TStr>();
306  while (!CrossHI.IsEnd()) {
307  if (CrossHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, CrossHI)) {
308  Names.Add(CrossHI.GetKey());
309  }
310  CrossHI++;
311  }
312 }
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:393
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TCrossNet::IntAttrValueEI ( const TInt EId,
TIntV Values 
) const
inline

Returns a vector of attr values for edge EId.

Definition at line 345 of file mmnet.h.

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

Definition at line 314 of file mmnet.cpp.

314  {
315  Values = TVec<TInt>();
316  while (!CrossHI.IsEnd()) {
317  if (CrossHI.GetDat().Val1 == IntType && !EdgeAttrIsIntDeleted(EId, CrossHI)) {
318  TInt val = (this->VecOfIntVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId));
319  Values.Add(val);
320  }
321  CrossHI++;
322  }
323 }
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
const TVal & GetVal(const TSizeTy &ValN) const
Returns a reference to the element at position ValN in the vector.
Definition: ds.h:621
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:393
Definition: dt.h:1044
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
bool TCrossNet::IsAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 367 of file mmnet.cpp.

367  {
368  bool IntDel = IsIntAttrDeletedE(EId, attr);
369  bool StrDel = IsStrAttrDeletedE(EId, attr);
370  bool FltDel = IsFltAttrDeletedE(EId, attr);
371  return IntDel || StrDel || FltDel;
372 }
bool IsFltAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:382
bool IsIntAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:374
bool IsStrAttrDeletedE(const int &EId, const TStr &attr) const
Definition: mmnet.cpp:378
bool TCrossNet::IsDirected ( ) const
inline

Whether edges in the crossnet are directed.

Definition at line 331 of file mmnet.h.

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

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

Definition at line 305 of file mmnet.h.

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

Definition at line 382 of file mmnet.cpp.

382  {
383  return EdgeAttrIsFltDeleted(EId, KeyToIndexTypeE.GetI(attr));
384 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
bool EdgeAttrIsFltDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:405
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TCrossNet::IsIntAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 374 of file mmnet.cpp.

374  {
375  return EdgeAttrIsIntDeleted(EId, KeyToIndexTypeE.GetI(attr));
376 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
bool EdgeAttrIsIntDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:393
TIter GetI(const TKey &Key) const
Definition: hash.h:178
bool TCrossNet::IsStrAttrDeletedE ( const int &  EId,
const TStr attr 
) const

Definition at line 378 of file mmnet.cpp.

378  {
379  return EdgeAttrIsStrDeleted(EId, KeyToIndexTypeE.GetI(attr));
380 }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:399
TIter GetI(const TKey &Key) const
Definition: hash.h:178
TCrossNet& TCrossNet::operator= ( const TCrossNet OtherTCrossNet)
inline

Definition at line 275 of file mmnet.h.

275  {
276  CrossH = OtherTCrossNet.CrossH;
277  MxEId = OtherTCrossNet.MxEId;
278  Mode1 = OtherTCrossNet.Mode1;
279  Mode2 = OtherTCrossNet.Mode2;
280  CrossNetId = OtherTCrossNet.CrossNetId;
281  IsDirect = OtherTCrossNet.IsDirect;
282  Net = OtherTCrossNet.Net;
283  KeyToIndexTypeE = OtherTCrossNet.KeyToIndexTypeE;
284  IntDefaultsE = OtherTCrossNet.IntDefaultsE;
285  StrDefaultsE = OtherTCrossNet.StrDefaultsE;
286  FltDefaultsE = OtherTCrossNet.FltDefaultsE;
287  VecOfIntVecsE = OtherTCrossNet.VecOfIntVecsE;
288  VecOfStrVecsE = OtherTCrossNet.VecOfStrVecsE;
289  VecOfFltVecsE = OtherTCrossNet.VecOfFltVecsE;
290  return *this;
291  }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
TMMNet * Net
Definition: mmnet.h:252
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
void TCrossNet::Save ( TSOut SOut) const
inline

Saves the TCrossNet to the binary stream.

Definition at line 326 of file mmnet.h.

326  { CrossH.Save(SOut); MxEId.Save(SOut); Mode1.Save(SOut); Mode2.Save(SOut); IsDirect.Save(SOut); CrossNetId.Save(SOut);
328  VecOfStrVecsE.Save(SOut); VecOfFltVecsE.Save(SOut); }
TStrIntPrH KeyToIndexTypeE
Definition: mmnet.h:253
THash< TStr, TFlt > FltDefaultsE
Definition: mmnet.h:256
TVec< TIntV > VecOfIntVecsE
Definition: mmnet.h:257
void Save(TSOut &SOut) const
Definition: dt.h:1060
void Save(TSOut &SOut) const
Definition: hash.h:141
void Save(TSOut &SOut) const
Definition: dt.h:902
void Save(TSOut &SOut) const
Definition: ds.h:903
THash< TStr, TStr > StrDefaultsE
Definition: mmnet.h:255
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
TInt CrossNetId
Definition: mmnet.h:251
THash< TStr, TInt > IntDefaultsE
Definition: mmnet.h:254
TInt Mode1
Definition: mmnet.h:248
TInt Mode2
The first mode. In the case of directed crossnets, this is implicitly understood to be the source mod...
Definition: mmnet.h:249
TBool IsDirect
The second mode. In the case of directed crossnets, this is implicitly understood to be the destinati...
Definition: mmnet.h:250
TVec< TFltV > VecOfFltVecsE
Definition: mmnet.h:259
TInt MxEId
The HashTable from Edge id to the corresponding Edge.
Definition: mmnet.h:247
THash< TInt, TCrossEdge > CrossH
Definition: mmnet.h:246
void TCrossNet::SetParentPointer ( TMMNet parent)
private

Definition at line 280 of file mmnet.cpp.

280  {
281  Net = parent;
282 }
TMMNet * Net
Definition: mmnet.h:252
void TCrossNet::StrAttrNameEI ( const TInt EId,
TStrV Names 
) const
inline

Returns a vector of str attr names for node NId.

Definition at line 351 of file mmnet.h.

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

Definition at line 325 of file mmnet.cpp.

325  {
326  Names = TVec<TStr>();
327  while (!CrossHI.IsEnd()) {
328  if (CrossHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, CrossHI)) {
329  Names.Add(CrossHI.GetKey());
330  }
331  CrossHI++;
332  }
333 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:399
const TKey & GetKey() const
Definition: hash.h:71
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TCrossNet::StrAttrValueEI ( const TInt EId,
TStrV Values 
) const
inline

Returns a vector of attr values for node NId.

Definition at line 355 of file mmnet.h.

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

Definition at line 335 of file mmnet.cpp.

335  {
336  Values = TVec<TStr>();
337  while (!CrossHI.IsEnd()) {
338  if (CrossHI.GetDat().Val1 == StrType && !EdgeAttrIsStrDeleted(EId, CrossHI)) {
339  TStr val = this->VecOfStrVecsE.GetVal(CrossHI.GetDat().Val2).GetVal(EId);
340  Values.Add(val);
341  }
342  CrossHI++;
343  }
344 }
bool EdgeAttrIsStrDeleted(const int &EId, const TStrIntPrH::TIter &CrossHI) const
Definition: mmnet.cpp:399
TVec< TStrV > VecOfStrVecsE
Definition: mmnet.h:258
const TDat & GetDat() const
Definition: hash.h:72
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
Definition: hash.h:69
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574

Friends And Related Function Documentation

friend class TMMNet
friend

Definition at line 459 of file mmnet.h.

friend class TModeNet
friend

Definition at line 460 of file mmnet.h.

Member Data Documentation

THash<TInt,TCrossEdge> TCrossNet::CrossH
private

Definition at line 246 of file mmnet.h.

TInt TCrossNet::CrossNetId
private

Definition at line 251 of file mmnet.h.

THash<TStr, TFlt> TCrossNet::FltDefaultsE
private

Definition at line 256 of file mmnet.h.

THash<TStr, TInt> TCrossNet::IntDefaultsE
private

Definition at line 254 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 250 of file mmnet.h.

TStrIntPrH TCrossNet::KeyToIndexTypeE
private

Definition at line 253 of file mmnet.h.

TInt TCrossNet::Mode1
private

Definition at line 248 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 249 of file mmnet.h.

TInt TCrossNet::MxEId
private

The HashTable from Edge id to the corresponding Edge.

Definition at line 247 of file mmnet.h.

TMMNet* TCrossNet::Net
private

Definition at line 252 of file mmnet.h.

THash<TStr, TStr> TCrossNet::StrDefaultsE
private

Definition at line 255 of file mmnet.h.

TVec<TFltV> TCrossNet::VecOfFltVecsE
private

Definition at line 259 of file mmnet.h.

TVec<TIntV> TCrossNet::VecOfIntVecsE
private

Definition at line 257 of file mmnet.h.

TVec<TStrV> TCrossNet::VecOfStrVecsE
private

Definition at line 258 of file mmnet.h.


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