SNAP Library, Developer Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TGHash< TDat > Class Template Reference

#include <ghash.h>

Collaboration diagram for TGHash< TDat >:

List of all members.

Public Types

typedef THash< TGraphKey, TDat >
::TIter 
TIter

Public Member Functions

 TGHash (const bool &HashTrees, const int &MaxIsoCheck=8, const int &MaxSvdGraph=500)
 TGHash (TSIn &SIn)
void Save (TSOut &SOut) const
const TDat & operator[] (const int &KeyId) const
TDat & operator[] (const int &KeyId)
const TDat & operator() (const TGraphKey &Key) const
TDat & operator() (const TGraphKey &Key)
TIter BegI () const
TIter EndI () const
TIter GetI (const int &KeyId) const
bool HashTrees () const
void Gen (const int &Ports)
void Clr (const bool &DoDel=true, const int &NoDelLim=-1)
bool Empty () const
int Len () const
int GetPorts () const
bool IsAutoSize () const
int GetMxKeyIds () const
bool IsKeyIdEqKeyN () const
int AddKey (const PNGraph &Graph)
TDat & AddDat (const PNGraph &Graph)
TDat & AddDat (const PNGraph &Graph, const TDat &Dat)
bool IsKey (const PNGraph &Graph) const
int GetKeyId (const PNGraph &Graph) const
const TDat & GetDat (const PNGraph &Graph) const
TDat & GetDat (const PNGraph &Graph)
const TGraphKeyGetKey (const int &KeyId) const
int GetKeyId (const TGraphKey &Key) const
bool IsKey (const TGraphKey &Key) const
bool IsKey (const TGraphKey &Key, int &KeyId) const
bool IsKeyId (const int &KeyId) const
const TDat & GetDat (const TGraphKey &Key) const
TDat & GetDat (const TGraphKey &Key)
const TDat & GetDatId (const int &KeyId) const
TDat & GetDatId (const int &KeyId)
void GetKeyDat (const int &KeyId, TGraphKey &Key, TDat &Dat) const
bool IsKeyGetDat (const TGraphKey &Key, TDat &Dat) const
bool GetNodeMap (const PNGraph &Graph, TIntPrV &NodeMapV) const
bool GetNodeMap (const PNGraph &Graph, TIntPrV &NodeMapV, int &KeyId) const
int FFirstKeyId () const
bool FNextKeyId (int &KeyId) const
void GetKeyV (TVec< TGraphKey > &KeyV) const
void GetDatV (TVec< TDat > &DatV) const
void GetKeyIdByDat (TIntV &KeyIdV, const bool &Asc=true) const
void GetKeyIdByGSz (TIntV &KeyIdV, const bool &Asc=true) const
void GetKeyDatPrV (TVec< TPair< TGraphKey, TDat > > &KeyDatPrV) const
void GetDatKeyPrV (TVec< TPair< TDat, TGraphKey > > &DatKeyPrV) const
void Defrag ()
void Pack ()
void DrawGViz (const int &KeyId, const TStr &OutFNmPref, const TStr &OutputType="gif", TStr Desc="") const
void DrawGViz (const TIntV &KeyIdV, const TStr &OutFNmPref, const TStr &OutputType="gif") const
void SaveTxt (const TStr &OutFNm, const TStr &Desc, const TStr &DatColNm, const bool &SortByKeyVal=true) const
void SaveDetailTxt (const TStr &OutFNm, const TStr &Desc, const TStr &DatColNm) const

Private Member Functions

void InitPermutations ()
int IsGetKeyId (const PNGraph &Graph) const
int IsGetKeyId (const PNGraph &Graph, TGraphKey &GKey) const
int IsGetKeyId (const PNGraph &Graph, TGraphKey &GKey, TIntPrV &NodeMap) const

Private Attributes

TInt MxIsoCheck
TInt MxSvdGraph
THash< TInt, TVec< TIntV > > GSzToPermH
TBool HashOnlyTrees
THash< TGraphKey, TDat > GraphH

Detailed Description

template<class TDat>
class TGHash< TDat >

Graph Hash Table, a hash table where keys are (little) undirected graphs. Class is useful for counting frequencies of small subgraphs or information cascades.

Definition at line 50 of file ghash.h.


Member Typedef Documentation

