|
SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#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, TInt > | m_graphMaps |
| THash< TInt, TUInt64 > | m_graphCounters |
| int | m_subGraphSize |
Definition at line 8 of file graphcounter.h.
| TD34GraphCounter::TD34GraphCounter | ( | int | GraphSz | ) |
Definition at line 71 of file graphcounter.cpp.
{
IAssert(GraphSz==3 || GraphSz==4);
//
m_subGraphSize = GraphSz;
//
int numOfGraphs = 0;
if(GraphSz==3) numOfGraphs = TD3Graph::m_numOfGraphs;
else if(GraphSz==4) numOfGraphs = TD4Graph::m_numOfGraphs;
//
for(int i=0; i<numOfGraphs; i++) {
int graphId = 0;
if(GraphSz==3) graphId = TD3Graph::m_graphIds[i];
else if(GraphSz==4) graphId = TD4Graph::m_graphIds[i];
//
TVec<PNGraph> isoG;
TGraphEnumUtils::GetIsoGraphs(graphId, GraphSz, isoG);
//
TVec<uint64> graphIds(isoG.Len());
uint64 minGraphId = TGraphEnumUtils::GetMinAndGraphIds(isoG, graphIds);
for(int j=0; j<graphIds.Len(); j++)
m_graphMaps.AddDat((int)graphIds[j], (int)minGraphId);
//
m_graphCounters.AddDat((int)minGraphId, 0);
}
}
| uint64 TD34GraphCounter::GetCnt | ( | const int & | GraphId | ) | const [inline] |
Definition at line 16 of file graphcounter.h.
{ return m_graphCounters.GetDat(GraphId); }
| PNGraph TD34GraphCounter::GetGraph | ( | const int & | GraphId | ) | const |
Definition at line 107 of file graphcounter.cpp.
{
PNGraph G = TNGraph::New();
TGraphEnumUtils::GetGraph(GraphId, m_subGraphSize, G);
return G;
}
| int TD34GraphCounter::GetId | ( | const int & | i | ) | const [inline] |
Definition at line 15 of file graphcounter.h.
{ return m_graphCounters.GetKey(i); }
| int TD34GraphCounter::Len | ( | ) | const [inline] |
Definition at line 14 of file graphcounter.h.
{ return m_graphCounters.Len(); }
Definition at line 96 of file graphcounter.cpp.
{
int graphId = 0;
if(m_subGraphSize==3) graphId = TD3Graph::getId(G, sg);
else if(m_subGraphSize==4) graphId = TD4Graph::getId(G, sg);
//
if(!m_graphMaps.IsKey(graphId)) { printf("This graph does not exist: %d\n", graphId); getchar(); return; }
int minGraphId = m_graphMaps.GetDat(graphId);
//
m_graphCounters.GetDat(minGraphId)++;
}
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.