Grafalgo
Library of useful data structures and algorithms
/Users/jst/src/grafalgo/cpp/include/Nca.h
Go to the documentation of this file.
00001 
00009 #ifndef NCA_H
00010 #define NCA_H
00011 
00012 #include "stdinc.h"
00013 #include "Adt.h"
00014 #include "Util.h"
00015 #include "Partition.h"
00016 #include "Graph.h"
00017 
00018 namespace grafalgo {
00019 
00023 class Nca {
00024 public:
00025         struct VertexPair {
00026                 vertex v1, v2;
00027                 VertexPair(vertex u, vertex v) : v1(u), v2(v) {}
00028         };
00029 
00030                 Nca(Graph&, vertex, VertexPair[], int, vertex[]);
00031 private:
00032         Graph   *tp;            // pointer to tree
00033         vertex  root;           // tree root
00034         VertexPair *pairs;      // vector of vertex pairs
00035         int     np;             // number of vertex pairs
00036         vertex  *ncav;          // pointer to nca vector
00037 
00038         Graph   *gp;            // graph used to represent pairs internally
00039         Partition *pp;          // groups closed vertices with their noa
00040         vertex  *noa;           // if u is a canonical element, noa[u] is noa
00041 
00042         enum state_t { unreached, open, closed };
00043         state_t *state;         // states of vertices in search
00044 
00045         void    compute_nca(vertex, vertex); // recursive search routine
00046 };
00047 
00048 } // ends namespace
00049 
00050 #endif
 All Classes Files Functions Variables Typedefs Friends