name: BiColorHash <TObject>

synopsis:

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

#include <BiColorHash.h>;

Integral::COLOR get(const BiGraphVertex<TObject>* key);
boolean set(const BiGraphVertex<TObject>* key, Integral::COLOR value);
boolean insert(const BiGraphVertex<TObject>* key, Integral::COLOR value);
boolean remove(const BiGraphVertex<TObject>* key);
quick start:
// declare the graph arc object
//
BiColorHash<Char> hash;
BiGraphVertex<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
//
hash.remove(&vertex);

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

BiColorHash 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: BiColorHash is one of several classes that contribute to our graph manipulation capabilities in the IFCs. See BiGraph for more details.

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

examples:

notes: