SNAP Library 2.4, User Reference  2015-05-11 19:40:56
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>

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.

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:535
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:196
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:420

Member Function Documentation

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

Definition at line 16 of file graphcounter.h.

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

Definition at line 107 of file graphcounter.cpp.

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:411
Definition: bd.h:196
static void GetGraph(uint64 graphId, int nodes, PNGraph &G)
int TD34GraphCounter::GetId ( const int &  i) const
inline

Definition at line 15 of file graphcounter.h.

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:210
int TD34GraphCounter::Len ( ) const
inline

Definition at line 14 of file graphcounter.h.

14 { return m_graphCounters.Len(); }
THash< TInt, TUInt64 > m_graphCounters
Definition: graphcounter.h:20
int Len() const
Definition: hash.h:186
void TD34GraphCounter::operator() ( const PNGraph G,
const TIntV sg 
)

Definition at line 96 of file graphcounter.cpp.

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:220
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:216

Member Data Documentation

THash<TInt,TUInt64> TD34GraphCounter::m_graphCounters
private

Definition at line 20 of file graphcounter.h.

THash<TInt,TInt> TD34GraphCounter::m_graphMaps
private

Definition at line 19 of file graphcounter.h.

int TD34GraphCounter::m_subGraphSize
private

Definition at line 21 of file graphcounter.h.


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