1 #ifndef Snap_SubGraphEnum_h 
    2 #define Snap_SubGraphEnum_h 
   14 template<
class TGraphCounter>
 
   47       for(
int i=0; i<capacity; i++) { 
m_arr[i]=-1; }
 
   51                         for(
int i=0; i<
m_size; i++) { 
if(
m_arr[i]==nodeId) 
return true; } 
return false; }
 
   80 template <
class TGraphCounter>
 
   82         if(sg.
Size() == m_subGraphSz) { (*m_functor)(m_graph, sg.
getVec()); 
return; }
 
   84         for(
int i=0; i<ext.
Capacity(); i++) {
 
   85                 while(ext[i] == 
false) {
 
   97                 TSSet newSgNbrs = sgNbrs;
 
   98                 for(
int j=0; j<wDeg; j++) {
 
  100                         if(nbrId > vId && !sgNbrs.
IsKey(nbrId) && !sg.
Contains(nbrId)) {
 
  102                                 newSgNbrs.
Add(nbrId);
 
  106                 GetSubGraphs_recursive(sg, newSgNbrs, newExt, vId);
 
  111 template <
class TGraphCounter>
 
  115         m_subGraphSz = SubGraphSz;
 
  116         m_functor = &Functor;
 
  120                 int vId = it.GetId();
 
  121                 int vDeg = it.GetDeg();
 
  123                 TSVec sg(SubGraphSz);
 
  127                 for(
int i=0; i<vDeg; i++) {
 
  128                         int nbrId = it.GetNbrNId(i);
 
  134                 GetSubGraphs_recursive(sg, sgNbrs, ext, vId);
 
  139 template <
class TGraphCounter>
 
  141         if(sg.
Size() == m_subGraphSz) { (*m_functor)(m_graph, sg.
getVec()); 
return; }
 
  143         for(
int i=0; i<ext.
Capacity(); i++) {
 
  144                 while(ext[i] == 
false) {
 
  156                 TSSet newSgNbrs = sgNbrs;
 
  157                 for(
int j=0; j<wDeg; j++) {
 
  161                                 newSgNbrs.
Add(nbrId);
 
  165                 GetSubGraphs_recursive(sg, newSgNbrs, newExt);
 
  170 template <
class TGraphCounter>
 
  174         m_subGraphSz = SubGraphSz;
 
  175         m_functor = &Functor;
 
  181         TSVec sg(SubGraphSz);
 
  185         for(
int i=0; i<vDeg; i++) {
 
  193         GetSubGraphs_recursive(sg, sgNbrs, ext);
 
  194         printf(
"secs: %llf\n", extime.
GetSecs());
 
int GetNbrNId(const int &NodeN) const 
Returns ID of NodeN-th neighboring node. 
 
int operator[](int i) const 
 
int GetNodes() const 
Returns the number of nodes in the graph. 
 
TGraphCounter * m_functor
 
const TIntV & getVec() const 
 
void GetSubGraphs(PNGraph &Graph, int SubGraphSz, TGraphCounter &Counter)
 
bool operator[](int i) const 
 
int GetDeg() const 
Returns degree of the current node, the sum of in-degree and out-degree. 
 
void GetSubGraphs_recursive(TSVec &sg, const TSSet &sgNbrs, TSSet &ext, int vId)
 
TIter BegI() const 
Returns an iterator pointing to the first element in the vector. 
 
Node iterator. Only forward iteration (operator++) is supported. 
 
bool Contains(int nodeId) const 
 
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.