Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

gtc::wdigraph< K, W, T > Class Template Reference

An undirected, weighted graph. More...

#include <graph.h>

Inheritance diagram for gtc::wdigraph< K, W, T >:

gtc::_base_graph< K, W, T > List of all members.

Public Methods

 wdigraph ()
 Create a graph with no nodes (see _base_graph for more details).

 wdigraph (size_t n)
 Create a graph with n nodes (see _base_graph for more details).

 wdigraph (size_t n, const K &k)
 Create a graph with n nodes (see _base_graph for more details).

template<typename F>  wdigraph (size_t n, F f)
 Create a graph with n nodes (see _base_graph for more details).

void add_edge (const K &k1, const K &k2, const W &w)
 Adds an edge to the graph, given key values of two nodes.

bool is_edge (const K &k1, const K &k2)
 Determines if an edge exists given key values of two nodes. More...

void remove_edge (const K &k1, const K &k2)
 Removes an edge from the graph, given key values of two nodes. More...

W & weight (const K &k1, const K &k2)
 Returns reference to the weight of the first edge between k1 and k2. More...


Detailed Description

template<typename K, typename W, typename T = void*>
class gtc::wdigraph< K, W, T >

An undirected, weighted graph.

Represents a weighted, undirected graph. Type K is used as the type for the node keys, and type T is the type of the data associated with the node. Type W is used for the weight. The default type for T is void*, effectively meaning that there is no associated data with a node, or you are just working with the key values.


Member Function Documentation

template<typename K, typename W, typename T>
bool gtc::wdigraph< K, W, T >::is_edge const K &    k1,
const K &    k2
[virtual]
 

Determines if an edge exists given key values of two nodes.

< Adds an edge between nodes with key values k1 and k2.

Notes: Nodes with key values k1 and k2 must exist. Also, more than one edge may be added between the same two nodes.

Implements gtc::_base_graph< K, W, T >.

template<typename K, typename W, typename T>
void gtc::wdigraph< K, W, T >::remove_edge const K &    k1,
const K &    k2
 

Removes an edge from the graph, given key values of two nodes.

< Returns true if an edge exists between nodes with key values k1 and k2, false otherwise.

Note: Nodes with key values k1 and k2 must exist.

template<typename K, typename W, typename T>
W & gtc::wdigraph< K, W, T >::weight const K &    k1,
const K &    k2
 

Returns reference to the weight of the first edge between k1 and k2.

< Removes all edges between nodes with key values k1 and k2.

Note: Nodes with key values k1 and k2 must exist.


The documentation for this class was generated from the following file:
Generated on Thu Oct 16 10:50:11 2003 for C++ GTC by doxygen1.2.15