Mace C++ Graph Library 1.0
The fast and flexible graph library for C++. Developed by Matthias
Mace Hädrich. |

vertex Class Reference

The class that represents a vertex in a graph. More...

`#include <vertex.h>`

## Public Member Functions | |

DLL | vertex (std::string name, int weight=0) |

The constructor. | |

virtual | ~vertex () |

The destructor. | |

DLL std::string | name () |

Return the name of the vertex. | |

DLL void | set_name (std::string name) |

Set the name of a vertex. | |

int | weight () |

Return the weight of the vertex. | |

void | set_weight (int weight) |

Set the weight of the vertex. | |

std::vector< edge * > & | neighbors () |

Get all successors of the vertex. | |

void | add_edge (edge *p_edge) |

Adds an edge which contains a target vertex. | |

std::vector< edge * >::iterator | remove_edge (edge *p_edge) |

This removes and deletes an edge from the vertex. | |

bool | has_successor (vertex *p_vertex) |

Check if the vertex has a neighbor vertex `p_vertex` . | |

bool | has_exact_edge (edge *p_edge) |

Check if the vertex has an outgoing edge `p_edge` . | |

bool | has_according_edge (edge *p_edge) |

Check if the vertex has a connection to a vertex pointed to by p_edge outgoing edge `p_edge` . | |

## Private Attributes | |

std::string | m_name |

int | m_weight |

std::vector< edge * > | m_neighbors |

The class that represents a vertex in a graph.

Every vertex contains a vector of edges leading to his adjacent vertices. A vertex can have a weight which is 0 if none is set.

vertex::vertex | ( | std::string | name, |

int | weight = `0` |
||

) |

The constructor.

A vertex is initialized with a given name `name`

and a weight `weight`

. The weight is 0 by default, if none is set.

Definition at line 12 of file vertex.cpp.

vertex::~vertex | ( | ) | ` [virtual]` |

The destructor.

Remove all edges and free the memory that has been allocated for each edge.

Definition at line 23 of file vertex.cpp.

void vertex::add_edge | ( | edge * | p_edge | ) |

Adds an edge which contains a target vertex.

This function adds an edge between the vertex and the edge's destination vertex.

Definition at line 154 of file vertex.cpp.

bool vertex::has_according_edge | ( | edge * | p_edge | ) |

Check if the vertex has a connection to a vertex pointed to by p_edge outgoing edge `p_edge`

.

**Returns:***True*if vertex has edge`p_edge`

,*false*if not.

Definition at line 131 of file vertex.cpp.

bool vertex::has_exact_edge | ( | edge * | p_edge | ) |

Check if the vertex has an outgoing edge `p_edge`

.

**Returns:***True*if vertex has edge`p_edge`

,*false*if not.

Definition at line 108 of file vertex.cpp.

bool vertex::has_successor | ( | vertex * | p_vertex | ) |

Check if the vertex has a neighbor vertex `p_vertex`

.

**Returns:***True*if`p_vertex`

is a neighbor,*false*if not.

Definition at line 86 of file vertex.cpp.

std::string vertex::name | ( | ) |

Return the name of the vertex.

Definition at line 39 of file vertex.cpp.

std::vector< edge * > & vertex::neighbors | ( | ) |

Get all successors of the vertex.

**Returns:**- A reference to the vector containing pointers to every edge (neighbor relation) of the vertex.

Definition at line 76 of file vertex.cpp.

This removes and deletes an edge from the vertex.

There is no longer a connection between the vertex and the edge's destination vertex.

**Returns:**- A valid iterator pointing to the very next item after
`p_edge`

.

Definition at line 166 of file vertex.cpp.

void vertex::set_name | ( | std::string | name | ) |

Set the name of a vertex.

Definition at line 47 of file vertex.cpp.

void vertex::set_weight | ( | int | weight | ) |

Set the weight of the vertex.

Definition at line 66 of file vertex.cpp.

int vertex::weight | ( | ) |

Return the weight of the vertex.

Definition at line 58 of file vertex.cpp.

std::string vertex::m_name` [private]` |

std::vector<edge*> vertex::m_neighbors` [private]` |

int vertex::m_weight` [private]` |

The documentation for this class was generated from the following files:

Generated on Wed Jun 8 2011 09:45:29 for Mace C++ Graph Library by 1.7.4