SNAP Library 3.0, Developer Reference
2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Multimodal networks. More...
#include <mmnet.h>
Classes | |
class | TCrossNetI |
TCrossNet iterator. Only forward iteration (operator++) is supported. More... | |
class | TModeNetI |
TModeNet iterator. Only forward iteration (operator++) is supported. More... | |
Public Member Functions | |
TMMNet () | |
TMMNet (const TMMNet &OtherTMMNet) | |
TMMNet (TSIn &SIn) | |
int | AddModeNet (const TStr &ModeName) |
Adds a mode to the multimodal network. More... | |
int | DelModeNet (const TInt &ModeId) |
Deletes a mode from the multimodal network. More... | |
int | DelModeNet (const TStr &ModeName) |
int | AddCrossNet (const TStr &ModeName1, const TStr &ModeName2, const TStr &CrossNetName, bool isDir=true) |
Adds a crossnet to the multimodal network. Specify modes by id or names; by default, crossnet is directed. More... | |
int | AddCrossNet (const TInt &ModeId1, const TInt &ModeId2, const TStr &CrossNetName, bool isDir=true) |
int | DelCrossNet (const TInt &CrossNetId) |
Deletes a crossnet from the multimodal network. More... | |
int | DelCrossNet (const TStr &CrossNet) |
void | Save (TSOut &SOut) const |
Saves the TMMNet to binary stream. More... | |
int | GetModeId (const TStr &ModeName) const |
Gets the mode id from the mode name. More... | |
TStr | GetModeName (const TInt &ModeId) const |
Gets the mode name from the mode id. More... | |
int | GetCrossId (const TStr &CrossName) const |
Gets the crossnet id from the crossnet name. More... | |
TStr | GetCrossName (const TInt &CrossId) const |
Gets the crossnet name from the crossnet id. More... | |
TModeNet & | GetModeNetByName (const TStr &ModeName) const |
Gets a reference to the modenet. More... | |
TModeNet & | GetModeNetById (const TInt &ModeId) const |
TCrossNet & | GetCrossNetByName (const TStr &CrossName) const |
Gets a reference to the crossnet. More... | |
TCrossNet & | GetCrossNetById (const TInt &CrossId) const |
TCrossNetI | GetCrossNetI (const int &Id) const |
Iterator over all crossnets. More... | |
TCrossNetI | BegCrossNetI () const |
TCrossNetI | EndCrossNetI () const |
TModeNetI | GetModeNetI (const int &Id) const |
Iterator over all modenets. More... | |
TModeNetI | BegModeNetI () const |
TModeNetI | EndModeNetI () const |
int | GetModeNets () |
Returns the number of modes in the multimodal network. More... | |
int | GetCrossNets () |
Returns the number of crossnets in the multimodal network. More... | |
PMMNet | GetSubgraphByCrossNet (TStrV &CrossNetTypes) |
Gets the induced subgraph given a vector of crossnet type names. More... | |
PMMNet | GetSubgraphByModeNet (TStrV &ModeNetTypes) |
Gets the induced subgraph given a vector of mode type names. More... | |
PNEANet | ToNetwork (TIntV &CrossNetTypes, TIntStrStrTrV &NodeAttrMap, TVec< TTriple< TInt, TStr, TStr > > &EdgeAttrMap) |
Converts multimodal network to TNEANet; as attr names can collide, AttrMap specifies the (Mode/Cross Id, old att name, new attr name) More... | |
PNEANet | ToNetwork2 (TIntV &CrossNetTypes, TIntStrPrVH &NodeAttrMap, THash< TInt, TVec< TPair< TStr, TStr > > > &EdgeAttrMap) |
Converts multimodal network to TNEANet; as attr names can collide, AttrMap specifies the Mode/Cross Id -> vec of pairs (old att name, new attr name) More... | |
PNEANetMP | ToNetworkMP (TStrV &CrossNetNames) |
Static Public Member Functions | |
static PMMNet | Load (TSIn &SIn) |
Loads the TMMNet from binary stream. More... | |
static PMMNet | New () |
Public Attributes | |
TCRef | CRef |
Private Member Functions | |
void | ClrNbr (const TInt &ModeId, const TInt &CrossNetId, const bool &outEdge, const bool &sameMode, bool &isDir) |
int | AddMode (const TStr &ModeName, const TInt &ModeId, const TModeNet &ModeNet) |
int | AddCrossNet (const TStr &CrossNetName, const TInt &CrossNetId, const TCrossNet &CrossNet) |
int | AddNodeAttributes (PNEANet &NewNet, TModeNet &Net, TVec< TPair< TStr, TStr > > &Attrs, int ModeId, int oldId, int NId) |
int | AddEdgeAttributes (PNEANet &NewNet, TCrossNet &Net, TVec< TPair< TStr, TStr > > &Attrs, int CrossId, int oldId, int EId) |
void | GetPartitionRanges (TIntPrV &Partitions, const TInt &NumPartitions, const TInt &MxVal) const |
Private Attributes | |
TInt | MxModeId |
TInt | MxCrossNetId |
Keeps track of the max mode id. More... | |
THash< TInt, TModeNet > | TModeNetH |
Keeps track of the max crossnet id. More... | |
THash< TInt, TCrossNet > | TCrossNetH |
THash< TInt, TStr > | ModeIdToNameH |
THash< TStr, TInt > | ModeNameToIdH |
THash< TInt, TStr > | CrossIdToNameH |
THash< TStr, TInt > | CrossNameToIdH |
Friends | |
class | TCrossNet |
class | TModeNet |
Multimodal networks.
Represents a multimodal network. A mutimodal network is represented by composing TModeNets (disjoint sets of nodes) and TCrossNets (disjoint sets of edges that connect nodes in two TModeNets). TMMNet contains methods to create TModeNets and TCrossNets by name, and returns pointers to them. All operations more granular than this, like adding nodes and edges, are run directly using methods provided in the ModeNets and CrossNets.
|
inline |
Definition at line 540 of file mmnet.h.
Referenced by Load(), and New().
|
inline |
Definition at line 541 of file mmnet.h.
|
inline |
Definition at line 543 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), TCrossNetH, and TModeNetH.
int TMMNet::AddCrossNet | ( | const TStr & | ModeName1, |
const TStr & | ModeName2, | ||
const TStr & | CrossNetName, | ||
bool | isDir = true |
||
) |
Adds a crossnet to the multimodal network. Specify modes by id or names; by default, crossnet is directed.
Definition at line 620 of file mmnet.cpp.
References GetModeId().
int TMMNet::AddCrossNet | ( | const TInt & | ModeId1, |
const TInt & | ModeId2, | ||
const TStr & | CrossNetName, | ||
bool | isDir = true |
||
) |
Definition at line 626 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), TModeNet::AddNbrType(), CrossIdToNameH, CrossNameToIdH, THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), MxCrossNetId, TCrossNet::SetParentPointer(), TCrossNet, TCrossNetH, and TModeNetH.
|
private |
Definition at line 714 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), CrossIdToNameH, CrossNameToIdH, and TCrossNetH.
|
private |
Definition at line 1276 of file mmnet.cpp.
References TCrossNet::FltType, TCrossNet::GetAttrTypeE(), TCrossNet::GetFltAttrDatE(), TCrossNet::GetIntAttrDatE(), TCrossNet::GetStrAttrDatE(), TCrossNet::IntType, and TCrossNet::StrType.
Referenced by ToNetwork2().
|
private |
Definition at line 705 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), ModeIdToNameH, ModeNameToIdH, and TModeNetH.
int TMMNet::AddModeNet | ( | const TStr & | ModeName | ) |
Adds a mode to the multimodal network.
Definition at line 605 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::IsKey(), ModeIdToNameH, ModeNameToIdH, MxModeId, TModeNet::SetParentPointer(), and TModeNetH.
|
private |
Definition at line 1249 of file mmnet.cpp.
References TNEANet::FltType, TModeNet::GetAttrTypeN(), TNEANet::GetFltAttrDatN(), TNEANet::GetIntAttrDatN(), TNEANet::GetIntVAttrDatN(), TNEANet::GetStrAttrDatN(), TNEANet::IntType, TNEANet::IntVType, and TNEANet::StrType.
Referenced by ToNetwork2().
|
inline |
Definition at line 590 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::BegI(), and TCrossNetH.
|
inline |
Definition at line 595 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::BegI(), and TModeNetH.
|
private |
Definition at line 723 of file mmnet.cpp.
References CrossIdToNameH, and TModeNetH.
Referenced by TCrossNet::Clr().
int TMMNet::DelCrossNet | ( | const TInt & | CrossNetId | ) |
Deletes a crossnet from the multimodal network.
Definition at line 645 of file mmnet.cpp.
References CrossIdToNameH, and THash< TKey, TDat, THashFunc >::GetDat().
Referenced by DelModeNet().
int TMMNet::DelCrossNet | ( | const TStr & | CrossNet | ) |
Definition at line 649 of file mmnet.cpp.
References CrossIdToNameH, CrossNameToIdH, TStr::CStr(), THash< TKey, TDat, THashFunc >::DelKey(), TStr::Fmt(), GetCrossNetById(), THash< TKey, TDat, THashFunc >::GetDat(), GetModeNetById(), IAssertR, THash< TKey, TDat, THashFunc >::IsKey(), TCrossNet::Mode1, TCrossNet::Mode2, TCrossNet::SetParentPointer(), and TCrossNetH.
int TMMNet::DelModeNet | ( | const TInt & | ModeId | ) |
Deletes a mode from the multimodal network.
Definition at line 664 of file mmnet.cpp.
References DelCrossNet(), THash< TKey, TDat, THashFunc >::DelKey(), TModeNet::GetCrossNetNames(), THash< TKey, TDat, THashFunc >::GetDat(), GetModeNetById(), TVec< TVal, TSizeTy >::Len(), ModeIdToNameH, ModeNameToIdH, TModeNet::SetParentPointer(), and TModeNetH.
Referenced by DelModeNet().
int TMMNet::DelModeNet | ( | const TStr & | ModeName | ) |
Definition at line 680 of file mmnet.cpp.
References TStr::CStr(), DelModeNet(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), IAssertR, THash< TKey, TDat, THashFunc >::IsKey(), and ModeNameToIdH.
|
inline |
Definition at line 591 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::EndI(), and TCrossNetH.
|
inline |
Definition at line 596 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::EndI(), and TModeNetH.
|
inline |
Gets the crossnet id from the crossnet name.
Definition at line 576 of file mmnet.h.
References CrossNameToIdH, THash< TKey, TDat, THashFunc >::GetDat(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by ToNetworkMP().
Gets the crossnet name from the crossnet id.
Definition at line 578 of file mmnet.h.
References CrossIdToNameH, THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by TCrossNet::AddEdge(), TModeNet::AddNeighbor(), TCrossNet::DelEdge(), TModeNet::DelNeighbor(), and TMMNet::TCrossNetI::GetCrossName().
Definition at line 699 of file mmnet.cpp.
Referenced by DelCrossNet(), TMMNet::TCrossNetI::GetCrossNet(), GetCrossNetByName(), ToNetwork(), and ToNetwork2().
Gets a reference to the crossnet.
Definition at line 695 of file mmnet.cpp.
References CrossNameToIdH, GetCrossNetById(), and THash< TKey, TDat, THashFunc >::GetDat().
Referenced by TModeNet::Clr(), TModeNet::DelNode(), and ToNetworkMP().
|
inline |
Iterator over all crossnets.
Definition at line 589 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::GetI(), and TCrossNetH.
|
inline |
Returns the number of crossnets in the multimodal network.
Definition at line 601 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::Len(), and TCrossNetH.
|
inline |
Gets the mode id from the mode name.
Definition at line 572 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and ModeNameToIdH.
Referenced by AddCrossNet().
Gets the mode name from the mode id.
Definition at line 574 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetNullStr(), THash< TKey, TDat, THashFunc >::IsKey(), and ModeIdToNameH.
Referenced by TMMNet::TModeNetI::GetModeName().
Definition at line 690 of file mmnet.cpp.
Referenced by DelCrossNet(), TCrossNet::DelEdge(), DelModeNet(), TMMNet::TModeNetI::GetModeNet(), GetModeNetByName(), ToNetwork(), ToNetwork2(), and ToNetworkMP().
Gets a reference to the modenet.
Definition at line 685 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::GetDat(), GetModeNetById(), and ModeNameToIdH.
|
inline |
Iterator over all modenets.
Definition at line 594 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::GetI(), and TModeNetH.
|
inline |
Returns the number of modes in the multimodal network.
Definition at line 599 of file mmnet.h.
References THash< TKey, TDat, THashFunc >::Len(), and TModeNetH.
|
private |
Definition at line 1052 of file mmnet.cpp.
References TVec< TVal, TSizeTy >::Add().
Referenced by ToNetworkMP().
Gets the induced subgraph given a vector of crossnet type names.
Definition at line 728 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::BegI(), CrossNameToIdH, THash< TKey, TDat, THashFunc >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TModeNet::ModeId, ModeIdToNameH, New(), TCrossNetH, and TModeNetH.
Referenced by GetSubgraphByModeNet().
Gets the induced subgraph given a vector of mode type names.
Definition at line 771 of file mmnet.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::BegI(), CrossIdToNameH, THash< TKey, TDat, THashFunc >::EndI(), THash< TKey, TDat, THashFunc >::GetDat(), GetSubgraphByCrossNet(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TCrossNet::Mode1, TCrossNet::Mode2, TModeNet::ModeId, ModeIdToNameH, ModeNameToIdH, TCrossNetH, and TModeNetH.
|
inlinestatic |
Definition at line 569 of file mmnet.h.
References TMMNet().
Referenced by GetSubgraphByCrossNet().
|
inline |
Saves the TMMNet to binary stream.
Definition at line 564 of file mmnet.h.
References CrossIdToNameH, CrossNameToIdH, ModeIdToNameH, ModeNameToIdH, MxCrossNetId, MxModeId, THash< TKey, TDat, THashFunc >::Save(), TInt::Save(), TCrossNetH, and TModeNetH.
PNEANet TMMNet::ToNetwork | ( | TIntV & | CrossNetTypes, |
TIntStrStrTrV & | NodeAttrMap, | ||
TVec< TTriple< TInt, TStr, TStr > > & | EdgeAttrMap | ||
) |
Converts multimodal network to TNEANet; as attr names can collide, AttrMap specifies the (Mode/Cross Id, old att name, new attr name)
Definition at line 803 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), TCrossNet::BegEdgeI(), THash< TKey, TDat, THashFunc >::BegI(), THashSet< TKey, THashFunc >::BegI(), TModeNet::BegMMNI(), TCrossNet::EndEdgeI(), THash< TKey, TDat, THashFunc >::EndI(), THashSet< TKey, THashFunc >::EndI(), TModeNet::EndMMNI(), TCrossNet::FltType, TNEANet::FltType, TCrossNet::GetAttrTypeE(), TModeNet::GetAttrTypeN(), GetCrossNetById(), THash< TKey, TDat, THashFunc >::GetDat(), TCrossNet::GetFltAttrDatE(), TNEANet::GetFltAttrDatN(), TCrossNet::GetFltAttrDefaultE(), TNEANet::GetFltAttrDefaultN(), TCrossNet::GetIntAttrDatE(), TNEANet::GetIntAttrDatN(), TCrossNet::GetIntAttrDefaultE(), TNEANet::GetIntAttrDefaultN(), TNEANet::GetIntVAttrDatN(), TCrossNet::GetMode1(), TCrossNet::GetMode2(), GetModeNetById(), TCrossNet::GetStrAttrDatE(), TNEANet::GetStrAttrDatN(), TCrossNet::GetStrAttrDefaultE(), TNEANet::GetStrAttrDefaultN(), TCrossNet::IntType, TNEANet::IntType, TNEANet::IntVType, TCrossNet::IsDirected(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TNEANet::New(), TCrossNet::StrType, and TNEANet::StrType.
PNEANet TMMNet::ToNetwork2 | ( | TIntV & | CrossNetTypes, |
TIntStrPrVH & | NodeAttrMap, | ||
THash< TInt, TVec< TPair< TStr, TStr > > > & | EdgeAttrMap | ||
) |
Converts multimodal network to TNEANet; as attr names can collide, AttrMap specifies the Mode/Cross Id -> vec of pairs (old att name, new attr name)
Definition at line 965 of file mmnet.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), AddEdgeAttributes(), THashSet< TKey, THashFunc >::AddKey(), AddNodeAttributes(), TCrossNet::BegEdgeI(), THashSet< TKey, THashFunc >::BegI(), TModeNet::BegMMNI(), TCrossNet::EndEdgeI(), THashSet< TKey, THashFunc >::EndI(), TModeNet::EndMMNI(), GetCrossNetById(), THash< TKey, TDat, THashFunc >::GetDat(), TVec< TVal, TSizeTy >::GetDat(), TCrossNet::GetMode1(), TCrossNet::GetMode2(), GetModeNetById(), TCrossNet::IsDirected(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), and TNEANet::New().
Definition at line 1070 of file mmnet.cpp.
References TVec< TVal, TSizeTy >::Add(), THashMP< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), TVec< TVal, TSizeTy >::AddV(), THashSet< TKey, THashFunc >::BegI(), edge, THashSet< TKey, THashFunc >::EndI(), GetCrossId(), GetCrossNetByName(), THashMP< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetDat(), TCrossNet::TCrossEdgeI::GetDstNId(), TCrossNet::GetEdge(), TCrossNet::GetEdgeI(), TCrossNet::GetEdges(), THashMP< TKey, TDat, THashFunc >::GetKeyV(), THash< TKey, TDat, THashFunc >::GetKeyV(), TCrossNet::GetMode1(), TCrossNet::GetMode2(), GetModeNetById(), TCrossNet::GetMxEId(), TModeNet::GetNeighborsByCrossNet(), TNEANet::GetNodes(), GetPartitionRanges(), TCrossNet::TCrossEdge::GetSrcNId(), TCrossNet::TCrossEdgeI::GetSrcNId(), TPair< TVal1, TVal2 >::GetVal1(), TPair< TVal1, TVal2 >::GetVal2(), TCrossNet::IsDirected(), TCrossNet::IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), TNEANet::IsNode(), TVec< TVal, TSizeTy >::Len(), TCrossNet::MxEId, TModeNet::NeighborTypes, TNEANetMP::New(), and TNEANet::NodeH.
|
friend |
Definition at line 536 of file mmnet.h.
Referenced by AddCrossNet().
Definition at line 532 of file mmnet.h.
Referenced by AddCrossNet(), ClrNbr(), DelCrossNet(), GetCrossName(), GetSubgraphByModeNet(), and Save().
Definition at line 533 of file mmnet.h.
Referenced by AddCrossNet(), DelCrossNet(), GetCrossId(), GetCrossNetByName(), GetSubgraphByCrossNet(), and Save().
Definition at line 529 of file mmnet.h.
Referenced by AddMode(), AddModeNet(), DelModeNet(), GetModeName(), GetSubgraphByCrossNet(), GetSubgraphByModeNet(), and Save().
Definition at line 530 of file mmnet.h.
Referenced by AddMode(), AddModeNet(), DelModeNet(), GetModeId(), GetModeNetByName(), GetSubgraphByModeNet(), and Save().
|
private |
Keeps track of the max mode id.
Definition at line 525 of file mmnet.h.
Referenced by AddCrossNet(), and Save().
|
private |
Definition at line 524 of file mmnet.h.
Referenced by AddModeNet(), and Save().
Definition at line 527 of file mmnet.h.
Referenced by AddCrossNet(), BegCrossNetI(), DelCrossNet(), EndCrossNetI(), GetCrossNetI(), GetCrossNets(), GetSubgraphByCrossNet(), GetSubgraphByModeNet(), Save(), and TMMNet().
Keeps track of the max crossnet id.
Definition at line 526 of file mmnet.h.
Referenced by AddCrossNet(), TCrossNet::AddEdge(), AddMode(), AddModeNet(), BegModeNetI(), ClrNbr(), DelModeNet(), EndModeNetI(), GetModeNetI(), GetModeNets(), GetSubgraphByCrossNet(), GetSubgraphByModeNet(), Save(), and TMMNet().