template<class TDat>
typedef THash<TGraphKey, TDat>::TIter TGHash< TDat >::TIter

Definition at line 52 of file ghash.h.


Constructor & Destructor Documentation

template<class TDat >
TGHash< TDat >::TGHash ( const bool &  HashTrees,
const int &  MaxIsoCheck = 8,
const int &  MaxSvdGraph = 500 
)

Definition at line 149 of file ghash.h.

References TGHash< TDat >::InitPermutations().

                                                                                          :
 MxIsoCheck(MaxIsoCheck), MxSvdGraph(MaxSvdGraph), GSzToPermH(), HashOnlyTrees(HashTrees), GraphH() {
  if (! HashTrees) {
    InitPermutations();
  }
}

Here is the call graph for this function:

template<class TDat >
TGHash< TDat >::TGHash ( TSIn SIn)

Definition at line 157 of file ghash.h.

References TGHash< TDat >::HashOnlyTrees, and TGHash< TDat >::InitPermutations().

                              : MxIsoCheck(SIn), MxSvdGraph(SIn), GSzToPermH(), HashOnlyTrees(SIn), GraphH(SIn) {
  if (! HashOnlyTrees) {
    InitPermutations();
  }
}

Here is the call graph for this function:


Member Function Documentation

template<class TDat>
TDat& TGHash< TDat >::AddDat ( const PNGraph Graph) [inline]

Definition at line 89 of file ghash.h.

Referenced by TDGHashGraphCounter::operator()().

{ return GraphH[AddKey(Graph)]; }

Here is the caller graph for this function:

template<class TDat>
TDat& TGHash< TDat >::AddDat ( const PNGraph Graph,
const TDat &  Dat 
) [inline]

Definition at line 90 of file ghash.h.

{ return GraphH[AddKey(Graph)] = Dat; }
template<class TDat >
int TGHash< TDat >::AddKey ( const PNGraph Graph)

Definition at line 172 of file ghash.h.

