GClasses
GClasses::GAtomicCycleFinder Class Referenceabstract

Detailed Description

This finds all of the atomic cycles (cycles that cannot be divided into two smaller cycles) in a graph.

#include <GGraph.h>

Public Member Functions

 GAtomicCycleFinder (size_t nodes)
 
virtual ~GAtomicCycleFinder ()
 
void addEdge (size_t a, size_t b)
 Adds an undirected edge to the graph. (You must call this to add all the edges before calling compute.) More...
 
void addEdgeIfNotDupe (size_t a, size_t b)
 Adds an undirected edge to the graph if a duplicate edge does not already exist. (This method is inefficient if there are a lot of edges. If you want efficiency, keep track of the edges yourself.) More...
 
void compute ()
 Finds all the atomic cycles in the graph, and calls onDetectAtomicCycle for each one. More...
 
size_t nodeCount ()
 Returns the number of nodes in the graph. More...
 
virtual bool onDetectAtomicCycle (std::vector< size_t > &cycle)=0
 You must overload this method to receive the cycles as they are detected (The edges are every torroidally adjacent pair of vertices in cycle.) If true is returned, it will continue to find more atomic cycles. If false is returned, it will stop immediately. More...
 

Static Public Member Functions

static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure. More...
 

Protected Attributes

size_t m_nodeCount
 
std::vector< size_t > * m_pMirrors
 
std::vector< size_t > * m_pNeighbors
 

Constructor & Destructor Documentation

GClasses::GAtomicCycleFinder::GAtomicCycleFinder ( size_t  nodes)
virtual GClasses::GAtomicCycleFinder::~GAtomicCycleFinder ( )
virtual

Member Function Documentation

void GClasses::GAtomicCycleFinder::addEdge ( size_t  a,
size_t  b 
)

Adds an undirected edge to the graph. (You must call this to add all the edges before calling compute.)

void GClasses::GAtomicCycleFinder::addEdgeIfNotDupe ( size_t  a,
size_t  b 
)

Adds an undirected edge to the graph if a duplicate edge does not already exist. (This method is inefficient if there are a lot of edges. If you want efficiency, keep track of the edges yourself.)

void GClasses::GAtomicCycleFinder::compute ( )

Finds all the atomic cycles in the graph, and calls onDetectAtomicCycle for each one.

size_t GClasses::GAtomicCycleFinder::nodeCount ( )

Returns the number of nodes in the graph.

virtual bool GClasses::GAtomicCycleFinder::onDetectAtomicCycle ( std::vector< size_t > &  cycle)
pure virtual

You must overload this method to receive the cycles as they are detected (The edges are every torroidally adjacent pair of vertices in cycle.) If true is returned, it will continue to find more atomic cycles. If false is returned, it will stop immediately.

static void GClasses::GAtomicCycleFinder::test ( )
static

Performs unit tests for this class. Throws an exception if there is a failure.

Member Data Documentation

size_t GClasses::GAtomicCycleFinder::m_nodeCount
protected
std::vector<size_t>* GClasses::GAtomicCycleFinder::m_pMirrors
protected
std::vector<size_t>* GClasses::GAtomicCycleFinder::m_pNeighbors
protected