#include <graph.h>
Public Methods | |
edge (const K &k1, const K &k2, const W &w=0) | |
bool | operator== (const edge &e) const |
bool | operator!= (const edge &e) const |
const K & | key1 () const |
Returns the key value of the node on one side of the edge. | |
const K & | key2 () const |
Returns the key value of the node on one side of the edge. | |
const K & | key (const K &k) |
Returns the key value of the node opposite the node key given. More... | |
K & | weight () |
Reterns reference to weight of the edge (if graph is weighted). |
An edge is represented using the key values of two nodes, which indicates that an edge exists between those two nodes. This class is referenced by an edge_iterator when using an edge_iterator to navigate edges extending from a node. You may use the key1 and key2 members to access the key values of the nodes connected by the edge. Also, you may use the key() function, passing the key value of one side of the edge, to retrieve the key value of the other side.
Note that an edge represented by this class is stored with the lower key value in key1.
|
Returns the key value of the node opposite the node key given. You may use this function with a given key value to retrieve the key value of the opposite side of the edge. This may be convenient when navigating among the edges of a given node in that you already know the key value of the "from" node, and you are looking for the "to" nodes. Note that the key value supplied must be a valid key value of one of the nodes associated with the edge. |