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
TD34GraphCounter Class Reference

#include <graphcounter.h>

Collaboration diagram for TD34GraphCounter:

Public Member Functions

 TD34GraphCounter (int GraphSz)
 
void operator() (const PNGraph &G, const TIntV &sg)
 
int Len () const
 
int GetId (const int &i) const
 
uint64 GetCnt (const int &GraphId) const
 
PNGraph GetGraph (const int &GraphId) const
 

Private Attributes

THash< TInt, TIntm_graphMaps
 
THash< TInt, TUInt64m_graphCounters
 
int m_subGraphSize
 

Detailed Description

Definition at line 8 of file graphcounter.h.

Constructor & Destructor Documentation

TD34GraphCounter::TD34GraphCounter ( int  GraphSz)

Definition at line 71 of file graphcounter.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), TGraphEnumUtils::GetIsoGraphs(), TGraphEnumUtils::GetMinAndGraphIds(), IAssert, TVec< TVal, TSizeTy >::Len(), m_graphCounters, TD3Graph::m_graphIds, TD4Graph::m_graphIds, m_graphMaps, TD3Graph::m_numOfGraphs, TD4Graph::m_numOfGraphs, and m_subGraphSize.

71  {
72  IAssert(GraphSz==3 || GraphSz==4);
73  //
74  m_subGraphSize = GraphSz;
75  //
76  int numOfGraphs = 0;
77  if(GraphSz==3) numOfGraphs = TD3Graph::m_numOfGraphs;
78  else if(GraphSz==4) numOfGraphs = TD4Graph::m_numOfGraphs;
79  //
80  for(int i=0; i<numOfGraphs; i++) {
81  int graphId = 0;
82  if(GraphSz==3) graphId = TD3Graph::m_graphIds[i];
83  else if(GraphSz==4) graphId = TD4Graph::m_graphIds[i];
84  //
85  TVec<PNGraph> isoG;
86  TGraphEnumUtils::GetIsoGraphs(graphId, GraphSz, isoG);
87  //
88  TVec<uint64> graphIds(isoG.Len());
89  uint64 minGraphId = TGraphEnumUtils::GetMinAndGraphIds(isoG, graphIds);
90  for(int j=0; j<graphIds.Len(); j++)
91  m_graphMaps.AddDat((int)graphIds[j], (int)minGraphId);
92  //
93  m_graphCounters.AddDat((int)minGraphId, 0);
94  }
95 }
#define IAssert(Cond)
Definition: bd.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static int m_graphIds[]
Definition: graphcounter.h:54
static int m_numOfGraphs
Definition: graphcounter.h:53
static void GetIsoGraphs(uint64 graphId, int nodes, TVec< PNGraph > &isoG)
unsigned long long uint64
Definition: bd.h:38
static int m_numOfGraphs
Definition: graphcounter.h:63
static uint64 GetMinAndGraphIds(const TVec< PNGraph > &isoG, TVec< uint64 > &graphIds)
THash< TInt, TInt > m_graphMaps
Definition: graphcounter.h:19
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
static int m_graphIds[]
Definition: graphcounter.h:64
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:

Member Function Documentation

uint64 TD34GraphCounter::GetCnt ( const int &  GraphId) const
inline

Definition at line 16 of file graphcounter.h.

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

16 { return m_graphCounters.GetDat(GraphId); }
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20

Here is the call graph for this function:

PNGraph TD34GraphCounter::GetGraph ( const int &  GraphId) const

Definition at line 107 of file graphcounter.cpp.

References TGraphEnumUtils::GetGraph(), m_subGraphSize, and TNGraph::New().

107  {
108  PNGraph G = TNGraph::New();
110  return G;
111 }
static PNGraph New()
Static constructor that returns a pointer to the graph. Call: PNGraph Graph = TNGraph::New().
Definition: graph.h:477
static void GetGraph(uint64 graphId, int nodes, PNGraph &G)

Here is the call graph for this function:

int TD34GraphCounter::GetId ( const int &  i) const
inline

Definition at line 15 of file graphcounter.h.

References THash< TKey, TDat, THashFunc >::GetKey(), and m_graphCounters.

15 { return m_graphCounters.GetKey(i); }
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

int TD34GraphCounter::Len ( ) const
inline

Definition at line 14 of file graphcounter.h.

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

14 { return m_graphCounters.Len(); }
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

void TD34GraphCounter::operator() ( const PNGraph G,
const TIntV sg 
)

Definition at line 96 of file graphcounter.cpp.

References THash< TKey, TDat, THashFunc >::GetDat(), TD3Graph::getId(), TD4Graph::getId(), THash< TKey, TDat, THashFunc >::IsKey(), m_graphCounters, m_graphMaps, and m_subGraphSize.

96  {
97  int graphId = 0;
98  if(m_subGraphSize==3) graphId = TD3Graph::getId(G, sg);
99  else if(m_subGraphSize==4) graphId = TD4Graph::getId(G, sg);
100  //
101  if(!m_graphMaps.IsKey(graphId)) { printf("This graph does not exist: %d\n", graphId); getchar(); return; }
102  int minGraphId = m_graphMaps.GetDat(graphId);
103  //
104  m_graphCounters.GetDat(minGraphId)++;
105 }
static int getId(const PNGraph &G, const TIntV &sg)
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static int getId(const PNGraph &G, const TIntV &sg)
THash< TInt, TInt > m_graphMaps
Definition: graphcounter.h:19
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the call graph for this function:

Member Data Documentation

THash<TInt,TUInt64> TD34GraphCounter::m_graphCounters
private

Definition at line 20 of file graphcounter.h.

Referenced by GetCnt(), GetId(), Len(), operator()(), and TD34GraphCounter().

THash<TInt,TInt> TD34GraphCounter::m_graphMaps
private

Definition at line 19 of file graphcounter.h.

Referenced by operator()(), and TD34GraphCounter().

int TD34GraphCounter::m_subGraphSize
private

Definition at line 21 of file graphcounter.h.

Referenced by GetGraph(), operator()(), and TD34GraphCounter().


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