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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
THash< TKey, TDat, THashFunc > Class Template Reference

#include <hash.h>

Collaboration diagram for THash< TKey, TDat, THashFunc >:

Classes

class  THashKeyDatCmp
 
class  TLoadTHKeyDatInitializer
 

Public Types

enum  { HashPrimes =32 }
 
typedef THashKeyDatI< TKey, TDat > TIter
 

Public Member Functions

 THash ()
 
 THash (const THash &Hash)
 
 THash (const int &ExpectVals, const bool &_AutoSizeP=false)
 
 THash (TSIn &SIn)
 
void LoadShM (TShMIn &ShMIn)
 Load THash from shared memory file. Copying/Deleting Keys is illegal. More...
 
template<typename TDatInitFn >
void LoadShM (TShMIn &ShMIn, TDatInitFn Fn)
 Load THash from shared memory passing in the Dat initializer. More...
 
void Load (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm="")
 
void SaveXml (TSOut &SOut, const TStr &Nm)
 
THashoperator= (const THash &Hash)
 
bool operator== (const THash &Hash) const
 
bool operator< (const THash &Hash) const
 
const TDat & operator[] (const int &KeyId) const
 The [] operator takes KeyId, use GetDat() if you need value access via the key. More...
 
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, const int &NoDelLim=-1, const bool &ResetDat=true)
 
bool Empty () const
 
int Len () const
 
int GetPorts () const
 
bool IsAutoSize () const
 
int GetMxKeyIds () const
 
int GetReservedKeyIds () const
 
bool IsKeyIdEqKeyN () const
 
int AddKey (const TKey &Key)
 
TDat & AddDatId (const TKey &Key)
 
TDat & AddDat (const TKey &Key)
 
TDat & AddDat (const TKey &Key, const TDat &Dat)
 
void DelKey (const TKey &Key)
 
bool DelIfKey (const TKey &Key)
 
void DelKeyId (const int &KeyId)
 
void DelKeyIdV (const TIntV &KeyIdV)
 
void MarkDelKey (const TKey &Key)
 
void MarkDelKeyId (const int &KeyId)
 
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)
 
TDat GetDatWithDefault (const TKey &Key, TDat DefaultValue)
 
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 (THash &Hash)
 
void Defrag ()
 
void Pack ()
 
void Sort (const bool &CmpKey, const bool &Asc)
 
void SortByKey (const bool &Asc=true)
 
void SortByDat (const bool &Asc=true)
 

Static Public Attributes

static const unsigned int HashPrimeT [HashPrimes]
 

Private Types

typedef THashKeyDat< TKey, TDat > THKeyDat
 
typedef TPair< TKey, TDat > TKeyDatP
 

Private Member Functions

THKeyDatGetHashKeyDat (const int &KeyId)
 
const THKeyDatGetHashKeyDat (const int &KeyId) const
 
uint GetNextPrime (const uint &Val) const
 
void Resize ()
 

Private Attributes

TIntV PortV
 
TVec< THKeyDatKeyDatV
 
TBool AutoSizeP
 
TInt FFreeKeyId
 
TInt FreeKeys
 

Detailed Description

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
class THash< TKey, TDat, THashFunc >

Definition at line 97 of file hash.h.

Member Typedef Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
typedef THashKeyDat<TKey, TDat> THash< TKey, TDat, THashFunc >::THKeyDat
private

Definition at line 104 of file hash.h.

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
typedef THashKeyDatI<TKey, TDat> THash< TKey, TDat, THashFunc >::TIter

Definition at line 102 of file hash.h.

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
typedef TPair<TKey, TDat> THash< TKey, TDat, THashFunc >::TKeyDatP
private

Definition at line 105 of file hash.h.

Member Enumeration Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
anonymous enum
Enumerator
HashPrimes 

Definition at line 99 of file hash.h.

99 {HashPrimes=32};

Constructor & Destructor Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( )
inline

Definition at line 145 of file hash.h.

145  :
146  PortV(), KeyDatV(),
147  AutoSizeP(true), FFreeKeyId(-1), FreeKeys(0){}
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( const THash< TKey, TDat, THashFunc > &  Hash)
inline

Definition at line 148 of file hash.h.

148  :
149  PortV(Hash.PortV), KeyDatV(Hash.KeyDatV), AutoSizeP(Hash.AutoSizeP),
150  FFreeKeyId(Hash.FFreeKeyId), FreeKeys(Hash.FreeKeys){}
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey , class TDat , class THashFunc >
THash< TKey, TDat, THashFunc >::THash ( const int &  ExpectVals,
const bool &  _AutoSizeP = false 
)
explicit

Definition at line 343 of file hash.h.

References THash< TKey, TDat, THashFunc >::PortV, and TVec< TVal, TSizeTy >::PutAll().

343  :
344  PortV(GetNextPrime(ExpectVals/2)), KeyDatV(ExpectVals, 0),
345  AutoSizeP(_AutoSizeP), FFreeKeyId(-1), FreeKeys(0){
346  PortV.PutAll(TInt(-1));
347 }
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
uint GetNextPrime(const uint &Val) const
Definition: hash.h:307
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the call graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( TSIn SIn)
inlineexplicit

Definition at line 152 of file hash.h.

152  :
153  PortV(SIn), KeyDatV(SIn),
154  AutoSizeP(SIn), FFreeKeyId(SIn), FreeKeys(SIn){
155  SIn.LoadCs();}
virtual void LoadCs()
Definition: fl.cpp:28
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Member Function Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDat ( const TKey &  Key)
inline

Definition at line 238 of file hash.h.

Referenced by TCascade::Add(), TUnionFind::Add(), TNIBs::AddCasc(), TTable::AddColType(), TMMNet::AddCrossNet(), TNIBs::AddDomainNm(), TCrossNet::AddEdge(), TNEGraph::AddEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::AddEdge(), TNEANet::AddEdge(), THttpRq::AddFldVal(), THttpResp::AddFldVal(), TCrossNet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatE(), TNEANet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatN(), TNEANet::AddFltAttrDatN(), TCrossNet::AddFltAttrE(), TNEANetMP::AddFltAttrE(), TNEANet::AddFltAttrE(), TNEANetMP::AddFltAttrN(), TNEANet::AddFltAttrN(), THttpResp::AddHdFld(), TTable::AddIdColumn(), TCrossNet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatE(), TNEANet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatN(), TNEANet::AddIntAttrDatN(), TCrossNet::AddIntAttrE(), TNEANetMP::AddIntAttrE(), TNEANet::AddIntAttrE(), TNEANetMP::AddIntAttrN(), TNEANet::AddIntAttrN(), TModeNet::AddIntVAttrByHashN(), TModeNet::AddIntVAttrByVecN(), TNEANet::AddIntVAttrDatE(), TNEANet::AddIntVAttrDatN(), TNEANet::AddIntVAttrE(), TNEANet::AddIntVAttrN(), TTable::AddJointRow(), TMMNet::AddMode(), TMMNet::AddModeNet(), TModeNet::AddNbrType(), TTable::AddNJointRowsMP(), TUNGraph::AddNode(), TNGraph::AddNode(), TNEGraph::AddNode(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNode(), TNEANet::AddNode(), TUndirNet::AddNode(), TDirNet::AddNode(), TNetInfBs::AddNodeNm(), TNIBs::AddNodeNm(), TUNGraph::AddNodeUnchecked(), TNGraph::AddNodeUnchecked(), TNodeEdgeNet< TNodeData, TEdgeData >::AddNodeUnchecked(), TNEANet::AddNodeUnchecked(), TUndirNet::AddNodeUnchecked(), TDirNet::AddNodeUnchecked(), TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat::AddQ(), TILx::AddRw(), TOLx::AddRw(), TAttr::AddSAttr(), TAttrPair::AddSAttr(), TAttr::AddSAttrDat(), TAttrPair::AddSAttrDat(), TCrossNet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatE(), TNEANet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatN(), TNEANet::AddStrAttrDatN(), TCrossNet::AddStrAttrE(), TNEANetMP::AddStrAttrE(), TNEANet::AddStrAttrE(), TNEANetMP::AddStrAttrN(), TNEANet::AddStrAttrN(), TTable::Aggregate(), TLocClust::ApproxPageRank(), TGStat::AvgGStat(), TLocClustStat::BagOfWhiskers(), TLocClustStat::BagOfWhiskers2(), TNIBs::BSG(), TForestFire::BurnExpFire(), TForestFire::BurnGeoFire(), TTable::CheckAndAddFltNode(), TSnap::TSnapDetail::TCNMQMatrix::CmtyCMN(), TSnap::CmtyEvolutionFileBatch(), TSnap::CmtyEvolutionFileBatchV(), TSnap::CommunityGirvanNewman(), TAGMUtil::ConnectCmtyVV(), CreateEmptyFeatures(), CreateNodeIdMtxIdxHash(), TMom::Def(), TTable::Defrag(), TArtPointVisitor::DiscoverNode(), TBiConVisitor::DiscoverNode(), TSccVisitor< PGraph, OnlyCount >::DiscoverNode(), TLocClust::DrawWhiskers(), TSpecFunc::EntropyBias(), TSnap::EventImportance(), TSnap::EventImportance1(), TSnap::FastCorePeriphery(), TSnap::FastCorePeripheryGC(), TNIBs::FG(), TZipIn::FillFExtToCmdH(), TZipOut::FillFExtToCmdH(), TCesnaUtil::FilterLowEntropy(), FindRoles(), TSccVisitor< PGraph, OnlyCount >::FinishNode(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), TSnap::GetBetweennessCentr(), TSnap::GetBfsEffDiam(), TSnap::GetBiConSzCnt(), TSnap::GetClustCf(), TAGMFast::GetCmtyVV(), TCoda::GetCmtyVV(), TAGMFit::GetCmtyVV(), TCesna::GetCmtyVV(), TSnap::GetDegCnt(), TCnCom::GetDfsVisitor(), TSnap::GetEigenVectorCentr(), TSnap::GetGroupDegreeCentr(), TSnap::GetGroupDegreeCentr0(), TSnap::GetHits(), TSnap::GetHitsMP(), TSnap::GetInDegCnt(), GetNIdSorted(), TCoda::GetNIDValH(), TSnap::GetNodeClustCf(), TAGMUtil::GetNodeMembership(), TSnap::GetNodesAtHops(), TGraphEnumUtils::GetNormalizedMap(), TSnap::GetOutDegCnt(), TSnap::GetPageRank(), TSnap::GetPageRank_v1(), TSnap::GetPageRankMP(), TMaxPriorityQueue< TVal >::GetPriorities(), TLxSymStr::GetSSym(), TBigNet< TNodeData, IsDir >::GetSubGraph(), TMMNet::GetSubgraphByCrossNet(), TMMNet::GetSubgraphByModeNet(), TXmlObjSer::GetTagNm(), TCoda::GetTopCIDs(), TSnap::GetTriadParticip(), TGStat::GetValStr(), TSnap::GetWeightedBetweennessCentr(), TSnap::GetWeightedPageRank(), TSnap::GetWeightedPageRankMP(), TSnap::GetWeightedShortestPath(), TCoda::GradientForNode(), TAGMFast::GradientForRow(), TCesna::GradientForRow(), TTable::GroupAux(), TSnap::TSnapDetail::inComp(), TSnap::Infomap(), TSnap::TSnapDetail::InfomapOnlineIncrement(), TNetInfBs::Init(), TUniChDb::InitScripts(), TUniChDb::InitSpecialCasing(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TMaxPriorityQueue< TVal >::Insert(), TSnap::IntFlowBiDBFS(), TBigNet< TNodeData, IsDir >::InvertFromSources(), LearnEmbeddings(), TTimeNet::LoadArxiv(), TAGMUtil::LoadEdgeListStr(), TNIBs::LoadGroundTruthNodesTxt(), TNetInfBs::LoadGroundTruthTxt(), TNIBs::LoadGroundTruthTxt(), TKeyDatFl< TKey, TDat, THashFunc >::LoadHash(), TNIBs::LoadInferredNodesTxt(), TNIBs::LoadInferredTxt(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TSnap::LoadNodeList(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), TSnap::TSnapDetail::MapEquationNew2Modules(), TSnap::MaxCPGreedyBetter(), TSnap::MaxCPGreedyBetter1(), TSnap::MaxCPGreedyBetter2(), TSnap::MaxCPGreedyBetter3(), TCluster::MCMC(), TCoda::MLEGradAscentParallel(), TDGraphCounter::operator()(), THash< TPair, THash >::operator()(), THttpResp::ParseHttpResp(), THttpRq::ParseHttpRq(), TNcpGraphsBase::PlotAvgNcp(), TLocClustStat::PlotBoltzmanCurve(), TSnap::PlotEigValDistr(), TLocClustStat::PlotPhiDistr(), PlotRoles(), TSnap::PlotShortPathDistr(), TSnap::PlotSngValDistr(), TAGMFit::PrintSummary(), TXmlLx::PutEntityVal(), TXmlLx::PutPEntityVal(), TSnap::ReadEdgeSchemaFromFile(), TSnap::ReadNodeSchemaFromFile(), TSnap::ReebRefine(), TSnap::ReebSimplify(), TTable::Reindex(), TModeNet::RemoveCrossNets(), TTable::RemoveFirstRow(), TTable::RemoveRow(), TTable::RequestIndexFlt(), TTable::RequestIndexInt(), TTable::RequestIndexStrMap(), TBigNet< TNodeData, IsDir >::Rewire(), TAGMUtil::RewireCmtyVV(), TTable::Save(), TSnap::SavePajek(), TBigNet< TNodeData, IsDir >::SaveToDisk(), TTable::SelfSimJoinPerGroup(), TAGMFast::SetCmtyVV(), TCoda::SetCmtyVV(), TXmlChDef::SetEntityVal(), THtmlLxChDef::SetEscStr(), TPredicate::SetFltVal(), TPredicate::SetIntVal(), TPredicate::SetStrVal(), TGStat::SetVal(), TNIBs::SG(), TD34GraphCounter::TD34GraphCounter(), TTable::ThresholdJoinCountCollisions(), TTable::ThresholdJoinCountPerJoinKeyCollisions(), THttpRq::THttpRq(), TMMNet::ToNetwork(), TMMNet::ToNetwork2(), TMMNet::ToNetworkMP(), TArtPointVisitor::TreeEdge(), TBiConVisitor::TreeEdge(), TNIBs::UpdateDiff(), and TTable::UpdateGrouping().

238 {return KeyDatV[AddKey(Key)].Dat;}
int AddKey(const TKey &Key)
Definition: hash.h:373
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDat ( const TKey &  Key,
const TDat &  Dat 
)
inline

Definition at line 239 of file hash.h.

239  {
240  return KeyDatV[AddKey(Key)].Dat=Dat;}
int AddKey(const TKey &Key)
Definition: hash.h:373
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDatId ( const TKey &  Key)
inline

Definition at line 236 of file hash.h.

236  {
237  int KeyId=AddKey(Key); return KeyDatV[KeyId].Dat=KeyId;}
int AddKey(const TKey &Key)
Definition: hash.h:373
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey, class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::AddKey ( const TKey &  Key)

Definition at line 373 of file hash.h.

Referenced by TUniTrie< TInt >::Add(), THash< TPair, THash >::AddDat(), THash< TPair, THash >::AddDatId(), TTable::AddNodeAttributes(), TTmProfiler::AddTimer(), TLocClustStat::BagOfWhiskers(), TTable::CheckAndAddFltNode(), TTimeNENet::GetEdgeTmBuckets(), TSnap::GetSngVals(), TSnap::GetSngVec(), TTimeNet::GetTmBuckets(), TTimeNENet::GetTmBuckets(), TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TAGMFit::InitNodeData(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), THtmlTok::IsBreakTag(), TAGMFit::JoinCom(), TTable::KeepSortedRows(), TUniChDb::LoadTxt(), PreprocessNode(), TSnap::PrintInfo(), TUniChDb::TSubcatHelper::ProcessComment(), TGraphKey::TakeGraph(), TGraphKey::TakeSig(), and TUniChDb::TestComposition().

373  {
374  if ((KeyDatV.Len()>2*PortV.Len())||PortV.Empty()){Resize();}
375  const int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len());
376  const int HashCd=abs(THashFunc::GetSecHashCd(Key));
377  int PrevKeyId=-1;
378  int KeyId=PortV[PortN];
379  while ((KeyId!=-1) &&
380  !((KeyDatV[KeyId].HashCd==HashCd) && (KeyDatV[KeyId].Key==Key))){
381  PrevKeyId=KeyId; KeyId=KeyDatV[KeyId].Next;}
382 
383  if (KeyId==-1){
384  if (FFreeKeyId==-1){
385  KeyId=KeyDatV.Add(THKeyDat(-1, HashCd, Key));
386  } else {
388  //KeyDatV[KeyId]=TKeyDat(-1, HashCd, Key); // slow version
389  KeyDatV[KeyId].Next=-1;
390  KeyDatV[KeyId].HashCd=HashCd;
391  KeyDatV[KeyId].Key=Key;
392  //KeyDatV[KeyId].Dat=TDat(); // already empty
393  }
394  if (PrevKeyId==-1){
395  PortV[PortN]=KeyId;
396  } else {
397  KeyDatV[PrevKeyId].Next=KeyId;
398  }
399  }
400  return KeyId;
401 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt FreeKeys
Definition: hash.h:109
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
void Resize()
Definition: hash.h:319
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::BegI ( ) const
inline

Definition at line 213 of file hash.h.

Referenced by TNIBs::AddCasc(), TTable::Aggregate(), AppendFeatures(), ProcessedGraph::assignWeights_undir(), TCrossNet::AttrNameEI(), TNEANetMP::AttrNameEI(), TNEANetMP::AttrNameNI(), TCrossNet::AttrValueEI(), TNEANetMP::AttrValueEI(), TNEANetMP::AttrValueNI(), TMMNet::BegCrossNetI(), TNEANet::BegEAIntVI(), TCrossNet::BegEdgeI(), TNEGraph::BegEI(), TNodeEdgeNet< TSecTm, TSecTm >::BegEI(), TNEANet::BegEI(), TCascade::BegI(), TGHash< TUInt64 >::BegI(), TBPGraph::BegLNI(), TModeNet::BegMMNI(), TMMNet::BegModeNetI(), TNEANet::BegNAIntVI(), TBigNet< TNodeData, IsDir >::BegNI(), TNodeNet< TSecTm >::BegNI(), TUNGraph::BegNI(), TNGraph::BegNI(), TNodeEDatNet< TStr, TFltFltH >::BegNI(), TNEGraph::BegNI(), TBPGraph::BegNI(), TNodeEdgeNet< TSecTm, TSecTm >::BegNI(), TNEANet::BegNI(), TUndirNet::BegNI(), TDirNet::BegNI(), TBPGraph::BegRNI(), MotifCluster::BifanMotifAdjacency(), TTable::BuildGraph(), TSnap::CmtyEvolutionFileBatch(), TSnap::CmtyEvolutionJson(), MAPPR::computeProfile(), ConvertFeatureToMatrix(), TMMNet::ConvertToSparse(), TNEANet::ConvertToSparse(), CreateEmptyFeatures(), CreateNodeIdMtxIdxHash(), TAttr::DelSAttrId(), TAttrPair::DelSAttrId(), TAGMFast::DotProduct(), TCoda::DotProduct(), TCesna::DotProduct(), TSnap::EventImportance(), TSnap::EventImportance1(), TSnap::FastCorePeriphery(), TSnap::FastCorePeripheryGC(), TCrossNet::FltAttrNameEI(), TNEANetMP::FltAttrNameEI(), TNEANetMP::FltAttrNameNI(), TCrossNet::FltAttrValueEI(), TNEANetMP::FltAttrValueEI(), TNEANetMP::FltAttrValueNI(), FPrintRoles(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), TNEANet::GetAttrENames(), TNEANet::GetAttrNNames(), TNIBs::GetGroundTruthGraphAtT(), TNIBs::GetGroundTruthNetworkAtT(), TSnap::GetGroupDegreeCentr(), TAttr::GetIdVSAttr(), TAttrPair::GetIdVSAttr(), TNIBs::GetInferredGraphAtT(), TNIBs::GetInferredNetworkAtT(), GetNIdSorted(), GetNodeId(), TAGMUtil::GetNodeMembership(), GetNthFeature(), GetNumFeatures(), TAttr::GetSAttrV(), TAttrPair::GetSAttrV(), TMMNet::GetSubgraphByCrossNet(), TMMNet::GetSubgraphByModeNet(), TNIBs::Init(), Inner(), TCrossNet::IntAttrNameEI(), TNEANetMP::IntAttrNameEI(), TNEANetMP::IntAttrNameNI(), TCrossNet::IntAttrValueEI(), TNEANetMP::IntAttrValueEI(), TNEANetMP::IntAttrValueNI(), TCoda::LikelihoodForNode(), TAGMFast::LikelihoodForRow(), TCesna::LikelihoodForRow(), TMMNet::LoadNetworkShM(), TSnap::MaxCPGreedyBetter(), TSnap::MaxCPGreedyBetter1(), TSnap::MaxCPGreedyBetter2(), TSnap::MaxCPGreedyBetter3(), TAGMFast::MLEGradAscent(), TCoda::MLEGradAscent(), TAGMFast::MLEGradAscentParallel(), TCoda::MLEGradAscentParallel(), TCesna::MLEGradAscentParallel(), TAGMFast::MLENewton(), TAGMFast::Norm2(), TCoda::Norm2(), TCesna::Norm2(), PlotRoles(), TCesna::PredictAttrK(), MAPPR::printAPPR(), PrintFeatures(), TTable::PrintGrouping(), PrintRoles(), TSnap::ReadEdgesFromFile(), TSnap::ReadNodesFromFile(), TSnap::ReebRefine(), TSnap::ReebSimplify(), TModeNet::RemoveCrossNets(), TTable::Save(), TNetInfBs::SaveCascades(), TNIBs::SaveCascades(), TNIBs::SaveGroundTruth(), TNIBs::SaveGroundTruthPajek(), TNIBs::SaveInferred(), TNIBs::SaveInferredPajek(), TNetInfBs::SavePajek(), TNetInfBs::SavePlaneTextNet(), TNIBs::SaveSites(), TBigNet< TNodeData, IsDir >::SaveToDisk(), TTable::SelfSimJoinPerGroup(), MotifCluster::SpectralCut(), TTable::SpliceByGroup(), TCrossNet::StrAttrNameEI(), TNEANetMP::StrAttrNameEI(), TNEANetMP::StrAttrNameNI(), TCrossNet::StrAttrValueEI(), TNEANetMP::StrAttrValueEI(), TNEANetMP::StrAttrValueNI(), TAGMFast::Sum(), TCoda::Sum(), TCesna::Sum(), TTable::ThresholdJoinOutputTable(), TTable::ThresholdJoinPerJoinKeyOutputTable(), TMMNet::TMMNet(), TSnap::ToNetwork(), TMMNet::ToNetwork(), TSnap::ToNetworkMP(), TTable::Unique(), and UnweightedGraphRepresentation().

213  {
214  if (Len() == 0){return TIter(KeyDatV.EndI(), KeyDatV.EndI());}
215  if (IsKeyIdEqKeyN()) { return TIter(KeyDatV.BegI(), KeyDatV.EndI());}
216  int FKeyId=-1; FNextKeyId(FKeyId);
217  return TIter(KeyDatV.BegI()+FKeyId, KeyDatV.EndI()); }
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
THashKeyDatI< TKey, TDat > TIter
Definition: hash.h:102
TIter BegI() const
Returns an iterator pointing to the first element in the vector.
Definition: ds.h:593
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
int Len() const
Definition: hash.h:228

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Clr ( const bool &  DoDel = true,
const int &  NoDelLim = -1,
const bool &  ResetDat = true 
)

Definition at line 361 of file hash.h.

Referenced by TTable::AddIdColumn(), TTable::AddNJointRowsMP(), TLocClust::ApproxPageRank(), TNIBs::BSG(), TAttr::Clr(), TCascade::Clr(), TAttrPair::Clr(), TGHash< TUInt64 >::Clr(), TBigNet< TNodeData, IsDir >::Clr(), TNodeNet< TSecTm >::Clr(), TUniCaseFolding::Clr(), TUNGraph::Clr(), TCrossNet::Clr(), TNEANetMP::Clr(), TNGraph::Clr(), TNodeEDatNet< TStr, TFltFltH >::Clr(), TNEGraph::Clr(), TBPGraph::Clr(), TUniTrie< TInt >::Clr(), TUniChDb::Clr(), TNodeEdgeNet< TSecTm, TSecTm >::Clr(), TNEANet::Clr(), TUndirNet::Clr(), TDirNet::Clr(), TSnap::CmtyEvolutionFileBatch(), MAPPR::computeAPPR(), TNIBs::FG(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), TTable::GenerateColTypeMap(), TSnap::GetBetweennessCentr(), TSnap::GetNodeClustCf(), TAGMUtil::GetNodeMembership(), TSnap::GetShortPath(), TSnap::GetWeightedBetweennessCentr(), TSnap::GetWeightedShortestPath(), TNIBs::Init(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TCoda::MLEGradAscentParallel(), TTable::ProjectInPlace(), TTable::Reindex(), TNIBs::Reset(), and TNIBs::SG().

361  {
362  if (DoDel){
363  PortV.Clr(); KeyDatV.Clr();
364  } else {
365  PortV.PutAll(TInt(-1));
366  KeyDatV.Clr(DoDel, NoDelLim);
367  if (ResetDat){KeyDatV.PutAll(THKeyDat());}
368  }
369  FFreeKeyId=TInt(-1); FreeKeys=TInt(0);
370 }
TInt FreeKeys
Definition: hash.h:109
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Defrag ( )

Definition at line 555 of file hash.h.

References IAssert.

Referenced by TGHash< TUInt64 >::Defrag(), TUNGraph::Defrag(), TNGraph::Defrag(), TNEGraph::Defrag(), TNodeEdgeNet< TNodeData, TEdgeData >::Defrag(), TNEANet::Defrag(), TUndirNet::Defrag(), TDirNet::Defrag(), TCoda::MLEGradAscentParallel(), and TBigNet< TNodeData, IsDir >::Rewire().

555  {
556  if (!IsKeyIdEqKeyN()){
558  int KeyId=FFirstKeyId(); TKey Key; TDat Dat;
559  while (FNextKeyId(KeyId)){
560  GetKeyDat(KeyId, Key, Dat);
561  Hash.AddDat(Key, Dat);
562  }
563  Pack();
564  operator=(Hash);
566  }
567 }
#define IAssert(Cond)
Definition: bd.h:262
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
THash & operator=(const THash &Hash)
Definition: hash.h:190
void GetKeyDat(const int &KeyId, TKey &Key, TDat &Dat) const
Definition: hash.h:271
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
Definition: hash.h:97
TIntV PortV
Definition: hash.h:106
void Pack()
Definition: hash.h:289

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::DelIfKey ( const TKey &  Key)
inline

Definition at line 243 of file hash.h.

Referenced by TAttr::DelSAttrId(), TAttrPair::DelSAttrId(), and TCoda::MLEGradAscentParallel().

243  {
244  int KeyId; if (IsKey(Key, KeyId)){DelKeyId(KeyId); return true;} return false;}
void DelKeyId(const int &KeyId)
Definition: hash.h:245
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the caller graph for this function:

template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::DelKey ( const TKey &  Key)

Definition at line 404 of file hash.h.

References IAssert.

Referenced by TCascade::Del(), TCrossNet::DelAttrE(), TNEANet::DelAttrE(), TNEANet::DelAttrN(), TTable::DelColType(), TMMNet::DelCrossNet(), TCrossNet::DelEdge(), TNEGraph::DelEdge(), TNodeEdgeNet< TNodeData, TEdgeData >::DelEdge(), TNEANet::DelEdge(), THash< TPair, THash >::DelKeyId(), TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat::DelLink(), TMMNet::DelModeNet(), TModeNet::DelNbrType(), TUNGraph::DelNode(), TNGraph::DelNode(), TNEGraph::DelNode(), TBPGraph::DelNode(), TNodeEdgeNet< TNodeData, TEdgeData >::DelNode(), TNEANet::DelNode(), TUndirNet::DelNode(), TDirNet::DelNode(), TAttr::DelSAttrDat(), TAttrPair::DelSAttrDat(), TAGMFit::LeaveCom(), TSnap::MaxCPGreedyBetter(), TSnap::MaxCPGreedyBetter1(), TSnap::MaxCPGreedyBetter2(), TSnap::MaxCPGreedyBetter3(), TMaxPriorityQueue< TVal >::PopMax(), TSnap::ReebRefine(), TSnap::ReebSimplify(), TBigNet< TNodeData, IsDir >::Rewire(), and TUniChDb::TSubcatHelper::~TSubcatHelper().

404  {
405  IAssert(!PortV.Empty());
406  const int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len());
407  const int HashCd=abs(THashFunc::GetSecHashCd(Key));
408  int PrevKeyId=-1;
409  int KeyId=PortV[PortN];
410 
411  while ((KeyId!=-1) &&
412  !((KeyDatV[KeyId].HashCd==HashCd) && (KeyDatV[KeyId].Key==Key))){
413  PrevKeyId=KeyId; KeyId=KeyDatV[KeyId].Next;}
414 
415  //IAssertR(KeyId!=-1, Key.GetStr()); //J: some classes do not provide GetStr()?
416  IAssert(KeyId!=-1); //J: some classes do not provide GetStr()?
417  if (PrevKeyId==-1){PortV[PortN]=KeyDatV[KeyId].Next;}
418  else {KeyDatV[PrevKeyId].Next=KeyDatV[KeyId].Next;}
419  KeyDatV[KeyId].Next=FFreeKeyId; FFreeKeyId=KeyId; FreeKeys++;
420  KeyDatV[KeyId].HashCd=TInt(-1);
421  KeyDatV[KeyId].Key=TKey();
422  KeyDatV[KeyId].Dat=TDat();
423 }
#define IAssert(Cond)
Definition: bd.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt FreeKeys
Definition: hash.h:109
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::DelKeyId ( const int &  KeyId)
inline

Definition at line 245 of file hash.h.

Referenced by THash< TPair, THash >::DelIfKey(), and THash< TPair, THash >::DelKeyIdV().

245 {DelKey(GetKey(KeyId));}
void DelKey(const TKey &Key)
Definition: hash.h:404
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::DelKeyIdV ( const TIntV KeyIdV)
inline

Definition at line 246 of file hash.h.

246  {
247  for (int KeyIdN=0; KeyIdN<KeyIdV.Len(); KeyIdN++){DelKeyId(KeyIdV[KeyIdN]);}}
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void DelKeyId(const int &KeyId)
Definition: hash.h:245
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::EndI ( ) const
inline

Definition at line 218 of file hash.h.

Referenced by TNIBs::AddCasc(), TTable::Aggregate(), AppendFeatures(), TBPGraph::BegLNI(), TBPGraph::BegRNI(), MotifCluster::BifanMotifAdjacency(), TTable::BuildGraph(), MAPPR::computeProfile(), ConvertFeatureToMatrix(), TMMNet::ConvertToSparse(), CreateEmptyFeatures(), CreateNodeIdMtxIdxHash(), TAttr::DelSAttrId(), TAttrPair::DelSAttrId(), TAGMFast::DotProduct(), TCoda::DotProduct(), TCesna::DotProduct(), TMMNet::EndCrossNetI(), TNEANet::EndEAIntVI(), TCrossNet::EndEdgeI(), TNEGraph::EndEI(), TNodeEdgeNet< TSecTm, TSecTm >::EndEI(), TNEANet::EndEI(), TCascade::EndI(), TGHash< TUInt64 >::EndI(), TModeNet::EndMMNI(), TMMNet::EndModeNetI(), TNEANet::EndNAIntVI(), TBigNet< TNodeData, IsDir >::EndNI(), TNodeNet< TSecTm >::EndNI(), TUNGraph::EndNI(), TNGraph::EndNI(), TNodeEDatNet< TStr, TFltFltH >::EndNI(), TNEGraph::EndNI(), TBPGraph::EndNI(), TNodeEdgeNet< TSecTm, TSecTm >::EndNI(), TNEANet::EndNI(), TUndirNet::EndNI(), TDirNet::EndNI(), TSnap::EventImportance(), TSnap::EventImportance1(), TSnap::FastCorePeripheryGC(), FPrintRoles(), TNetInfBs::GenCascade(), TNEANet::GetAttrENames(), TNEANet::GetAttrNNames(), TNIBs::GetGroundTruthGraphAtT(), TNIBs::GetGroundTruthNetworkAtT(), TSnap::GetGroupDegreeCentr(), TAttr::GetIdVSAttr(), TAttrPair::GetIdVSAttr(), TNIBs::GetInferredGraphAtT(), TNIBs::GetInferredNetworkAtT(), TBPGraph::GetNI(), GetNIdSorted(), GetNodeId(), TAGMUtil::GetNodeMembership(), GetNthFeature(), TAttr::GetSAttrV(), TAttrPair::GetSAttrV(), TMMNet::GetSubgraphByCrossNet(), TMMNet::GetSubgraphByModeNet(), TNIBs::Init(), TCoda::LikelihoodForNode(), TAGMFast::LikelihoodForRow(), TCesna::LikelihoodForRow(), TMMNet::LoadNetworkShM(), TSnap::MaxCPGreedyBetter(), TSnap::MaxCPGreedyBetter1(), TSnap::MaxCPGreedyBetter2(), TSnap::MaxCPGreedyBetter3(), TAGMFast::MLEGradAscent(), TCoda::MLEGradAscent(), TAGMFast::MLEGradAscentParallel(), TCoda::MLEGradAscentParallel(), TCesna::MLEGradAscentParallel(), TAGMFast::MLENewton(), TAGMFast::Norm2(), TCoda::Norm2(), TCesna::Norm2(), PlotRoles(), TCesna::PredictAttrK(), MAPPR::printAPPR(), PrintFeatures(), TTable::PrintGrouping(), PrintRoles(), TSnap::ReadEdgesFromFile(), TSnap::ReadNodesFromFile(), TSnap::ReebRefine(), TSnap::ReebSimplify(), TModeNet::RemoveCrossNets(), TTable::Save(), TNetInfBs::SaveCascades(), TNIBs::SaveCascades(), TNIBs::SaveGroundTruth(), TNIBs::SaveGroundTruthPajek(), TNIBs::SaveInferred(), TNIBs::SaveInferredPajek(), TNetInfBs::SavePajek(), TNetInfBs::SavePlaneTextNet(), TNIBs::SaveSites(), TBigNet< TNodeData, IsDir >::SaveToDisk(), TTable::SelfSimJoinPerGroup(), MotifCluster::SpectralCut(), TTable::SpliceByGroup(), TAGMFast::Sum(), TCoda::Sum(), TCesna::Sum(), TTable::ThresholdJoinOutputTable(), TTable::ThresholdJoinPerJoinKeyOutputTable(), TMMNet::TMMNet(), TSnap::ToNetwork(), TMMNet::ToNetwork(), TSnap::ToNetworkMP(), TTable::Unique(), and UnweightedGraphRepresentation().

218 {return TIter(KeyDatV.EndI(), KeyDatV.EndI());}
TIter EndI() const
Returns an iterator referring to the past-the-end element in the vector.
Definition: ds.h:595
THashKeyDatI< TKey, TDat > TIter
Definition: hash.h:102
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
bool THash< TKey, TDat, THashFunc >::FNextKeyId ( int &  KeyId) const

Definition at line 478 of file hash.h.

Referenced by TGnuPlot::AddPlot(), THash< TPair, THash >::BegI(), TUNGraph::Defrag(), TNGraph::Defrag(), TNEGraph::Defrag(), TNodeEdgeNet< TNodeData, TEdgeData >::Defrag(), TNEANet::Defrag(), TUndirNet::Defrag(), TDirNet::Defrag(), TUNGraph::Dump(), TNGraph::Dump(), TUndirNet::Dump(), TDirNet::Dump(), TGHash< TUInt64 >::FNextKeyId(), TNGraph::GetEdges(), TDirNet::GetEdges(), TNEGraph::GetEIdV(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEIdV(), TNEANet::GetEIdV(), TUNGraph::GetNIdV(), TNGraph::GetNIdV(), TNEGraph::GetNIdV(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNIdV(), TNEANet::GetNIdV(), TUndirNet::GetNIdV(), TDirNet::GetNIdV(), TUniChDb::InitLineBreaks(), TUniChDb::InitScripts(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TUNGraph::IsOk(), TNGraph::IsOk(), TNEGraph::IsOk(), TNodeEdgeNet< TNodeData, TEdgeData >::IsOk(), TNEANet::IsOk(), TUndirNet::IsOk(), TDirNet::IsOk(), TUniChDb::LoadTxt(), TSnap::TSnapDetail::TCNMQMatrix::MergeBestQ(), TGnuPlot::PlotValCntH(), TGnuPlot::PlotValMomH(), TGnuPlot::PlotValRank(), TKeyDatFl< TKey, TDat, THashFunc >::Save(), TUniChDb::TestComposition(), TUniChDb::TestWbFindNonIgnored(), TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat::UpdateMaxQ(), and TUniChDb::TSubcatHelper::~TSubcatHelper().

478  {
479  do {KeyId++;} while ((KeyId<KeyDatV.Len()) && (KeyDatV[KeyId].HashCd==-1));
480  return KeyId<KeyDatV.Len();
481 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Gen ( const int &  ExpectVals)
inline

Definition at line 222 of file hash.h.

Referenced by TCesnaUtil::FilterLowEntropy(), TGHash< TUInt64 >::Gen(), TSnap::GetEigenVectorCentr(), TSnap::GetHits(), TSnap::GetHitsMP(), TCoda::GetNIDValH(), TSnap::GetPageRank(), TSnap::GetPageRank_v1(), TSnap::GetPageRankMP(), TSnap::GetWeightedPageRank(), TSnap::GetWeightedPageRankMP(), TCoda::GradientForNode(), TAGMFast::GradientForRow(), TCesna::GradientForRow(), TAGMFit::InitNodeData(), TAGMUtil::LoadEdgeListStr(), TKeyDatFl< TKey, TDat, THashFunc >::LoadHash(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TNodeNet< TSecTm >::Reserve(), TUNGraph::Reserve(), TNGraph::Reserve(), TNodeEDatNet< TStr, TFltFltH >::Reserve(), TNEGraph::Reserve(), TNodeEdgeNet< TSecTm, TSecTm >::Reserve(), TNEANet::Reserve(), TUndirNet::Reserve(), and TDirNet::Reserve().

222  {
223  PortV.Gen(GetNextPrime(ExpectVals/2)); KeyDatV.Gen(ExpectVals, 0);
224  FFreeKeyId=-1; FreeKeys=0; PortV.PutAll(TInt(-1));}
TInt FreeKeys
Definition: hash.h:109
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
uint GetNextPrime(const uint &Val) const
Definition: hash.h:307
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TDat& THash< TKey, TDat, THashFunc >::GetDat ( const TKey &  Key) const
inline

Definition at line 262 of file hash.h.

Referenced by TSnap::TSnapDetail::_GirvanNewmanGetModularity(), TNEANet::AddAttributes(), TMMNet::AddCrossNet(), TCrossNet::AddEdge(), TNEANetMP::AddEdge(), TNEANet::AddEdge(), AddEgonetFeatures(), TCrossNet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatE(), TNEANet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatN(), TNEANet::AddFltAttrDatN(), TCrossNet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatE(), TNEANet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatN(), TNEANet::AddIntAttrDatN(), TNEANet::AddIntVAttrDatE(), TNEANet::AddIntVAttrDatN(), AddLocalFeatures(), TNEANetMP::AddNode(), TTable::AddNodeAttributes(), TAttr::AddSAttrDat(), TAttrPair::AddSAttrDat(), TCrossNet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatE(), TNEANet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatN(), TNEANet::AddStrAttrDatN(), TTable::Aggregate(), AppendFeatures(), TNEANet::AppendIntVAttrDatE(), TNEANet::AppendIntVAttrDatN(), TLocClust::ApproxPageRank(), AssignBinValue(), TArtPointVisitor::BackEdge(), TBiConVisitor::BackEdge(), TLocClustStat::BagOfWhiskers(), TLocClustStat::BagOfWhiskers2(), TCrossNet::BegEAFltI(), TNEANetMP::BegEAFltI(), TCrossNet::BegEAIntI(), TNEANetMP::BegEAIntI(), TCrossNet::BegEAStrI(), TNEANetMP::BegEAStrI(), TNEANetMP::BegNAFltI(), TNEANetMP::BegNAIntI(), TNEANetMP::BegNAStrI(), TSnap::BorgattiEverettMeasure(), TNIBs::BSG(), TTable::BuildGraph(), TTable::CheckAndAddFltNode(), TSnap::TSnapDetail::chekIfCrossing(), TModeNet::ClrNbr(), TSnap::CmtyEvolutionFileBatch(), TSnap::CmtyEvolutionFileBatchV(), MAPPR::computeProfile(), TAGMUtil::ConnectCmtyVV(), TNEANet::ConvertToSparse(), TCrossNet::DelAttrDatE(), TNEANetMP::DelAttrDatE(), TNEANet::DelAttrDatE(), TNEANetMP::DelAttrDatN(), TNEANet::DelAttrDatN(), TCrossNet::DelAttrE(), TNEANet::DelAttrE(), TNEANet::DelAttrN(), TMMNet::DelCrossNet(), TCrossNet::DelEdge(), TNEANet::DelFromIntVAttrDatN(), TMMNet::DelModeNet(), TModeNet::DelNbrType(), TBPGraph::DelNode(), TAttr::DelSAttrDat(), TAttrPair::DelSAttrDat(), TAGMFast::DotProduct(), TCoda::DotProduct(), TCesna::DotProduct(), TCodaAnalyzer::Draw2ModeCommunity(), TCodaAnalyzer::Dump2ModeCommunities(), TAGMUtil::DumpCmtyVV(), TCesnaUtil::DumpNIDAttrHToMetis(), TNEANet::EdgeAttrIsIntVDeleted(), TCrossNet::EndEAFltI(), TNEANetMP::EndEAFltI(), TCrossNet::EndEAIntI(), TNEANetMP::EndEAIntI(), TCrossNet::EndEAStrI(), TNEANetMP::EndEAStrI(), TNEANetMP::EndNAFltI(), TNEANetMP::EndNAIntI(), TNEANetMP::EndNAStrI(), TSpecFunc::EntropyBias(), TPredicate::EvalAtomicPredicate(), TSnap::EventImportance(), TSnap::EventImportance1(), TNIBs::FG(), TCesnaUtil::FilterLowEntropy(), TSnap::FindAugV(), TArtPointVisitor::FinishNode(), TBiConVisitor::FinishNode(), TSccVisitor< PGraph, OnlyCount >::FinishNode(), TArtPointVisitor::FwdEdge(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), GenerateRecursiveFeatures(), TNEANet::GetAttrIndE(), TNEANet::GetAttrIndN(), TCrossNet::GetAttrTypeE(), TModeNet::GetAttrTypeN(), TSnap::GetBetweennessCentr(), TSnap::GetBfsTree(), TNIBs::GetCasc(), TNIBs::GetCascadeId(), TZipIn::GetCmd(), TZipOut::GetCmd(), TAGMFast::GetCmtyVV(), TCesna::GetCmtyVV(), TD34GraphCounter::GetCnt(), TTable::GetColIdx(), TTable::GetColType(), TTable::GetColTypeMap(), TMMNet::GetCrossId(), TMMNet::GetCrossName(), TMMNet::GetCrossNetByName(), TGHash< TUInt64 >::GetDat(), TCnCom::GetDfsVisitor(), TNIBs::GetDomainId(), TCrossNet::GetEAFltI(), TNEANetMP::GetEAFltI(), TCrossNet::GetEAIntI(), TNEANetMP::GetEAIntI(), TCrossNet::GetEAStrI(), TNEANetMP::GetEAStrI(), TNodeEdgeNet< TSecTm, TSecTm >::GetEDat(), TNEGraph::GetEdge(), TNodeEdgeNet< TSecTm, TSecTm >::GetEdge(), TNEANet::GetEdge(), TCrossNet::GetEdgeAttrValue(), TNEANetMP::GetEdgeAttrValue(), TNEANet::GetEdgeAttrValue(), TTimeNENet::GetEdgeTmBuckets(), TSnap::GetEigenVectorCentr(), THttpRq::GetFldVal(), THttpResp::GetFldVal(), THttpResp::GetFldValV(), TCrossNet::GetFltAttrDatE(), TNEANetMP::GetFltAttrDatE(), TNEANet::GetFltAttrDatE(), TNEANetMP::GetFltAttrDatN(), TNEANet::GetFltAttrDatN(), TCrossNet::GetFltAttrDefaultE(), TNEANet::GetFltAttrDefaultE(), TNEANet::GetFltAttrDefaultN(), TNEANetMP::GetFltAttrVecE(), TNEANet::GetFltAttrVecE(), TTable::GetFltNodePropertyTable(), TTable::GetFltRowIdxByVal(), TUrlEnv::GetFullUrlStr(), TSnap::GetGroupDegreeCentr0(), TSnap::GetGroupFarnessCentr(), TSnap::GetHits(), TSnap::GetHitsMP(), TAttr::GetIdVSAttr(), TAttrPair::GetIdVSAttr(), TCrossNet::GetIntAttrDatE(), TNEANetMP::GetIntAttrDatE(), TNEANet::GetIntAttrDatE(), TNEANetMP::GetIntAttrDatN(), TNEANet::GetIntAttrDatN(), TCrossNet::GetIntAttrDefaultE(), TNEANet::GetIntAttrDefaultE(), TNEANet::GetIntAttrDefaultN(), TNEANetMP::GetIntAttrIndE(), TNEANet::GetIntAttrIndE(), TNEANetMP::GetIntAttrIndN(), TNEANet::GetIntAttrIndN(), TTable::GetIntRowIdxByVal(), TNEANet::GetIntVAttrDatE(), TNEANet::GetIntVAttrDatN(), TSccVisitor< PGraph, OnlyCount >::GetMinDiscTm(), TMMNet::GetModeId(), TMMNet::GetModeName(), TMMNet::GetModeNetByName(), GetMtxIdx(), TNEANetMP::GetNAFltI(), TNEANetMP::GetNAIntI(), TNEANetMP::GetNAStrI(), TBigNet< TNodeData, IsDir >::GetNDat(), TNodeNet< TSecTm >::GetNDat(), TNodeEDatNet< TStr, TFltFltH >::GetNDat(), TNodeEdgeNet< TSecTm, TSecTm >::GetNDat(), TModeNet::GetNeighborsByCrossNet(), TGraphAnf< PGraph >::GetNIdOffset(), TBigNet< TNodeData, IsDir >::GetNode(), TNodeNet< TSecTm >::GetNode(), TUNGraph::GetNode(), TNGraph::GetNode(), TNodeEDatNet< TStr, TFltFltH >::GetNode(), TNEGraph::GetNode(), TNodeEdgeNet< TSecTm, TSecTm >::GetNode(), TNEANet::GetNode(), TUndirNet::GetNode(), TDirNet::GetNode(), TNEANetMP::GetNodeAttrValue(), TNEANet::GetNodeAttrValue(), TNetInfBs::GetNodeInfo(), TNIBs::GetNodeInfo(), TNetInfBs::GetNodeNm(), TNIBs::GetNodeNm(), TGraphEnumUtils::GetNormalizedGraph(), TSnap::GetPageRank_v1(), TCascade::GetParent(), TMaxPriorityQueue< TVal >::GetPriority(), TCascade::GetProb(), TILx::GetRw(), TAttr::GetSAttrDat(), TAttrPair::GetSAttrDat(), TAttr::GetSAttrId(), TAttrPair::GetSAttrId(), TAttr::GetSAttrName(), TAttrPair::GetSAttrName(), TAGMFast::GetStepSizeByLineSearch(), TCoda::GetStepSizeByLineSearch(), TCesna::GetStepSizeByLineSearch(), TCrossNet::GetStrAttrDatE(), TNEANetMP::GetStrAttrDatE(), TNEANet::GetStrAttrDatE(), TNEANetMP::GetStrAttrDatN(), TNEANet::GetStrAttrDatN(), TCrossNet::GetStrAttrDefaultE(), TNEANet::GetStrAttrDefaultE(), TNEANet::GetStrAttrDefaultN(), TTable::GetStrRowIdxByMap(), TMMNet::GetSubgraphByCrossNet(), TMMNet::GetSubgraphByModeNet(), TCascade::GetTm(), TTimeNet::GetTmBuckets(), TTimeNENet::GetTmBuckets(), TGStat::GetVal(), TGStat::GetValStr(), TSnap::GetWeightedBetweennessCentr(), TSnap::GetWeightedPageRank(), TSnap::GetWeightedPageRankMP(), TSnap::GetWeightedShortestPath(), TAGMUtil::GVizComGraph(), TSnap::TSnapDetail::inComp(), TSnap::Infomap(), TSnap::InfomapOnline(), TSnap::TSnapDetail::InfomapOnlineIncrement(), TNetInfBs::Init(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TBigNet< TNodeData, IsDir >::InvertFromSources(), TNEANetMP::IsFltAttrE(), TNEANet::IsFltAttrE(), TNEANetMP::IsIntAttrE(), TNEANet::IsIntAttrE(), TNEANetMP::IsStrAttrE(), TNEANet::IsStrAttrE(), TTable::Join(), LearnEmbeddings(), TTimeNet::LoadArxiv(), TNIBs::LoadInferredNodesTxt(), TNIBs::LoadInferredTxt(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TUniChDb::LoadTxt(), TSnap::TSnapDetail::MapEquationNew2Modules(), TCluster::MCMC(), TSnap::TSnapDetail::TCNMQMatrix::MergeBestQ(), TCesna::MLEGradAscent(), TAGMFast::MLEGradAscentParallel(), TCoda::MLEGradAscentParallel(), TCesna::MLEGradAscentParallel(), TNEANet::NodeAttrIsIntVDeleted(), TD34GraphCounter::operator()(), TDGraphCounter::operator()(), TGHash< TUInt64 >::operator()(), TGStat::operator<(), THash< TKey, TDat, THashFunc >::operator==(), TUnionFind::Parent(), TSnap::PearsonCorrelation(), TUnionFind::Rank(), TSnap::ReebRefine(), TSnap::ReebSimplify(), TModeNet::RemoveCrossNets(), TTable::RequestIndexFlt(), TTable::RequestIndexInt(), TTable::RequestIndexStrMap(), TBigNet< TNodeData, IsDir >::Rewire(), TAGMUtil::SaveBipartiteGephi(), TNetInfBs::SaveEdgeInfo(), TAGMUtil::SaveGephi(), TNetInfBs::SaveGroundTruth(), TSnap::SaveGViz(), TSnap::SavePajek(), TNIBs::SaveSites(), TTable::SelfSimJoinPerGroup(), TNodeEdgeNet< TNodeData, TEdgeData >::SetNDat(), TMaxPriorityQueue< TVal >::SetPriority(), TNIBs::SG(), TTable::SpliceByGroup(), TMaxPriorityQueue< TVal >::Swap(), TTable::ThresholdJoinCountCollisions(), TTable::ThresholdJoinCountPerJoinKeyCollisions(), TMMNet::TMMNet(), TSnap::ToNetwork(), TMMNet::ToNetwork(), TMMNet::ToNetwork2(), TMMNet::ToNetworkMP(), TSnap::ToNetworkMP(), TNIBs::UpdateDiff(), TTable::UpdateFltFromTable(), TTable::UpdateGrouping(), and TCascade::UpdateProb().

262 {return KeyDatV[GetKeyId(Key)].Dat;}
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::GetDat ( const TKey &  Key)
inline

Definition at line 263 of file hash.h.

263 {return KeyDatV[GetKeyId(Key)].Dat;}
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatKeyKdV ( TVec< TKeyDat< TDat, TKey > > &  DatKeyKdV) const

Definition at line 533 of file hash.h.

533  {
534  DatKeyKdV.Gen(Len(), 0);
535  TKey Key; TDat Dat;
536  int KeyId=FFirstKeyId();
537  while (FNextKeyId(KeyId)){
538  GetKeyDat(KeyId, Key, Dat);
539  DatKeyKdV.Add(TKeyDat<TDat, TKey>(Dat, Key));
540  }
541 }
Definition: ds.h:346
void GetKeyDat(const int &KeyId, TKey &Key, TDat &Dat) const
Definition: hash.h:271
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatKeyPrV ( TVec< TPair< TDat, TKey > > &  DatKeyPrV) const

Definition at line 511 of file hash.h.

Referenced by TGHash< TUInt64 >::GetDatKeyPrV().

511  {
512  DatKeyPrV.Gen(Len(), 0);
513  TKey Key; TDat Dat;
514  int KeyId=FFirstKeyId();
515  while (FNextKeyId(KeyId)){
516  GetKeyDat(KeyId, Key, Dat);
517  DatKeyPrV.Add(TPair<TDat, TKey>(Dat, Key));
518  }
519 }
void GetKeyDat(const int &KeyId, TKey &Key, TDat &Dat) const
Definition: hash.h:271
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
Definition: ds.h:32
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228

Here is the caller graph for this function:

template<class TKey , class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatV ( TVec< TDat > &  DatV) const

Definition at line 492 of file hash.h.

References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().

Referenced by TAGMUtil::ConnectCmtyVV(), TGHash< TUInt64 >::GetDatV(), TAGMUtil::RewireCmtyVV(), and TTable::TTable().

492  {
493  DatV.Gen(Len(), 0);
494  int KeyId=FFirstKeyId();
495  while (FNextKeyId(KeyId)){
496  DatV.Add(GetHashKeyDat(KeyId).Dat);}
497 }
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat THash< TKey, TDat, THashFunc >::GetDatWithDefault ( const TKey &  Key,
TDat  DefaultValue 
)
inline

Definition at line 264 of file hash.h.

Referenced by TSnap::GetPersonalizedPageRankBidirectional().

264  {
265  int KeyId = GetKeyId(Key);
266  return KeyId >= 0 ? KeyDatV[KeyId].Dat : DefaultValue;
267  }
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THKeyDat& THash< TKey, TDat, THashFunc >::GetHashKeyDat ( const int &  KeyId)
inlineprivate

Definition at line 136 of file hash.h.

Referenced by THash< TPair, THash >::GetKey(), THash< TPair, THash >::GetKeyDat(), THash< TPair, THash >::IsKeyGetDat(), and THash< TPair, THash >::operator[]().

136  {
137  THKeyDat& KeyDat=KeyDatV[KeyId];
138  Assert(KeyDat.HashCd!=-1); return KeyDat;}
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
#define Assert(Cond)
Definition: bd.h:251
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const THKeyDat& THash< TKey, TDat, THashFunc >::GetHashKeyDat ( const int &  KeyId) const
inlineprivate

Definition at line 139 of file hash.h.

139  {
140  const THKeyDat& KeyDat=KeyDatV[KeyId];
141  Assert(KeyDat.HashCd!=-1); return KeyDat;}
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
#define Assert(Cond)
Definition: bd.h:251
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::GetI ( const TKey &  Key) const
inline
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TKey& THash< TKey, TDat, THashFunc >::GetKey ( const int &  KeyId) const
inline

Definition at line 252 of file hash.h.

Referenced by TGnuPlot::AddPlot(), TTable::Aggregate(), TLocClustStat::BagOfWhiskers(), TLocClustStat::BagOfWhiskers2(), TNIBs::BSG(), TForestFire::BurnExpFire(), TForestFire::BurnGeoFire(), TSnap::CmtyEvolutionFileBatch(), TSnap::TSnapDetail::CmtyGirvanNewmanStep(), TNEANet::ConvertToSparse(), TMom::Def(), THash< TPair, THash >::DelKeyId(), TUnionFind::Dump(), TCoda::DumpMemberships(), TCesnaUtil::DumpNIDAttrHToNIDK(), TNIBs::FG(), TCesnaUtil::FilterLowEntropy(), TLocClust::FindBestCut(), TNIBs::GenCascade(), TSnap::GetBfsEffDiam(), TSnap::GetBfsTree(), TSnap::GetClustCf(), TAGMFast::GetCmtyVV(), TCoda::GetCmtyVV(), TCesna::GetCmtyVV(), TLocClustStat::GetCurveStat(), TSnap::GetDegCnt(), TNEGraph::GetEIdV(), TNodeEdgeNet< TNodeData, TEdgeData >::GetEIdV(), TNEANet::GetEIdV(), TSnap::GetEigenVectorCentr(), TD34GraphCounter::GetId(), TSnap::GetInDegCnt(), TGHash< TUInt64 >::GetKey(), TUnionFind::GetKeyI(), TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat::GetMxQNId(), TUNGraph::GetNIdV(), TNGraph::GetNIdV(), TNEGraph::GetNIdV(), TNodeEdgeNet< TNodeData, TEdgeData >::GetNIdV(), TNEANet::GetNIdV(), TUndirNet::GetNIdV(), TDirNet::GetNIdV(), TCascade::GetNode(), TAGMUtil::GetNodeMembership(), TNetConstraint< PGraph >::GetNodePr(), TSnap::GetNodesAtHop(), TSnap::GetOutDegCnt(), TNEGraph::GetRndEId(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndEId(), TNEANet::GetRndEId(), TBigNet< TNodeData, IsDir >::GetRndNId(), TNodeNet< TSecTm >::GetRndNId(), TUNGraph::GetRndNId(), TNGraph::GetRndNId(), TNodeEDatNet< TStr, TFltFltH >::GetRndNId(), TNEGraph::GetRndNId(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndNId(), TNEANet::GetRndNId(), TUndirNet::GetRndNId(), TDirNet::GetRndNId(), TUniChDb::GetScriptName(), TAGMFast::GetStepSizeByLineSearch(), TCoda::GetStepSizeByLineSearch(), TCesna::GetStepSizeByLineSearch(), THttpRq::GetStr(), TUniChDb::InitScripts(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TNIBs::LabelBurstAutomaton(), TTimeNet::LoadArxiv(), TNIBs::LoadGroundTruthTxt(), TNIBs::LoadInferredTxt(), TUniChDb::LoadTxt(), THash< TPair, THash >::MarkDelKeyId(), TSnap::TSnapDetail::TCNMQMatrix::MergeBestQ(), TCesna::MLEGradAscent(), TAGMFast::MLEGradAscentParallel(), TCoda::MLEGradAscentParallel(), TCesna::MLEGradAscentParallel(), TSnap::PlotShortPathDistr(), TGnuPlot::PlotValCntH(), TGnuPlot::PlotValMomH(), TBigNet< TNodeData, IsDir >::Rewire(), TAGMUtil::RewireCmtyNID(), TAGMFit::SampleTransition(), TKeyDatFl< TKey, TDat, THashFunc >::Save(), TCesna::SetGraph(), TNIBs::SG(), TLocClust::SupportSweep(), TUniChDb::TestComposition(), TUniChDb::TestWbFindNonIgnored(), and TUniChDb::TSubcatHelper::~TSubcatHelper().

252 { return GetHashKeyDat(KeyId).Key;}
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136
TKey Key
Definition: hash.h:12

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::GetKeyDat ( const int &  KeyId,
TKey &  Key,
TDat &  Dat 
) const
inline

Definition at line 271 of file hash.h.

Referenced by TGHash< TUInt64 >::GetKeyDat().

271  {
272  const THKeyDat& KeyDat=GetHashKeyDat(KeyId);
273  Key=KeyDat.Key; Dat=KeyDat.Dat;}
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyDatKdV ( TVec< TKeyDat< TKey, TDat > > &  KeyDatKdV) const

Definition at line 522 of file hash.h.

522  {
523  KeyDatKdV.Gen(Len(), 0);
524  TKey Key; TDat Dat;
525  int KeyId=FFirstKeyId();
526  while (FNextKeyId(KeyId)){
527  GetKeyDat(KeyId, Key, Dat);
528  KeyDatKdV.Add(TKeyDat<TKey, TDat>(Key, Dat));
529  }
530 }
Definition: ds.h:346
void GetKeyDat(const int &KeyId, TKey &Key, TDat &Dat) const
Definition: hash.h:271
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyDatPrV ( TVec< TPair< TKey, TDat > > &  KeyDatPrV) const

Definition at line 500 of file hash.h.

Referenced by TGStat::AvgGStat(), TSnap::GetBiConSzCnt(), TTimeNENet::GetEdgeTmBuckets(), TGHash< TUInt64 >::GetKeyDatPrV(), TSnap::GetNodesAtHops(), TSnap::GetSccSzCnt(), TTimeNet::GetTmBuckets(), TTimeNENet::GetTmBuckets(), TSnap::GetTriadParticip(), TGnuPlot::PlotCntOverTm(), TSnap::PlotEigValDistr(), and TSnap::PlotSngValDistr().

500  {
501  KeyDatPrV.Gen(Len(), 0);
502  TKey Key; TDat Dat;
503  int KeyId=FFirstKeyId();
504  while (FNextKeyId(KeyId)){
505  GetKeyDat(KeyId, Key, Dat);
506  KeyDatPrV.Add(TPair<TKey, TDat>(Key, Dat));
507  }
508 }
void GetKeyDat(const int &KeyId, TKey &Key, TDat &Dat) const
Definition: hash.h:271
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
Definition: ds.h:32
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228

Here is the caller graph for this function:

template<class TKey, class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::GetKeyId ( const TKey &  Key) const

Definition at line 466 of file hash.h.

Referenced by TNEANet::AddAttributes(), TUniChDb::AddDecomposition(), TCrossNet::AddEdge(), TNEANet::AddEdge(), TCrossNet::AddFltAttrDatE(), TNEANet::AddFltAttrDatE(), TNEANet::AddFltAttrDatN(), TCrossNet::AddIntAttrDatE(), TNEANet::AddIntAttrDatE(), TNEANet::AddIntAttrDatN(), TNEANet::AddIntVAttrDatE(), TNEANet::AddIntVAttrDatN(), TSnap::TSnapDetail::TCNMQMatrix::TCmtyDat::AddQ(), TCrossNet::AddStrAttrDatE(), TNEANet::AddStrAttrDatE(), TNEANet::AddStrAttrDatN(), TNEANet::AppendIntVAttrDatE(), TNEANet::AppendIntVAttrDatN(), TUniChDb::Compose(), TCrossNet::DelAttrDatE(), TNEANet::DelAttrDatE(), TNEANet::DelAttrDatN(), TCrossNet::DelEdge(), TNEANet::DelEdge(), TNEANet::DelFromIntVAttrDatN(), TNEANet::DelNode(), TCrossNet::EdgeAttrIsFltDeleted(), TNEANet::EdgeAttrIsFltDeleted(), TCrossNet::EdgeAttrIsIntDeleted(), TNEANet::EdgeAttrIsIntDeleted(), TNEANet::EdgeAttrIsIntVDeleted(), TCrossNet::EdgeAttrIsStrDeleted(), TNEANet::EdgeAttrIsStrDeleted(), TNEANet::FltAttrValueNI(), TUniCaseFolding::Fold(), TUniCaseFolding::FoldInPlace(), TUniChDb::GetCaseConverted(), TUniChDb::GetCat(), TUniChDb::GetCharName(), TUniChDb::GetCombiningClass(), THash< TPair, THash >::GetDat(), THash< TPair, THash >::GetDatWithDefault(), TCrossNet::GetEAFltI(), TNEANet::GetEAFltI(), TCrossNet::GetEAIntI(), TNEANet::GetEAIntI(), TNEANet::GetEAIntVI(), TCrossNet::GetEAStrI(), TNEANet::GetEAStrI(), TCrossNet::GetEdgeAttrValue(), TNEANet::GetEdgeAttrValue(), THtmlLxChDef::GetEscStr(), TCrossNet::GetFltAttrDatE(), TNEANet::GetFltAttrDatE(), TNEANet::GetFltAttrDatN(), TNEANet::GetFltAttrIndDatE(), TNEANet::GetFltAttrIndDatN(), TNEANet::GetFltKeyIdE(), THash< TPair, THash >::GetI(), TCrossNet::GetIntAttrDatE(), TNEANet::GetIntAttrDatE(), TNEANet::GetIntAttrDatN(), TNEANet::GetIntAttrIndDatE(), TNEANet::GetIntAttrIndDatN(), TNEANet::GetIntVAttrDatE(), TNEANet::GetIntVAttrDatN(), TGHash< TUInt64 >::GetKeyId(), TNEANet::GetNAFltI(), TNEANet::GetNAIntI(), TNEANet::GetNAIntVI(), TNEANet::GetNAStrI(), TNEANet::GetNodeAttrValue(), TUniChDb::GetSbFlags(), TUniChDb::GetScript(), TUniChDb::GetScriptByName(), TUniChDb::GetSimpleCaseConverted(), TSnap::GetSngVals(), TSnap::GetSngVec(), TLxSymStr::GetSSym(), TCrossNet::GetStrAttrDatE(), TNEANet::GetStrAttrDatE(), TNEANet::GetStrAttrDatN(), TNEANet::GetStrAttrIndDatE(), TNEANet::GetStrAttrIndDatN(), TUniChDb::GetSubCat(), TILx::GetSym(), TUniChDb::GetWbFlags(), TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TNEANet::IntAttrValueNI(), TNEANet::IntVAttrValueEI(), TNEANet::IntVAttrValueNI(), TUniChDb::IsGetChInfo(), THash< TPair, THash >::IsKey(), TUniChDb::IsPrivateUse(), TUniChDb::IsSbFlag(), TUniChDb::IsSurrogate(), TUniChDb::IsWbFlag(), TUniChDb::IsWbIgnored(), TUniChDb::LoadTxt(), TNEANet::NodeAttrIsFltDeleted(), TNEANet::NodeAttrIsIntDeleted(), TNEANet::NodeAttrIsIntVDeleted(), TNEANet::NodeAttrIsStrDeleted(), TUniChDb::TSubcatHelper::SetCat(), TNEANet::StrAttrValueNI(), TLocClust::SupportSweep(), TGraphKey::TakeGraph(), TGraphKey::TakeSig(), TUniChDb::TSubcatHelper::TestCat(), and TUniChDb::ToSimpleCaseConverted().

466  {
467  if (PortV.Empty()){return -1;}
468  const int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len());
469  const int HashCd=abs(THashFunc::GetSecHashCd(Key));
470  int KeyId=PortV[PortN];
471  while ((KeyId!=-1) &&
472  !((KeyDatV[KeyId].HashCd==HashCd) && (KeyDatV[KeyId].Key==Key))){
473  KeyId=KeyDatV[KeyId].Next;}
474  return KeyId;
475 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyV ( TVec< TKey > &  KeyV) const

Definition at line 484 of file hash.h.

References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().

Referenced by TNEANet::AddAttributes(), TCrossNet::AddEdge(), TNEANet::AddEdge(), TModeNet::Clr(), TCoda::GetCmtyVV(), TModeNet::GetCrossNetNames(), TGHash< TUInt64 >::GetKeyV(), TCoda::GetTopCIDs(), TBreathFS< PGraph >::GetVisitedNIdV(), TBigNet< TNodeData, IsDir >::Rewire(), TMMNet::ToNetworkMP(), and TTable::TTable().

484  {
485  KeyV.Gen(Len(), 0);
486  int KeyId=FFirstKeyId();
487  while (FNextKeyId(KeyId)){
488  KeyV.Add(GetKey(KeyId));}
489 }
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
int Len() const
Definition: hash.h:228
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
::TSize THash< TKey, TDat, THashFunc >::GetMemUsed ( ) const
inline

Definition at line 201 of file hash.h.

Referenced by TAttr::GetMemUsed(), and TTable::GetMemUsedKB().

201  {
202  // return PortV.GetMemUsed()+KeyDatV.GetMemUsed()+sizeof(bool)+2*sizeof(int);}
203  int64 MemUsed = sizeof(bool)+2*sizeof(int);
204  MemUsed += int64(PortV.Reserved()) * int64(sizeof(TInt));
205  for (int KeyDatN = 0; KeyDatN < KeyDatV.Len(); KeyDatN++) {
206  MemUsed += int64(2 * sizeof(TInt));
207  MemUsed += int64(KeyDatV[KeyDatN].Key.GetMemUsed());
208  MemUsed += int64(KeyDatV[KeyDatN].Dat.GetMemUsed());
209  }
210  return ::TSize(MemUsed);
211  }
TSizeTy Reserved() const
Returns the size of allocated storage capacity.
Definition: ds.h:577
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TSizeTy GetMemUsed() const
Returns the memory footprint (the number of bytes) of the vector.
Definition: ds.h:511
size_t TSize
Definition: bd.h:58
Definition: dt.h:1134
long long int64
Definition: bd.h:27
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetMxKeyIds ( ) const
inline

Definition at line 231 of file hash.h.

Referenced by TAttr::AddSAttr(), TAttrPair::AddSAttr(), TGHash< TUInt64 >::GetMxKeyIds(), and TBigNet< TNodeData, IsDir >::Rewire().

231 {return KeyDatV.Len();}
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
uint THash< TKey, TDat, THashFunc >::GetNextPrime ( const uint Val) const
private

Definition at line 307 of file hash.h.

Referenced by THash< TPair, THash >::Gen().

307  {
308  const uint* f=(const uint*)HashPrimeT, *m, *l=(const uint*)HashPrimeT + (int)HashPrimes;
309  int h, len = (int)HashPrimes;
310  while (len > 0) {
311  h = len >> 1; m = f + h;
312  if (*m < Val) { f = m; f++; len = len - h - 1; }
313  else len = h;
314  }
315  return f == l ? *(l - 1) : *f;
316 }
unsigned int uint
Definition: bd.h:11
static const unsigned int HashPrimeT[HashPrimes]
Definition: hash.h:100

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetPorts ( ) const
inline

Definition at line 229 of file hash.h.

Referenced by TGHash< TUInt64 >::GetPorts().

229 {return PortV.Len();}
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TIntV PortV
Definition: hash.h:106

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetReservedKeyIds ( ) const
inline

Definition at line 232 of file hash.h.

232 {return KeyDatV.Reserved();}
TSizeTy Reserved() const
Returns the size of allocated storage capacity.
Definition: ds.h:577
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey , class TDat , class THashFunc >
int THash< 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 444 of file hash.h.

References TRnd::GetUniDevInt(), and IAssert.

Referenced by TNEGraph::GetRndEId(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndEId(), TNEANet::GetRndEId(), TBigNet< TNodeData, IsDir >::GetRndNId(), TNodeNet< TSecTm >::GetRndNId(), TUNGraph::GetRndNId(), TNGraph::GetRndNId(), TNodeEDatNet< TStr, TFltFltH >::GetRndNId(), TNEGraph::GetRndNId(), TNodeEdgeNet< TSecTm, TSecTm >::GetRndNId(), TNEANet::GetRndNId(), TUndirNet::GetRndNId(), TDirNet::GetRndNId(), TBigNet< TNodeData, IsDir >::Rewire(), and TAGMFit::SampleTransition().

444  {
445  IAssert(! Empty());
446  int KeyId = abs(Rnd.GetUniDevInt(KeyDatV.Len()));
447  while (KeyDatV[KeyId].HashCd == -1) { // if the index is empty, just try again
448  KeyId = abs(Rnd.GetUniDevInt(KeyDatV.Len())); }
449  return KeyId;
450 }
#define IAssert(Cond)
Definition: bd.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
bool Empty() const
Definition: hash.h:227
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
int GetUniDevInt(const int &Range=0)
Definition: dt.cpp:39

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::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).

Definition at line 455 of file hash.h.

References TRnd::GetUniDevInt(), and IAssert.

455  {
456  IAssert(! Empty());
457  if (FreeKeys/double(Len()+FreeKeys) > EmptyFrac) { Defrag(); }
458  int KeyId = Rnd.GetUniDevInt(KeyDatV.Len());
459  while (KeyDatV[KeyId].HashCd == -1) { // if the index is empty, just try again
460  KeyId = Rnd.GetUniDevInt(KeyDatV.Len());
461  }
462  return KeyId;
463 }
#define IAssert(Cond)
Definition: bd.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
bool Empty() const
Definition: hash.h:227
void Defrag()
Definition: hash.h:555
TInt FreeKeys
Definition: hash.h:109
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
int GetUniDevInt(const int &Range=0)
Definition: dt.cpp:39
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsAutoSize ( ) const
inline

Definition at line 230 of file hash.h.

Referenced by TGHash< TUInt64 >::IsAutoSize().

230 {return AutoSizeP;}
TBool AutoSizeP
Definition: hash.h:108

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKey ( const TKey &  Key) const
inline

Definition at line 258 of file hash.h.

Referenced by TMMNet::AddCrossNet(), TCrossNet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatE(), TNEANet::AddFltAttrDatE(), TNEANetMP::AddFltAttrDatN(), TNEANet::AddFltAttrDatN(), TCrossNet::AddFltAttrE(), TNEANet::AddFltAttrE(), TNEANet::AddFltAttrN(), TCrossNet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatE(), TNEANet::AddIntAttrDatE(), TNEANetMP::AddIntAttrDatN(), TNEANet::AddIntAttrDatN(), TCrossNet::AddIntAttrE(), TNEANet::AddIntAttrE(), TNEANet::AddIntAttrN(), TMMNet::AddModeNet(), TModeNet::AddNbrType(), TModeNet::AddNeighbor(), TTable::AddNodeAttributes(), TILx::AddRw(), TOLx::AddRw(), TAttr::AddSAttr(), TAttr::AddSAttrDat(), TAttrPair::AddSAttrDat(), TCrossNet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatE(), TNEANet::AddStrAttrDatE(), TNEANetMP::AddStrAttrDatN(), TNEANet::AddStrAttrDatN(), TCrossNet::AddStrAttrE(), TNEANet::AddStrAttrE(), TNEANet::AddStrAttrN(), TArtPointVisitor::BackEdge(), TBiConVisitor::BackEdge(), TLocClustStat::BagOfWhiskers(), TLocClustStat::BagOfWhiskers2(), TNIBs::BSG(), TTable::BuildGraph(), TForestFire::BurnExpFire(), TForestFire::BurnGeoFire(), TTable::CheckAndAddFltNode(), TSnap::CmtyEvolutionFileBatch(), TCrossNet::DelAttrE(), TNEANet::DelAttrE(), TNEANet::DelAttrN(), TMMNet::DelCrossNet(), THash< TPair, THash >::DelIfKey(), TMMNet::DelModeNet(), TModeNet::DelNeighbor(), TNEANet::DelNode(), TAttr::DelSAttrDat(), TAttrPair::DelSAttrDat(), TAGMFast::DotProduct(), TCoda::DotProduct(), TCesna::DotProduct(), TCodaAnalyzer::Draw2ModeCommunity(), TCodaAnalyzer::Dump2ModeCommunities(), TAGMUtil::DumpCmtyVV(), TCesnaUtil::DumpNIDAttrHToMetis(), TSpecFunc::EntropyBias(), TSnap::FastCorePeripheryGC(), TCesnaUtil::FilterLowEntropy(), TArtPointVisitor::FinishNode(), TBiConVisitor::FinishNode(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), TCrossNet::GetAttrTypeE(), TModeNet::GetAttrTypeN(), TZipIn::GetCmd(), TZipOut::GetCmd(), TTable::GetColIdx(), TTable::GetCollidingRows(), TMMNet::GetCrossId(), TMMNet::GetCrossName(), TCnCom::GetDfsVisitor(), TTimeNENet::GetEdgeTmBuckets(), THttpRq::GetFldVal(), THttpResp::GetFldVal(), THttpResp::GetFldValV(), TCrossNet::GetFltAttrDefaultE(), TNEANet::GetFltAttrDefaultE(), TNEANet::GetFltAttrDefaultN(), TTable::GetFltRowIdxByVal(), TNIBs::GetGroundTruthGraphAtT(), TNIBs::GetGroundTruthNetworkAtT(), TSnap::GetGroupDegreeCentr(), TSnap::GetGroupDegreeCentr0(), TAttr::GetIdVSAttr(), TAttrPair::GetIdVSAttr(), TNIBs::GetInferredGraphAtT(), TNIBs::GetInferredNetworkAtT(), TCrossNet::GetIntAttrDefaultE(), TNEANet::GetIntAttrDefaultE(), TNEANet::GetIntAttrDefaultN(), TTable::GetIntRowIdxByVal(), TMMNet::GetModeId(), TMMNet::GetModeName(), TMaxPriorityQueue< TVal >::GetPriority(), TAttr::GetSAttrDat(), TAttrPair::GetSAttrDat(), TAttr::GetSAttrId(), TAttrPair::GetSAttrId(), TAttr::GetSAttrName(), TAttrPair::GetSAttrName(), TAttr::GetSAttrV(), TAttrPair::GetSAttrV(), TCrossNet::GetStrAttrDefaultE(), TNEANet::GetStrAttrDefaultE(), TNEANet::GetStrAttrDefaultN(), TTable::GetStrRowIdxByMap(), TMMNet::GetSubgraphByCrossNet(), TMMNet::GetSubgraphByModeNet(), TTimeNet::GetTmBuckets(), TTimeNENet::GetTmBuckets(), TGStat::GetVal(), TGStat::GetValStr(), TSnap::GetWeightedShortestPath(), TUniTrie< TInt >::Has1Gram(), TGStat::HasVal(), TSnap::TSnapDetail::inComp(), TNetInfBs::Init(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TSnap::Intersect(), TSnap::IntFlowBiDBFS(), TNEANet::IntVAttrValueEI(), TNEANet::IntVAttrValueNI(), THtmlTok::IsBreakTag(), TNIBs::IsCascade(), TTable::IsColName(), TNIBs::IsDomainNm(), TCrossNet::IsEdge(), TNEGraph::IsEdge(), TNodeEdgeNet< TSecTm, TSecTm >::IsEdge(), TNEANet::IsEdge(), THttpRq::IsFldNm(), THttpResp::IsFldNm(), TNEANetMP::IsFltAttrE(), TNEANet::IsFltAttrE(), TNEANetMP::IsIntAttrE(), TNEANet::IsIntAttrE(), TGHash< TUInt64 >::IsKey(), TUnionFind::IsKey(), THash< TPair, THash >::IsKeyGetDat(), TBPGraph::IsLNode(), TCascade::IsNode(), TBigNet< TNodeData, IsDir >::IsNode(), TNodeNet< TSecTm >::IsNode(), TUNGraph::IsNode(), TNGraph::IsNode(), TNodeEDatNet< TStr, TFltFltH >::IsNode(), TNEGraph::IsNode(), TNodeEdgeNet< TSecTm, TSecTm >::IsNode(), TNEANet::IsNode(), TUndirNet::IsNode(), TDirNet::IsNode(), TNetInfBs::IsNodeNm(), TNIBs::IsNodeNm(), TBPGraph::IsRNode(), TNEANetMP::IsStrAttrE(), TNEANet::IsStrAttrE(), TZipIn::IsZipExt(), TZipOut::IsZipExt(), TTable::Join(), LearnEmbeddings(), TTimeNet::LoadArxiv(), TNIBs::LoadInferredNodesTxt(), TNIBs::LoadInferredTxt(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), TSnap::TSnapDetail::MapEquationNew2Modules(), MapIdsToFirstN(), TSnap::TSnapDetail::TCNMQMatrix::MergeBestQ(), TCoda::MLEGradAscentParallel(), TD34GraphCounter::operator()(), TDGraphCounter::operator()(), TGStat::operator<(), THash< TKey, TDat, THashFunc >::operator==(), PreprocessNode(), TSnap::ReebRefine(), TModeNet::RemoveCrossNets(), TTable::RequestIndexFlt(), TTable::RequestIndexInt(), TTable::RequestIndexStrMap(), TBigNet< TNodeData, IsDir >::Rewire(), TAGMUtil::RewireCmtyNID(), TAGMFit::SampleTransition(), TAGMUtil::SaveBipartiteGephi(), TNIBs::SaveCascades(), TAGMUtil::SaveGephi(), TNetInfBs::SaveGroundTruth(), TNIBs::SaveGroundTruth(), TNIBs::SaveGroundTruthPajek(), TSnap::SaveGViz(), TNIBs::SaveInferred(), TNIBs::SaveInferredEdges(), TNIBs::SaveInferredPajek(), TSnap::SavePajek(), TNIBs::SaveSites(), TTable::SelfSimJoinPerGroup(), TMaxPriorityQueue< TVal >::SetPriority(), TNIBs::SG(), TUniChDb::TestComposition(), TTable::ThresholdJoinCountCollisions(), TTable::ThresholdJoinCountPerJoinKeyCollisions(), TSnap::ToNetwork(), TMMNet::ToNetwork(), TMMNet::ToNetwork2(), TMMNet::ToNetworkMP(), TSnap::ToNetworkMP(), TNIBs::UpdateDiff(), TTable::UpdateFltFromTable(), TTable::UpdateGrouping(), and TUniChDb::TSubcatHelper::~TSubcatHelper().

258 {return GetKeyId(Key)!=-1;}
int GetKeyId(const TKey &Key) const
Definition: hash.h:466

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKey ( const TKey &  Key,
int &  KeyId 
) const
inline

Definition at line 259 of file hash.h.

259 { KeyId=GetKeyId(Key); return KeyId!=-1;}
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyGetDat ( const TKey &  Key,
TDat &  Dat 
) const
inline

Definition at line 274 of file hash.h.

Referenced by TSnap::GetBfsEffDiam(), TXmlLx::IsEntityNm(), TGHash< TUInt64 >::IsKeyGetDat(), TBigNet< TNodeData, IsDir >::IsNode(), and TXmlLx::IsPEntityNm().

274  {int KeyId;
275  if (IsKey(Key, KeyId)){Dat=GetHashKeyDat(KeyId).Dat; return true;}
276  else {return false;}}
TDat Dat
Definition: hash.h:13
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyId ( const int &  KeyId) const
inline

Definition at line 260 of file hash.h.

Referenced by TGHash< TUInt64 >::IsKeyId().

260  {
261  return (0<=KeyId)&&(KeyId<KeyDatV.Len())&&(KeyDatV[KeyId].HashCd!=-1);}
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN ( ) const
inline
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::Len ( ) const
inline

Definition at line 228 of file hash.h.

Referenced by TNIBs::AddCasc(), TNIBs::AddDomainNm(), TModeNet::AddIntVAttrByHashN(), TGnuPlot::AddPlot(), TILx::AddRw(), TOLx::AddRw(), TTable::Aggregate(), TLocClust::ApproxPageRank(), AssignBinValue(), ProcessedGraph::assignWeights_undir(), TLocClustStat::BagOfWhiskers(), TLocClustStat::BagOfWhiskers2(), THash< TPair, THash >::BegI(), TNIBs::BSG(), TForestFire::BurnExpFire(), TForestFire::BurnGeoFire(), TTable::CheckAndAddFltNode(), TSnap::TSnapDetail::TCNMQMatrix::CmtyCMN(), TSnap::CmtyEvolutionFileBatch(), TSnap::CmtyEvolutionFileBatchV(), TSnap::CmtyEvolutionJson(), ConvertFeatureToMatrix(), TMom::Def(), TAGMFast::DotProduct(), TCoda::DotProduct(), TCesna::DotProduct(), TUnionFind::Dump(), TCoda::DumpMemberships(), TCesnaUtil::DumpNIDAttrHToNIDK(), THash< TPair, THash >::Empty(), TSnap::TSnapDetail::Equation(), TSnap::FastCorePeriphery(), TSnap::FastCorePeripheryGC(), TNIBs::FG(), TCesnaUtil::FilterLowEntropy(), TLocClust::FindBestCut(), TNIBs::GenCascade(), TCesnaUtil::GetAttrs(), TSnap::GetBfsEffDiam(), TSnap::GetBfsTree(), TNIBs::GetCascs(), TSnap::GetClustCf(), TMMNet::GetCrossNets(), TLocClustStat::GetCurveStat(), TSnap::GetDegCnt(), TCrossNet::GetEdges(), TNEGraph::GetEdges(), TNodeEdgeNet< TSecTm, TSecTm >::GetEdges(), TNEANet::GetEdges(), TSnap::GetEigenVectorCentr(), TSnap::GetGroupDegreeCentr(), TSnap::GetGroupDegreeCentr0(), TSnap::GetGroupFarnessCentr(), TSnap::GetHits(), TSnap::GetHitsMP(), TSnap::GetInDegCnt(), TBPGraph::GetLNodes(), TCascade::GetMaxTm(), TMMNet::GetModeNets(), TSnap::GetNodeEcc(), TAGMUtil::GetNodeMembership(), TBigNet< TNodeData, IsDir >::GetNodes(), TNodeNet< TSecTm >::GetNodes(), TUNGraph::GetNodes(), TNGraph::GetNodes(), TNodeEDatNet< TStr, TFltFltH >::GetNodes(), TNEGraph::GetNodes(), TNodeEdgeNet< TSecTm, TSecTm >::GetNodes(), TNEANet::GetNodes(), TUndirNet::GetNodes(), TDirNet::GetNodes(), TSnap::GetNodesAtHop(), TSnap::GetNodesAtHops(), TBreathFS< PGraph >::GetNVisited(), TSnap::GetOutDegCnt(), TSnap::GetPageRank_v1(), TBPGraph::GetRNodes(), TSnap::GetShortPath(), TLxSymStr::GetSSym(), TAGMFast::GetStepSizeByLineSearch(), TCoda::GetStepSizeByLineSearch(), TCesna::GetStepSizeByLineSearch(), THttpRq::GetStr(), TSnap::GetSubTreeSz(), TCoda::GetTopCIDs(), TGStat::GetVals(), TSnap::GetWeightedPageRank(), TCoda::GradientForNode(), TAGMFast::GradientForRow(), TCesna::GradientForRow(), TSnap::Infomap(), TSnap::InfomapOnline(), TUniChDb::InitScripts(), THtmlTok::IsBreakTag(), TNIBs::LabelBurstAutomaton(), TD34GraphCounter::Len(), TCascade::Len(), TGHash< TUInt64 >::Len(), TUnionFind::Len(), TNetConstraint< PGraph >::Len(), TCascade::LenAfterT(), TCascade::LenBeforeT(), TTimeNet::LoadArxiv(), TAGMUtil::LoadEdgeListStr(), TNIBs::LoadGroundTruthTxt(), TNIBs::LoadInferredTxt(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), TCesna::MLEGradAscent(), TAGMFast::MLEGradAscentParallel(), TCoda::MLEGradAscentParallel(), TCesna::MLEGradAscentParallel(), THash< TKey, TDat, THashFunc >::operator==(), TSnap::PlotShortPathDistr(), TGnuPlot::PlotValCntH(), TGnuPlot::PlotValRank(), TSnap::PrintInfo(), TAGMFit::PrintSummary(), TSnap::ReebRefine(), TBigNet< TNodeData, IsDir >::Rewire(), TAGMUtil::RewireCmtyNID(), TAGMFit::SampleTransition(), TKeyDatFl< TKey, TDat, THashFunc >::Save(), TNIBs::SaveGroundTruthPajek(), TNIBs::SaveInferredPajek(), TBigNet< TNodeData, IsDir >::SaveToDisk(), TTable::SelfSimJoinPerGroup(), TCesna::SetGraph(), TNIBs::SG(), TLocClust::SupportSweep(), and MAPPR::sweepAPPR().

228 {return KeyDatV.Len()-FreeKeys;}
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt FreeKeys
Definition: hash.h:109
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Load ( TSIn SIn)
inline

Definition at line 177 of file hash.h.

Referenced by TAttr::Load(), TAGMFit::Load(), TUniCaseFolding::Load(), TUniChDb::Load(), and TBigNet< TNodeData, IsDir >::LoadNodeDatH().

177  {
178  PortV.Load(SIn); KeyDatV.Load(SIn);
179  AutoSizeP=TBool(SIn); FFreeKeyId=TInt(SIn); FreeKeys=TInt(SIn);
180  SIn.LoadCs();
181  }
void Load(TSIn &SIn)
Definition: ds.h:946
virtual void LoadCs()
Definition: fl.cpp:28
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
Definition: dt.h:971

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::LoadShM ( TShMIn ShMIn)
inline

Load THash from shared memory file. Copying/Deleting Keys is illegal.

Definition at line 157 of file hash.h.

Referenced by TUNGraph::LoadGraphShM(), TNGraph::LoadGraphShM(), TNodeNet< TSecTm >::LoadNetworkShM(), TMMNet::LoadNetworkShM(), TNodeEDatNet< TStr, TFltFltH >::LoadNetworkShM(), TNodeEdgeNet< TSecTm, TSecTm >::LoadNetworkShM(), TUndirNet::LoadNetworkShM(), TDirNet::LoadNetworkShM(), TModeNet::LoadShM(), TCrossNet::LoadShM(), and TTable::LoadTableShM().

157  {
158  PortV.LoadShM(ShMIn);
159  KeyDatV.Load(ShMIn);
160  AutoSizeP=TBool(ShMIn);
161  FFreeKeyId=TInt(ShMIn);
162  FreeKeys=TInt(ShMIn);
163  ShMIn.LoadCs();
164  }
void Load(TSIn &SIn)
Definition: ds.h:946
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
Definition: dt.h:1134
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
Definition: ds.h:932
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
Definition: dt.h:971
void LoadCs()
Definition: fl.h:408

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
template<typename TDatInitFn >
void THash< TKey, TDat, THashFunc >::LoadShM ( TShMIn ShMIn,
TDatInitFn  Fn 
)
inline

Load THash from shared memory passing in the Dat initializer.

Definition at line 167 of file hash.h.

167  {
168  TLoadTHKeyDatInitializer<TDatInitFn> HKeyDatFn(Fn);
169  PortV.LoadShM(ShMIn);
170  KeyDatV.LoadShM(ShMIn, HKeyDatFn);
171  AutoSizeP=TBool(ShMIn);
172  FFreeKeyId=TInt(ShMIn);
173  FreeKeys=TInt(ShMIn);
174  ShMIn.LoadCs();
175  }
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
Definition: dt.h:1134
void LoadShM(TShMIn &ShMIn)
Constructs the vector from a shared memory input.
Definition: ds.h:932
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
Definition: dt.h:971
void LoadCs()
Definition: fl.h:408
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::LoadXml ( const PXmlTok XmlTok,
const TStr Nm = "" 
)

Definition at line 127 of file xmlser.h.

References TVec< TVal, TSizeTy >::Len(), XLoad, and XLoadHd.

127  {
129  for (int KeyDatN=0; KeyDatN<KeyDatV.Len(); KeyDatN++){
130  AddDat(KeyDatV[KeyDatN].Key, KeyDatV[KeyDatN].Dat);}}
#define XLoadHd(Nm)
Definition: bd.h:312
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
#define XLoad(Nm)
Definition: bd.h:315
TBool AutoSizeP
Definition: hash.h:108
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430

Here is the call graph for this function:

template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::MarkDelKey ( const TKey &  Key)

Definition at line 426 of file hash.h.

References IAssert, and IAssertR.

Referenced by THash< TPair, THash >::MarkDelKeyId().

426  {
427  // MarkDelKey is same as Delkey except last two lines
428  IAssert(!PortV.Empty());
429  const int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len());
430  const int HashCd=abs(THashFunc::GetSecHashCd(Key));
431  int PrevKeyId=-1;
432  int KeyId=PortV[PortN];
433  while ((KeyId!=-1) &&
434  !((KeyDatV[KeyId].HashCd==HashCd) && (KeyDatV[KeyId].Key==Key))){
435  PrevKeyId=KeyId; KeyId=KeyDatV[KeyId].Next;}
436  IAssertR(KeyId!=-1, Key.GetStr());
437  if (PrevKeyId==-1){PortV[PortN]=KeyDatV[KeyId].Next;}
438  else {KeyDatV[PrevKeyId].Next=KeyDatV[KeyId].Next;}
439  KeyDatV[KeyId].Next=FFreeKeyId; FFreeKeyId=KeyId; FreeKeys++;
440  KeyDatV[KeyId].HashCd=TInt(-1);
441 }
#define IAssert(Cond)
Definition: bd.h:262
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TInt FreeKeys
Definition: hash.h:109
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570
Definition: dt.h:1134
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::MarkDelKeyId ( const int &  KeyId)
inline

Definition at line 250 of file hash.h.

250 {MarkDelKey(GetKey(KeyId));}
void MarkDelKey(const TKey &Key)
Definition: hash.h:426
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::operator() ( const TKey &  Key)
inline

Definition at line 200 of file hash.h.

200 {return AddDat(Key);}
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::operator< ( const THash< TKey, TDat, THashFunc > &  Hash) const
inline

Definition at line 196 of file hash.h.

196 { Fail; return true; }
#define Fail
Definition: bd.h:238
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash& THash< TKey, TDat, THashFunc >::operator= ( const THash< TKey, TDat, THashFunc > &  Hash)
inline

Definition at line 190 of file hash.h.

190  {
191  if (this!=&Hash){
192  PortV=Hash.PortV; KeyDatV=Hash.KeyDatV; AutoSizeP=Hash.AutoSizeP;
194  return *this;}
TInt FreeKeys
Definition: hash.h:109
TBool AutoSizeP
Definition: hash.h:108
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey , class TDat , class THashFunc >
bool THash< TKey, TDat, THashFunc >::operator== ( const THash< TKey, TDat, THashFunc > &  Hash) const

Definition at line 350 of file hash.h.

References THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and THash< TKey, TDat, THashFunc >::Len().

350  {
351  if (Len() != Hash.Len()) { return false; }
352  for (int i = FFirstKeyId(); FNextKeyId(i); ) {
353  const TKey& Key = GetKey(i);
354  if (! Hash.IsKey(Key)) { return false; }
355  if (GetDat(Key) != Hash.GetDat(Key)) { return false; }
356  }
357  return true;
358 }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
bool IsKey(const TKey &Key) const
Definition: hash.h:258
int Len() const
Definition: hash.h:228
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TDat& THash< TKey, TDat, THashFunc >::operator[] ( const int &  KeyId) const
inline

The [] operator takes KeyId, use GetDat() if you need value access via the key.

Definition at line 198 of file hash.h.

198 {return GetHashKeyDat(KeyId).Dat;}
TDat Dat
Definition: hash.h:13
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::operator[] ( const int &  KeyId)
inline

Definition at line 199 of file hash.h.

199 {return GetHashKeyDat(KeyId).Dat;}
TDat Dat
Definition: hash.h:13
THKeyDat & GetHashKeyDat(const int &KeyId)
Definition: hash.h:136
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Pack ( )
inline

Definition at line 289 of file hash.h.

Referenced by TUNGraph::Defrag(), TUndirNet::Defrag(), and TGHash< TUInt64 >::Pack().

289 {KeyDatV.Pack();}
void Pack()
Reduces vector capacity (frees memory) to match its size.
Definition: ds.h:1057
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the caller graph for this function:

template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Resize ( )
private

Definition at line 319 of file hash.h.

References THashKeyDat< TKey, TDat >::HashCd, THashKeyDat< TKey, TDat >::Key, and THashKeyDat< TKey, TDat >::Next.

319  {
320  // resize & initialize port vector
321  //if (PortV.Len()==0){PortV.Gen(17);}
322  //else {PortV.Gen(2*PortV.Len()+1);}
323  if (PortV.Len()==0){
324  PortV.Gen(17);
325  } else if (AutoSizeP&&(KeyDatV.Len()>2*PortV.Len())){
327  } else {
328  return;
329  }
330  PortV.PutAll(TInt(-1));
331  // rehash keys
332  for (int KeyId=0; KeyId<KeyDatV.Len(); KeyId++){
333  THKeyDat& KeyDat=KeyDatV[KeyId];
334  if (KeyDat.HashCd!=-1){
335  const int PortN = abs(THashFunc::GetPrimHashCd(KeyDat.Key) % PortV.Len());
336  KeyDat.Next=PortV[PortN];
337  PortV[PortN]=KeyId;
338  }
339  }
340 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TBool AutoSizeP
Definition: hash.h:108
THashKeyDat< TKey, TDat > THKeyDat
Definition: hash.h:104
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
Definition: dt.h:1134
uint GetNextPrime(const uint &Val) const
Definition: hash.h:307
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Save ( TSOut SOut) const
inline
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::SaveXml ( TSOut SOut,
const TStr Nm 
)

Definition at line 133 of file xmlser.h.

References XSave, and XSaveHd.

133  {
#define XSaveHd(Nm)
Definition: bd.h:318
#define XSave(Nm)
Definition: bd.h:333
void Defrag()
Definition: hash.h:555
TBool AutoSizeP
Definition: hash.h:108
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Sort ( const bool &  CmpKey,
const bool &  Asc 
)

Definition at line 570 of file hash.h.

References IAssertR, and THashKeyDat< TKey, TDat >::Next.

Referenced by THash< TPair, THash >::SortByDat(), and THash< TPair, THash >::SortByKey().

570  {
571  IAssertR(IsKeyIdEqKeyN(), "THash::Sort only works when table has no deleted keys.");
572  TIntV TargV(Len()), MapV(Len()), StateV(Len());
573  for (int i = 0; i < TargV.Len(); i++) {
574  TargV[i] = i; MapV[i] = i; StateV[i] = i;
575  }
576  // sort KeyIds
577  THashKeyDatCmp HashCmp(*this, CmpKey, Asc);
578  TargV.SortCmp(HashCmp);
579  // now sort the update vector
581  for (int i = 0; i < TargV.Len()-1; i++) {
582  const int SrcPos = MapV[TargV[i]];
583  const int Loc = i;
584  // swap data
585  Tmp = KeyDatV[SrcPos];
586  KeyDatV[SrcPos] = KeyDatV[Loc];
587  KeyDatV[Loc] = Tmp;
588  // swap keys
589  MapV[StateV[i]] = SrcPos;
590  StateV.Swap(Loc, SrcPos);
591  }
592  for (int i = 0; i < TargV.Len(); i++) {
593  MapV[TargV[i]] = i; }
594  for (int p = 0; p < PortV.Len(); p++) {
595  if (PortV[p] != -1) {
596  PortV[p] = MapV[PortV[p]]; } }
597  for (int i = 0; i < KeyDatV.Len(); i++) {
598  if (KeyDatV[i].Next != -1) {
599  KeyDatV[i].Next = MapV[KeyDatV[i].Next]; }
600  }
601 }
bool IsKeyIdEqKeyN() const
Definition: hash.h:233
#define IAssertR(Cond, Reason)
Definition: bd.h:265
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107
int Len() const
Definition: hash.h:228

Here is the caller graph for this function:

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::SortByKey ( const bool &  Asc = true)
inline
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Swap ( THash< TKey, TDat, THashFunc > &  Hash)

Definition at line 544 of file hash.h.

References THash< TKey, TDat, THashFunc >::AutoSizeP, THash< TKey, TDat, THashFunc >::FFreeKeyId, THash< TKey, TDat, THashFunc >::FreeKeys, THash< TKey, TDat, THashFunc >::KeyDatV, THash< TKey, TDat, THashFunc >::PortV, and Swap().

Referenced by TSnap::GetShortPath().

544  {
545  if (this!=&Hash){
546  PortV.Swap(Hash.PortV);
547  KeyDatV.Swap(Hash.KeyDatV);
548  ::Swap(AutoSizeP, Hash.AutoSizeP);
550  ::Swap(FreeKeys, Hash.FreeKeys);
551  }
552 }
TInt FreeKeys
Definition: hash.h:109
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
Definition: ds.h:1101
void Swap(THash &Hash)
Definition: hash.h:544
TBool AutoSizeP
Definition: hash.h:108
TInt FFreeKeyId
Definition: hash.h:109
TIntV PortV
Definition: hash.h:106
TVec< THKeyDat > KeyDatV
Definition: hash.h:107

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TBool THash< TKey, TDat, THashFunc >::AutoSizeP
private
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TInt THash< TKey, TDat, THashFunc >::FFreeKeyId
private
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TInt THash< TKey, TDat, THashFunc >::FreeKeys
private
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const unsigned int THash< TKey, TDat, THashFunc >::HashPrimeT
static
Initial value:
={
3ul, 5ul, 11ul, 23ul,
53ul, 97ul, 193ul, 389ul, 769ul,
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
1610612741ul, 3221225473ul, 4294967291ul
}

Definition at line 100 of file hash.h.


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