References Fail, TGraphKey::GetNodes(), TSnap::GetTreeSig(), IAssert, TGraphKey::IsIsomorph(), TSnap::IsTree(), TGraphKey::SetVariant(), TGraphKey::TakeGraph(), and TGraphKey::TakeSig().

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

                                             {
  if (HashOnlyTrees) {
    int RootNId;  IAssert(TSnap::IsTree(Graph, RootNId));
    TIntV TreeSig;  TSnap::GetTreeSig(Graph, RootNId, TreeSig);
    TGraphKey GKey(TreeSig);
    const int KeyId = GraphH.GetKeyId(GKey);
    if (KeyId == -1) {
      GKey.TakeGraph(Graph);
      return GraphH.AddKey(GKey);
    }
    return KeyId;
  } else {
    TGraphKey GKey;
    GKey.TakeSig(Graph, MxIsoCheck+1, MxSvdGraph); // get signature
    const int Nodes = GKey.GetNodes();
    if (Nodes > 2 && Nodes <= MxIsoCheck) {
      GKey.TakeGraph(Graph);
      // check all variants with same signature
      for (int variant = 1; ; variant++) {
        GKey.SetVariant(variant);
        int KeyId = GraphH.GetKeyId(GKey);
        if (KeyId == -1) {
          KeyId = GraphH.AddKey(GKey);
          //printf("  new variant: %d (%d)\n", KeyId, variant);
          return KeyId;

        }
        if (TGraphKey::IsIsomorph(GKey, GraphH.GetKey(KeyId), GSzToPermH.GetDat(Nodes))) {
          //printf("  isomorphic to: %d\n", KeyId);
          return KeyId;
        } // found isomorphic graph
      }
    } else {
      const int KeyId = GraphH.GetKeyId(GKey);
      if (KeyId == -1) {
        GKey.TakeGraph(Graph);
        return GraphH.AddKey(GKey);
      }
      return KeyId;
    }
  }
  Fail;
  return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TDat>
TIter TGHash< TDat >::BegI ( ) const [inline]

Definition at line 73 of file ghash.h.

{ return GraphH.BegI(); }
template<class TDat>
void TGHash< TDat >::Clr ( const bool &  DoDel = true,
const int &  NoDelLim = -1 
) [inline]

Definition at line 80 of file ghash.h.

{ GraphH.Clr(DoDel, NoDelLim); }
template<class TDat>
void TGHash< TDat >::Defrag ( ) [inline]

Definition at line 122 of file ghash.h.

{ GraphH.Defrag(); }
template<class TDat >
void TGHash< TDat >::DrawGViz ( const int &  KeyId,
const TStr OutFNmPref,
const TStr OutputType = "gif",
TStr  Desc = "" 
) const

Definition at line 328 of file ghash.h.

References TStr::CStr(), TStr::Fmt(), TGraphKey::GetEdges(), TGraphKey::GetNodes(), TSnap::TSnapDetail::GVizDoLayout(), gvlDot, IAssert, and TGraphKey::SaveGViz().

                                                                                                             {
  IAssert(OutputType == "ps" || OutputType == "gif" || OutputType == "png");
  const TGraphKey& GKey = GetKey(KeyId);
  const TStr Desc1 = TStr::Fmt("%s (%d, %d)", Desc.CStr(), GKey.GetNodes(), GKey.GetEdges());
  GKey.SaveGViz(OutFNmPref+".dot", Desc1);
  TSnap::TSnapDetail::GVizDoLayout(OutFNmPref+".dot", OutFNmPref+"."+OutputType, gvlDot);
}

Here is the call graph for this function:

template<class TDat >
void TGHash< TDat >::DrawGViz ( const TIntV KeyIdV,
const TStr OutFNmPref,
const TStr OutputType = "gif" 
) const

Definition at line 337 of file ghash.h.

References TStr::CStr(), TStr::Fmt(), FNm, TGraphKey::GetEdges(), TGraphKey::GetNodes(), TExeTm::GetTmStr(), TSnap::TSnapDetail::GVizDoLayout(), gvlDot, IAssert, TVec< TVal >::Len(), and TGraphKey::SaveGViz().

                                                                                                     {
  IAssert(OutputType == "ps" || OutputType == "gif" || OutputType == "png");
  TExeTm ExeTm;
  printf("Plotting %d graphs\n", KeyIdV.Len());
  for (int i = 0; i < KeyIdV.Len(); i++) {
    const TStr FNm = TStr::Fmt("%s.%03d.key%d.", OutFNmPref.CStr(), i+1, KeyIdV[i]());
    const TStr Desc = TStr::Fmt("KeyId:%d", KeyIdV[i]());
    const TGraphKey& GKey = GetKey(KeyIdV[i]);
    printf("\r  %d  g(%d, %d)    ", i, GKey.GetNodes(), GKey.GetEdges());
    GKey.SaveGViz(FNm+"dot", Desc);
    TSnap::TSnapDetail::GVizDoLayout(FNm+"dot", FNm+OutputType, gvlDot);
  }
  printf("done [%s].\n", ExeTm.GetTmStr());
}

Here is the call graph for this function:

template<class TDat>
bool TGHash< TDat >::Empty ( ) const [inline]

Definition at line 81 of file ghash.h.

{ return GraphH.Empty(); }
template<class TDat>
TIter TGHash< TDat >::EndI ( ) const [inline]

Definition at line 74 of file ghash.h.

{ return GraphH.EndI(); }
template<class TDat>
int TGHash< TDat >::FFirstKeyId ( ) const [inline]

Definition at line 113 of file ghash.h.

{ return 0-1; }
template<class TDat>
bool TGHash< TDat >::FNextKeyId ( int &  KeyId) const [inline]

Definition at line 114 of file ghash.h.

{ return GraphH.FNextKeyId(KeyId); }
template<class TDat>
void TGHash< TDat >::Gen ( const int &  Ports) [inline]

Definition at line 79 of file ghash.h.

{ GraphH.Gen(Ports); }
template<class TDat>
const TDat& TGHash< TDat >::GetDat ( const PNGraph Graph) const [inline]

Definition at line 94 of file ghash.h.

Referenced by TDGHashGraphCounter::operator()().

{ return GraphH[GetKeyId(Graph)]; }

Here is the caller graph for this function:

template<class TDat>
TDat& TGHash< TDat >::GetDat ( const PNGraph Graph) [inline]

Definition at line 95 of file ghash.h.

{ return GraphH[GetKeyId(Graph)]; }
template<class TDat>
const TDat& TGHash< TDat >::GetDat ( const TGraphKey Key) const [inline]

Definition at line 102 of file ghash.h.

{ return GraphH.GetDat(Key); }
template<class TDat>
TDat& TGHash< TDat >::GetDat ( const TGraphKey Key) [inline]

Definition at line 103 of file ghash.h.

{ return GraphH.GetDat(Key); }
template<class TDat>
const TDat& TGHash< TDat >::GetDatId ( const int &  KeyId) const [inline]

Definition at line 104 of file ghash.h.

{ return GraphH[KeyId]; }
template<class TDat>
TDat& TGHash< TDat >::GetDatId ( const int &  KeyId) [inline]

Definition at line 105 of file ghash.h.

{ return GraphH[KeyId]; }
template<class TDat>
void TGHash< TDat >::GetDatKeyPrV ( TVec< TPair< TDat, TGraphKey > > &  DatKeyPrV) const [inline]

Definition at line 120 of file ghash.h.

{ GraphH.GetDatKeyPrV(DatKeyPrV); }
template<class TDat>
void TGHash< TDat >::GetDatV ( TVec< TDat > &  DatV) const [inline]

Definition at line 116 of file ghash.h.

{ GraphH.GetDatV(DatV); }
template<class TDat>
TIter TGHash< TDat >::GetI ( const int &  KeyId) const [inline]

Definition at line 75 of file ghash.h.

{ return GraphH.GetI(KeyId); }
template<class TDat>
const TGraphKey& TGHash< TDat >::GetKey ( const int &  KeyId) const [inline]

Definition at line 97 of file ghash.h.

{ return GraphH.GetKey(KeyId); }
template<class TDat>
void TGHash< TDat >::GetKeyDat ( const int &  KeyId,
TGraphKey Key,
TDat &  Dat 
) const [inline]

Definition at line 107 of file ghash.h.

{ GraphH.GetKeyDat(KeyId, Key, Dat); }
template<class TDat>
void TGHash< TDat >::GetKeyDatPrV ( TVec< TPair< TGraphKey, TDat > > &  KeyDatPrV) const [inline]

Definition at line 119 of file ghash.h.

{ GraphH.GetKeyDatPrV(KeyDatPrV); }
template<class TDat>
int TGHash< TDat >::GetKeyId ( const PNGraph Graph) const [inline]

Definition at line 93 of file ghash.h.

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

{ int k=IsGetKeyId(Graph); IAssert(k!=-1); return k; }

Here is the caller graph for this function:

template<class TDat>
int TGHash< TDat >::GetKeyId ( const TGraphKey Key) const [inline]

Definition at line 98 of file ghash.h.

{ return GraphH.GetKeyId(Key); }
template<class TDat >
void TGHash< TDat >::GetKeyIdByDat ( TIntV KeyIdV,
const bool &  Asc = true 
) const

Definition at line 302 of file ghash.h.

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

                                                                     {
  TVec<TQuad<TDat, TInt,TInt, TInt> > DatKeyIdV(Len(), 0); // <TDat,Nodes,Edges,KeyId>
  for (int i = FFirstKeyId(); FNextKeyId(i); ) {
    DatKeyIdV.Add(TQuad<TDat, TInt,TInt, TInt>(GetDatId(i), GetKey(i).GetNodes(), GetKey(i).GetEdges(), i));
  }
  DatKeyIdV.Sort(Asc);
  KeyIdV.Gen(Len(), 0);
  for (int i = 0; i < Len(); i++) {
    KeyIdV.Add(DatKeyIdV[i].Val4);
  }
}

Here is the call graph for this function:

template<class TDat >
void TGHash< TDat >::GetKeyIdByGSz ( TIntV KeyIdV,
const bool &  Asc = true 
) const

Definition at line 315 of file ghash.h.

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

                                                                     {
  TVec<TQuad<TInt,TInt, TDat, TInt> > DatKeyIdV(Len(), 0); // <Nodes,Edges,TDat,KeyId>
  for (int i = FFirstKeyId(); FNextKeyId(i); ) {
    DatKeyIdV.Add(TQuad< TInt,TInt, TDat, TInt>(GetKey(i).GetNodes(), GetKey(i).GetEdges(), GetDatId(i), i));
  }
  DatKeyIdV.Sort(Asc);
  KeyIdV.Gen(Len(), 0);
  for (int i = 0; i < Len(); i++) {
    KeyIdV.Add(DatKeyIdV[i].Val4);
  }
}

Here is the call graph for this function:

template<class TDat>
void TGHash< TDat >::GetKeyV ( TVec< TGraphKey > &  KeyV) const [inline]

Definition at line 115 of file ghash.h.

{ GraphH.GetKeyV(KeyV); }
template<class TDat>
int TGHash< TDat >::GetMxKeyIds ( ) const [inline]

Definition at line 85 of file ghash.h.

{ return GraphH.GetMxKeyIds(); }
template<class TDat >
bool TGHash< TDat >::GetNodeMap ( const PNGraph Graph,
TIntPrV NodeMapV 
) const

Definition at line 255 of file ghash.h.

                                                                           {
  int KeyId;
  return GetNodeMap(Graph, NodeMapV, KeyId);
}
template<class TDat >
bool TGHash< TDat >::GetNodeMap ( const PNGraph Graph,
TIntPrV NodeMapV,
int &  KeyId 
) const

Definition at line 261 of file ghash.h.

References TVec< TVal >::Add(), TNGraph::BegNI(), TVec< TVal >::Clr(), Fail, TVec< TVal >::GetDat(), TNGraph::TNodeI::GetId(), TNGraph::GetNodes(), TSnap::GetTreeSig(), IAssert, TGraphKey::IsIsomorph(), TSnap::IsTree(), TVec< TVal >::Len(), TGraphKey::SetVariant(), TGraphKey::TakeGraph(), and TGraphKey::TakeSig().

                                                                                       {
  NodeMapV.Clr(false);
  if (HashOnlyTrees) {
    int RootNId;  IAssert(TSnap::IsTree(Graph, RootNId));
    TIntV TreeSig;  TSnap::GetTreeSig(Graph, RootNId, TreeSig, NodeMapV);
    TGraphKey GKey(TreeSig);
    KeyId = GraphH.GetKeyId(GKey);
    return KeyId != -1;
  } else {
    const int Nodes = Graph->GetNodes();
    int IsoPermId = -1;
    NodeMapV.Clr(false);
    if (Nodes == 0) { return true; }
    else if (Nodes == 1) {
      NodeMapV.Add(TIntPr(Graph->BegNI().GetId(), 0));  return true; }
    else if (Nodes <= MxIsoCheck) {
      TGraphKey GKey;
      GKey.TakeSig(Graph, MxIsoCheck+1, MxSvdGraph);
      GKey.TakeGraph(Graph, NodeMapV);
      for (int variant = 1; ; variant++) {
        GKey.SetVariant(variant);
        KeyId = GraphH.GetKeyId(GKey);
        if (KeyId == -1) return false;
        if (TGraphKey::IsIsomorph(GKey, GraphH.GetKey(KeyId), GSzToPermH.GetDat(Nodes), IsoPermId)) {
          const TIntV& K1K2Perm = GSzToPermH.GetDat(Nodes)[IsoPermId];
          // map from graph to key1 to key2
          for  (int i = 0; i < NodeMapV.Len(); i++) {
            NodeMapV[i].Val2 = K1K2Perm[NodeMapV[i].Val2];
          }
          return true;
        }
      }
      return false;
    } else {
      return false; // graph too big to find the mapping
    }
  }
  Fail;  return false;
}

Here is the call graph for this function:

template<class TDat>
int TGHash< TDat >::GetPorts ( ) const [inline]

Definition at line 83 of file ghash.h.

{ return GraphH.GetPorts(); }
template<class TDat>
bool TGHash< TDat >::HashTrees ( ) const [inline]

Definition at line 77 of file ghash.h.

{ return HashOnlyTrees; }
template<class TDat >
void TGHash< TDat >::InitPermutations ( ) [private]

Definition at line 132 of file ghash.h.

References TVec< TVal >::Add(), TVec< TVal >::NextPerm(), and TVec< TVal >::Pack().

Referenced by TGHash< TDat >::TGHash().

                                    {
  GSzToPermH.Clr();
  for (int nodes = 2; nodes <= MxIsoCheck; nodes++) {
    TVec<TIntV> NodePermutationV;
    TIntV NodeIdV(nodes, 0);
    for (int i = 0; i < nodes; i++)  NodeIdV.Add(i);
    NodeIdV.Pack();
    NodePermutationV.Add(NodeIdV);
    while (NodeIdV.NextPerm()) {
      NodePermutationV.Add(NodeIdV);
    }
    NodePermutationV.Pack();
    GSzToPermH.AddDat(nodes, NodePermutationV);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TDat>
bool TGHash< TDat >::IsAutoSize ( ) const [inline]

Definition at line 84 of file ghash.h.

{ return GraphH.IsAutoSize(); }
template<class TDat >
int TGHash< TDat >::IsGetKeyId ( const PNGraph Graph) const [private]

Definition at line 218 of file ghash.h.

Referenced by TGHash< TUInt64 >::GetKeyId(), and TGHash< TUInt64 >::IsKey().

                                                       {
  TGraphKey GKey;
  return IsGetKeyId(Graph, GKey);
}

Here is the caller graph for this function:

template<class TDat >
int TGHash< TDat >::IsGetKeyId ( const PNGraph Graph,
TGraphKey GKey 
) const [private]

Definition at line 224 of file ghash.h.

References Fail, TGraphKey::GetNodes(), TSnap::GetTreeSig(), IAssert, TGraphKey::IsIsomorph(), TSnap::IsTree(), TGraphKey::SetVariant(), TGraphKey::TakeGraph(), and TGraphKey::TakeSig().

                                                                        {
  if (HashOnlyTrees) {
    int RootNId;  IAssert(TSnap::IsTree(Graph, RootNId));
    TIntV TreeSig;  TSnap::GetTreeSig(Graph, RootNId, TreeSig);
    GKey = TGraphKey(TreeSig);
    const int KeyId = GraphH.GetKeyId(GKey);
    //IAssert(KeyId != -1);
    return KeyId;
  } else {
    GKey.TakeSig(Graph, MxIsoCheck+1, MxSvdGraph);
    const int Nodes = GKey.GetNodes();
    if (Nodes > 2 && Nodes <= MxIsoCheck) {
      GKey.TakeGraph(Graph);
      for (int variant = 1; ; variant++) {
        GKey.SetVariant(variant);
        int KeyId = GraphH.GetKeyId(GKey);
        //IAssert(KeyId != -1);
        if (TGraphKey::IsIsomorph(GKey, GraphH.GetKey(KeyId), GSzToPermH.GetDat(Nodes))) { return KeyId; }
      }
      return -1;
    } else {
      const int KeyId = GraphH.GetKeyId(GKey);
      //IAssert(KeyId != -1);
      return KeyId;
    }
  }
  Fail;
  return -1;
}

Here is the call graph for this function:

template<class TDat>
int TGHash< TDat >::IsGetKeyId ( const PNGraph Graph,
TGraphKey GKey,
TIntPrV NodeMap 
) const [private]
template<class TDat>
bool TGHash< TDat >::IsKey ( const PNGraph Graph) const [inline]

Definition at line 92 of file ghash.h.

Referenced by TDGHashGraphCounter::operator()().

{ int k=IsGetKeyId(Graph); return k!=-1; }

Here is the caller graph for this function:

template<class TDat>
bool TGHash< TDat >::IsKey ( const TGraphKey Key) const [inline]

Definition at line 99 of file ghash.h.

{ return GraphH.IsKey(Key); }
template<class TDat>
bool TGHash< TDat >::IsKey ( const TGraphKey Key,
int &  KeyId 
) const [inline]

Definition at line 100 of file ghash.h.

{ return GraphH.IsKey(Key, KeyId); }
template<class TDat>
bool TGHash< TDat >::IsKeyGetDat ( const TGraphKey Key,
TDat &  Dat 
) const [inline]

Definition at line 108 of file ghash.h.

{ return GraphH.IsKeyGetDat(Key, Dat); }
template<class TDat>
bool TGHash< TDat >::IsKeyId ( const int &  KeyId) const [inline]

Definition at line 101 of file ghash.h.

{ return GraphH.IsKeyId(KeyId); }
template<class TDat>
bool TGHash< TDat >::IsKeyIdEqKeyN ( ) const [inline]

Definition at line 86 of file ghash.h.

{ return GraphH.IsKeyIdEqKeyN(); }
template<class TDat>
int TGHash< TDat >::Len ( ) const [inline]

Definition at line 82 of file ghash.h.

{  return GraphH.Len(); }
template<class TDat>
const TDat& TGHash< TDat >::operator() ( const TGraphKey Key) const [inline]

Definition at line 71 of file ghash.h.

{ return GraphH.GetDat(Key); }
template<class TDat>
TDat& TGHash< TDat >::operator() ( const TGraphKey Key) [inline]

Definition at line 72 of file ghash.h.

{ return GraphH.GetDat(Key); }
template<class TDat>
const TDat& TGHash< TDat >::operator[] ( const int &  KeyId) const [inline]

Definition at line 69 of file ghash.h.

{ return GraphH[KeyId]; }
template<class TDat>
TDat& TGHash< TDat >::operator[] ( const int &  KeyId) [inline]

Definition at line 70 of file ghash.h.

{ return GraphH[KeyId]; }
template<class TDat>
void TGHash< TDat >::Pack ( ) [inline]

Definition at line 123 of file ghash.h.

{ GraphH.Pack(); }
template<class TDat >
void TGHash< TDat >::Save ( TSOut SOut) const

Definition at line 164 of file ghash.h.

                                         {
  MxIsoCheck.Save(SOut);
  MxSvdGraph.Save(SOut);
  HashOnlyTrees.Save(SOut);
  GraphH.Save(SOut);
}
template<class TDat >
void TGHash< TDat >::SaveDetailTxt ( const TStr OutFNm,
const TStr Desc,
const TStr DatColNm 
) const

Definition at line 371 of file ghash.h.

References TStr::CStr(), F(), GetStr(), and TVec< TVal >::Len().

                                                                                                 {
  TIntV KeyIdV;  GetKeyIdByDat(KeyIdV, false);
  FILE *F = fopen(OutFNm.CStr(), "wt");
  fprintf(F, "Graph-Hash-Table\n");
  fprintf(F, "%s\n", Desc.CStr());
  fprintf(F, "%d graphs", KeyIdV.Len());
  for (int i = 0; i < KeyIdV.Len(); i++) {
    fprintf(F, "\n\n[%5d]\tRank: %d\n", KeyIdV[i](), i+1);
    fprintf(F, "Dat:  %s\n", GetDat(KeyIdV[i]).GetStr().CStr());
    GetDatId(KeyIdV[i]).SaveTxt(F);
  }
  fclose(F);
}

Here is the call graph for this function:

template<class TDat >
void TGHash< TDat >::SaveTxt ( const TStr OutFNm,
const TStr Desc,
const TStr DatColNm,
const bool &  SortByKeyVal = true 
) const

Definition at line 353 of file ghash.h.

References TStr::CStr(), F(), TGraphKey::GetEdges(), TGraphKey::GetNodes(), and TVec< TVal >::Len().

                                                                                                                     {
  TIntV KeyIdV;
  if (SortByKeyVal) GetKeyIdByDat(KeyIdV, false);
  else GetKeyIdByGSz(KeyIdV, true);
  FILE *F = fopen(OutFNm.CStr(), "wt");
  fprintf(F, "Graph-Hash-Table");
  fprintf(F, "%s\n", Desc.CStr());
  fprintf(F, "%d graphs\n", KeyIdV.Len());
  fprintf(F, "Rank\tKeyId\tNodes\tEdges\t%s\n", DatColNm.CStr());
  for (int i = 0; i < KeyIdV.Len(); i++) {
    const TGraphKey& Key = GetKey(KeyIdV[i]);
    fprintf(F, "%d\t%d\t%d\t%d\t%s\n", i+1, KeyIdV[i](), Key.GetNodes(), Key.GetEdges(),
      GetDatId(KeyIdV[i]).GetStr().CStr());
  }
  fclose(F);
}

Here is the call graph for this function:


Member Data Documentation

template<class TDat>
THash<TInt, TVec<TIntV> > TGHash< TDat >::GSzToPermH [private]

Definition at line 56 of file ghash.h.

template<class TDat>
TBool TGHash< TDat >::HashOnlyTrees [private]

Definition at line 57 of file ghash.h.

Referenced by TGHash< TUInt64 >::HashTrees(), and TGHash< TDat >::TGHash().

template<class TDat>
TInt TGHash< TDat >::MxIsoCheck [private]

Definition at line 54 of file ghash.h.

template<class TDat>
TInt TGHash< TDat >::MxSvdGraph [private]

Definition at line 55 of file ghash.h.


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