name: ColorHash <TObject>


g++ [flags ...] file ...

#include <ColorHash.h>;

Integral::COLOR get(const GraphVertex<TObject>* key);
boolean set(const GraphVertex<TObject>* key, Integral::COLOR value);
boolean insert(const GraphVertex<TObject>* key, Integral::COLOR value);
boolean remove(const GraphVertex<TObject>* key);
quick start:
// declare the graph arc object
ColorHash<Char> hash;
GraphVertex<Char> vertex;

// insert a vertex into the hash table and associate a color with it
hash.insert(&vertex, Integral::WHITE);

if (hash.get(&vertex) != Integral::WHITE) {
  return Error::handle(name(), L"insert/get", Error::TEST,
                              __FILE__, __LINE__);    

// change the color associated with the vertex
hash.set(&vertex, Integral::BLUE);

if (hash.get(&vertex) != Integral::BLUE) {
  return Error::handle(name(), L"insert/set", Error::TEST,
                              __FILE__, __LINE__);    

// remove the vertex from the graph

// the hash table should be empty
if (!hash.isEmpty()) {
  return Error::handle(name(), L"isEmpty", Error::TEST,
         	 __FILE__, __LINE__);

ColorHash is a wrapper class whose main function is to create a one-to-one mapping between a graph vertex pointer and the corresponding color of the vertex. The main reason for doing this is to mark a node in order to indicate that the vertex has been previously visited. Marking vertices is essential when you are dealing with search and sort algorithms related to graphs. However, we don't want all vertices to have to use color, since this will waste some previous memory space. So we provide this as an auxiliary class that can be used by those graphs that need it.

For a good reference on the color problem and its use in graphs, see: An interesting on-line resource is located at:
as well as: ColorHash is one of several classes that contribute to our graph manipulation capabilities in the IFCs. See DiGraph for more details.


public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods: