GClasses
|
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 |
GClasses::GAtomicCycleFinder::GAtomicCycleFinder | ( | size_t | nodes | ) |
|
virtual |
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.
|
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 |
Performs unit tests for this class. Throws an exception if there is a failure.
|
protected |
|
protected |
|
protected |