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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TD34GraphCounter Class Reference

#include <graphcounter.h>

List of all members.

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

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);
        }
}

Member Function Documentation

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(); }
void TD34GraphCounter::operator() ( const PNGraph G,
const TIntV sg 
)

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)++;
}

Member Data Documentation

Definition at line 20 of file graphcounter.h.

Definition at line 19 of file graphcounter.h.

Definition at line 21 of file graphcounter.h.


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