SNAP Library 4.0, Developer Reference
2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Hash-Table with multiprocessing support. More...
#include <hashmp.h>
Classes | |
class | THashMPKeyDatCmp |
Public Types | |
enum | { HashPrimes =32 } |
typedef THashMPKeyDatI< TKey, TDat > | TIter |
Public Member Functions | |
THashMP () | |
THashMP (const THashMP &PHash) | |
THashMP (const int &ExpectVals) | |
THashMP (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
THashMP & | operator= (const THashMP &Hash) |
bool | operator== (const THashMP &Hash) const |
const TDat & | operator[] (const int &KeyId) const |
TDat & | operator[] (const int &KeyId) |
TDat & | operator() (const TKey &Key) |
::TSize | GetMemUsed () const |
TIter | BegI () const |
TIter | EndI () const |
TIter | GetI (const TKey &Key) const |
void | Gen (const int &ExpectVals) |
void | Clr (const bool &DoDel=true) |
bool | Empty () const |
int | Len () const |
void | SetLen (const int &Length) |
int | GetMxKeyIds () const |
int | GetReservedKeyIds () const |
int | AddKey (const TKey &Key) |
int | AddKey11 (const int &Idx, const TKey &Key, bool &Found) |
int | AddKey12 (const int &Idx, const TKey &Key, bool &Found) |
int | AddKey13 (const int &Idx, const TKey &Key) |
int | AddKey1 (const TKey &Key, bool &Found) |
int | AddKey2 (const int &Idx, const TKey &Key, bool &Found) |
TDat & | AddDatId (const TKey &Key) |
TDat & | AddDat (const TKey &Key) |
TDat & | AddDat (const TKey &Key, const TDat &Dat) |
const TKey & | GetKey (const int &KeyId) const |
int | GetKeyId (const TKey &Key) const |
int | GetRndKeyId (TRnd &Rnd) const |
Get an index of a random element. If the hash table has many deleted keys, this may take a long time. More... | |
int | GetRndKeyId (TRnd &Rnd, const double &EmptyFrac) |
Get an index of a random element. If the hash table has many deleted keys, defrag the hash table first (that's why the function is non-const). More... | |
bool | IsKey (const TKey &Key) const |
bool | IsKey (const TKey &Key, int &KeyId) const |
bool | IsKeyId (const int &KeyId) const |
const TDat & | GetDat (const TKey &Key) const |
TDat & | GetDat (const TKey &Key) |
void | GetKeyDat (const int &KeyId, TKey &Key, TDat &Dat) const |
bool | IsKeyGetDat (const TKey &Key, TDat &Dat) const |
int | FFirstKeyId () const |
bool | FNextKeyId (int &KeyId) const |
void | GetKeyV (TVec< TKey > &KeyV) const |
void | GetDatV (TVec< TDat > &DatV) const |
void | GetKeyDatPrV (TVec< TPair< TKey, TDat > > &KeyDatPrV) const |
void | GetDatKeyPrV (TVec< TPair< TDat, TKey > > &DatKeyPrV) const |
void | GetKeyDatKdV (TVec< TKeyDat< TKey, TDat > > &KeyDatKdV) const |
void | GetDatKeyKdV (TVec< TKeyDat< TDat, TKey > > &DatKeyKdV) const |
void | Swap (THashMP &Hash) |
void | Pack () |
Static Public Attributes | |
static const unsigned int | HashPrimeT [HashPrimes] |
Private Types | |
typedef THashMPKeyDat< TKey, TDat > | TPHKeyDat |
typedef TPair< TKey, TDat > | TKeyDatP |
Private Member Functions | |
TPHKeyDat & | GetPHashKeyDat (const int &KeyId) |
const TPHKeyDat & | GetPHashKeyDat (const int &KeyId) const |
uint | GetNextPrime (const uint &Val) const |
Private Attributes | |
TVec< TPHKeyDat > | Table |
TInt | NumVals |
Hash-Table with multiprocessing support.
typedef THashMPKeyDatI<TKey, TDat> THashMP< TKey, TDat, THashFunc >::TIter |
|
private |
anonymous enum |
|
inline |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Definition at line 181 of file hashmp.h.
Referenced by TNEANetMP::AddEdge(), TNEANetMP::AddFltAttrE(), TNEANetMP::AddFltAttrN(), TNEANetMP::AddIntAttrE(), TNEANetMP::AddIntAttrN(), TNGraphMP::AddNode(), TNEANetMP::AddNode(), TNGraphMP::AddNodeUnchecked(), TNEANetMP::AddStrAttrE(), TNEANetMP::AddStrAttrN(), THashMP< TInt, TEdge >::operator()(), TMMNet::ToNetworkMP(), and TTable::UpdateGrouping().
|
inline |
|
inline |
int THashMP< TKey, TDat, THashFunc >::AddKey | ( | const TKey & | Key | ) |
Definition at line 259 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::AddDat(), and THashMP< TInt, TEdge >::AddDatId().
int THashMP< TKey, TDat, THashFunc >::AddKey1 | ( | const TKey & | Key, |
bool & | Found | ||
) |
int THashMP< TKey, TDat, THashFunc >::AddKey11 | ( | const int & | Idx, |
const TKey & | Key, | ||
bool & | Found | ||
) |
int THashMP< TKey, TDat, THashFunc >::AddKey12 | ( | const int & | Idx, |
const TKey & | Key, | ||
bool & | Found | ||
) |
Definition at line 307 of file hashmp.h.
Referenced by TNGraphMP::AddInEdge1(), and TNGraphMP::AddOutEdge1().
int THashMP< TKey, TDat, THashFunc >::AddKey13 | ( | const int & | Idx, |
const TKey & | Key | ||
) |
Definition at line 358 of file hashmp.h.
Referenced by TNEANetMP::AddEdgeUnchecked(), TNGraphMP::AddNodeWithEdges(), and TNEANetMP::AddNodeWithEdges().
int THashMP< TKey, TDat, THashFunc >::AddKey2 | ( | const int & | Idx, |
const TKey & | Key, | ||
bool & | Found | ||
) |
|
inline |
Definition at line 153 of file hashmp.h.
Referenced by TTable::Aggregate(), TNEANetMP::BegEI(), TNGraphMP::BegNI(), and TNEANetMP::BegNI().
void THashMP< TKey, TDat, THashFunc >::Clr | ( | const bool & | DoDel = true | ) |
Definition at line 474 of file hashmp.h.
Referenced by TNGraphMP::Clr(), and TNEANetMP::Clr().
|
inline |
|
inline |
Definition at line 156 of file hashmp.h.
Referenced by TTable::Aggregate(), TNEANetMP::EndEI(), TNGraphMP::EndNI(), and TNEANetMP::EndNI().
|
inline |
Definition at line 207 of file hashmp.h.
Referenced by TNGraphMP::Defrag(), TNEANetMP::Defrag(), TNGraphMP::Dump(), TNGraphMP::GetEdges(), TNEANetMP::GetEIdV(), TNGraphMP::GetNIdV(), TNEANetMP::GetNIdV(), TNGraphMP::IsOk(), and TNEANetMP::IsOk().
bool THashMP< TKey, TDat, THashFunc >::FNextKeyId | ( | int & | KeyId | ) | const |
Definition at line 484 of file hashmp.h.
Referenced by TNGraphMP::Defrag(), TNEANetMP::Defrag(), TNGraphMP::Dump(), TNGraphMP::GetEdges(), TNEANetMP::GetEIdV(), TNGraphMP::GetNIdV(), TNEANetMP::GetNIdV(), TNGraphMP::IsOk(), and TNEANetMP::IsOk().
|
inline |
Definition at line 160 of file hashmp.h.
Referenced by TTable::GroupByIntColMP(), TNGraphMP::Reserve(), TNEANetMP::Reserve(), TNEANetMP::ReserveAttr(), and THashMP< TInt, TEdge >::THashMP().
|
inline |
Definition at line 195 of file hashmp.h.
Referenced by TTable::Aggregate(), TNEANetMP::GetEdge(), TNEANetMP::GetFltAttrDefaultE(), TNEANetMP::GetFltAttrDefaultN(), TNEANetMP::GetIntAttrDefaultE(), TNEANetMP::GetIntAttrDefaultN(), TNGraphMP::GetNode(), TNEANetMP::GetNode(), TNEANetMP::GetStrAttrDefaultE(), TNEANetMP::GetStrAttrDefaultN(), THashMP< TKey, TDat, THashFunc >::operator==(), TMMNet::ToNetworkMP(), TTable::UpdateFltFromTableMP(), and TTable::UpdateGrouping().
|
inline |
void THashMP< TKey, TDat, THashFunc >::GetDatKeyKdV | ( | TVec< TKeyDat< TDat, TKey > > & | DatKeyKdV | ) | const |
Definition at line 539 of file hashmp.h.
void THashMP< TKey, TDat, THashFunc >::GetDatKeyPrV | ( | TVec< TPair< TDat, TKey > > & | DatKeyPrV | ) | const |
Definition at line 517 of file hashmp.h.
void THashMP< TKey, TDat, THashFunc >::GetDatV | ( | TVec< TDat > & | DatV | ) | const |
Definition at line 498 of file hashmp.h.
References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().
|
inline |
Definition at line 158 of file hashmp.h.
Referenced by TNEANetMP::GetEI(), TNGraphMP::GetNI(), and TNEANetMP::GetNI().
|
inline |
Definition at line 185 of file hashmp.h.
Referenced by TNEANetMP::GetEIdV(), TNGraphMP::GetNIdV(), TNEANetMP::GetNIdV(), TNEANetMP::GetRndEId(), TNGraphMP::GetRndNId(), and TNEANetMP::GetRndNId().
|
inline |
void THashMP< TKey, TDat, THashFunc >::GetKeyDatKdV | ( | TVec< TKeyDat< TKey, TDat > > & | KeyDatKdV | ) | const |
Definition at line 528 of file hashmp.h.
void THashMP< TKey, TDat, THashFunc >::GetKeyDatPrV | ( | TVec< TPair< TKey, TDat > > & | KeyDatPrV | ) | const |
Definition at line 506 of file hashmp.h.
int THashMP< TKey, TDat, THashFunc >::GetKeyId | ( | const TKey & | Key | ) | const |
Definition at line 459 of file hashmp.h.
Referenced by TNEANetMP::AddEdge(), TNEANetMP::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatN(), TNGraphMP::AddInEdge2(), TNEANetMP::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatN(), TNEANetMP::AddNode(), TNGraphMP::AddOutEdge2(), TNEANetMP::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatN(), TNEANetMP::DelAttrDatE(), TNEANetMP::DelAttrDatN(), TNEANetMP::EdgeAttrIsFltDeleted(), TNEANetMP::EdgeAttrIsIntDeleted(), TNEANetMP::EdgeAttrIsStrDeleted(), TNEANetMP::FltAttrValueNI(), THashMP< TInt, TEdge >::GetDat(), TNEANetMP::GetEAFltI(), TNEANetMP::GetEAIntI(), TNEANetMP::GetEAStrI(), TNEANetMP::GetEdgeAttrValue(), TNEANetMP::GetFltAttrDatE(), TNEANetMP::GetFltAttrDatN(), TNEANetMP::GetFltKeyIdE(), THashMP< TInt, TEdge >::GetI(), TNEANetMP::GetIntAttrDatE(), TNEANetMP::GetIntAttrDatN(), TNEANetMP::GetIntAttrIndDatE(), TNEANetMP::GetIntAttrIndDatN(), TNEANetMP::GetNAFltI(), TNEANetMP::GetNAIntI(), TNEANetMP::GetNAStrI(), TNEANetMP::GetNodeAttrValue(), TNEANetMP::GetStrAttrDatE(), TNEANetMP::GetStrAttrDatN(), TNEANetMP::IntAttrValueNI(), THashMP< TInt, TEdge >::IsKey(), TNEANetMP::NodeAttrIsFltDeleted(), TNEANetMP::NodeAttrIsIntDeleted(), TNEANetMP::NodeAttrIsStrDeleted(), and TNEANetMP::StrAttrValueNI().
void THashMP< TKey, TDat, THashFunc >::GetKeyV | ( | TVec< TKey > & | KeyV | ) | const |
Definition at line 490 of file hashmp.h.
References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().
Referenced by TNEANetMP::AddEdge(), TNEANetMP::AddNode(), and TMMNet::ToNetworkMP().
|
inline |
|
inline |
|
private |
Definition at line 236 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::Gen().
|
inlineprivate |
Definition at line 108 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::GetKey(), THashMP< TInt, TEdge >::GetKeyDat(), THashMP< TInt, TEdge >::IsKeyGetDat(), and THashMP< TInt, TEdge >::operator[]().
|
inlineprivate |
|
inline |
Definition at line 169 of file hashmp.h.
Referenced by TNGraphMP::Reserved(), TNEANetMP::Reserved(), and TNEANetMP::ReservedE().
int THashMP< TKey, TDat, THashFunc >::GetRndKeyId | ( | TRnd & | Rnd | ) | const |
Get an index of a random element. If the hash table has many deleted keys, this may take a long time.
Definition at line 558 of file hashmp.h.
Referenced by TNEANetMP::GetRndEId(), TNGraphMP::GetRndNId(), and TNEANetMP::GetRndNId().
|
inline |
Definition at line 191 of file hashmp.h.
Referenced by TNEANetMP::AddFltAttrE(), TNEANetMP::AddFltAttrN(), TNEANetMP::AddIntAttrE(), TNEANetMP::AddIntAttrN(), TNEANetMP::AddStrAttrE(), TNEANetMP::AddStrAttrN(), TNEANetMP::GetFltAttrDefaultE(), TNEANetMP::GetFltAttrDefaultN(), TNEANetMP::GetIntAttrDefaultE(), TNEANetMP::GetIntAttrDefaultN(), TNEANetMP::GetStrAttrDefaultE(), TNEANetMP::GetStrAttrDefaultN(), TNEANetMP::IsEdge(), THashMP< TInt, TEdge >::IsKeyGetDat(), TNGraphMP::IsNode(), TNEANetMP::IsNode(), THashMP< TKey, TDat, THashFunc >::operator==(), TTable::UpdateFltFromTableMP(), and TTable::UpdateGrouping().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 165 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::BegI(), THashMP< TInt, TEdge >::Empty(), TNEANetMP::GetEdges(), TNGraphMP::GetNodes(), TNEANetMP::GetNodes(), and THashMP< TKey, TDat, THashFunc >::operator==().
|
inline |
|
inline |
|
inline |
bool THashMP< TKey, TDat, THashFunc >::operator== | ( | const THashMP< TKey, TDat, THashFunc > & | Hash | ) | const |
Definition at line 248 of file hashmp.h.
References THashMP< TKey, TDat, THashFunc >::GetDat(), THashMP< TKey, TDat, THashFunc >::IsKey(), and THashMP< TKey, TDat, THashFunc >::Len().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 129 of file hashmp.h.
Referenced by TNGraphMP::Save(), and TNEANetMP::Save().
|
inline |
Definition at line 166 of file hashmp.h.
Referenced by TNEANetMP::SetEdges(), TNGraphMP::SetNodes(), and TNEANetMP::SetNodes().
void THashMP< TKey, TDat, THashFunc >::Swap | ( | THashMP< TKey, TDat, THashFunc > & | Hash | ) |
Definition at line 550 of file hashmp.h.
References THashMP< TKey, TDat, THashFunc >::NumVals, Swap(), and THashMP< TKey, TDat, THashFunc >::Table.
|
static |
|
private |
Definition at line 91 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::Len(), THashMP< TInt, TEdge >::Load(), THashMP< TInt, TEdge >::operator=(), THashMP< TInt, TEdge >::Save(), THashMP< TInt, TEdge >::SetLen(), and THashMP< TKey, TDat, THashFunc >::Swap().
|
private |
Definition at line 90 of file hashmp.h.
Referenced by THashMP< TInt, TEdge >::AddDat(), THashMP< TInt, TEdge >::AddDatId(), THashMP< TInt, TEdge >::BegI(), THashMP< TInt, TEdge >::EndI(), THashMP< TInt, TEdge >::Gen(), THashMP< TInt, TEdge >::GetDat(), THashMP< TInt, TEdge >::GetI(), THashMP< TInt, TEdge >::GetMemUsed(), THashMP< TInt, TEdge >::GetMxKeyIds(), THashMP< TInt, TEdge >::GetPHashKeyDat(), THashMP< TInt, TEdge >::GetReservedKeyIds(), THashMP< TInt, TEdge >::IsKeyId(), THashMP< TInt, TEdge >::Load(), THashMP< TInt, TEdge >::operator=(), THashMP< TInt, TEdge >::Pack(), THashMP< TInt, TEdge >::Save(), and THashMP< TKey, TDat, THashFunc >::Swap().