GClasses

GClasses::GAtomicCycleFinder Class Reference

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

#include <GGraph.h>

List of all members.

Public Member Functions

 GAtomicCycleFinder (size_t nodes)
virtual ~GAtomicCycleFinder ()
size_t nodeCount ()
 Returns the number of nodes in the graph.
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.)
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.)
void compute ()
 Finds all the atomic cycles in the graph, and calls onDetectAtomicCycle for each one.
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.

Static Public Member Functions

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

Protected Attributes

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

Detailed Description

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


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

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