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

graph Class Reference

This is the *abstract* base class for all graphs.
More...

`#include <graph.h>`

Inheritance diagram for graph:

## Public Member Functions | |

graph () | |

The constructor. | |

~graph () | |

The destructor. | |

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

Add a vertex to the graph. | |

DLL bool | add_vertex (vertex *p_vertex) |

Add a vertex to the graph. | |

virtual DLL bool | add_edge (vertex *p_src, vertex *p_dest, int weight=0)=0 |

virtual DLL bool | add_edge (vertex *p_src, edge *p_edge)=0 |

DLL bool | remove_vertex (std::string name) |

Removes a vertex with a given name `name` . | |

DLL bool | remove_vertex (vertex *p_vertex) |

Removes the vertex `p_vertex` from the graph. | |

virtual DLL bool | remove_edge (vertex *p_vertex_0, vertex *p_vertex_1)=0 |

virtual DLL bool | remove_edge (edge *p_edge)=0 |

DLL void | vertices_output (std::ostream &ostream) |

Output function which receives a reference to an output stream to operate on. | |

DLL std::vector< vertex * > & | vertices () |

Get all vertices of the graph. | |

## Protected Member Functions | |

size_t | vertices_count () |

Return the count of vertices in the graph. | |

size_t | edges_count () |

Return the count of edges in the graph. | |

std::string | name () |

Return the name of the graph. | |

void | set_name (std::string name) |

Set the name of the graph. | |

bool | parallels_allowed () |

Return parallels allowed state. | |

void | set_parallels_allowed (bool allowed) |

Set parallels allowed state. | |

bool | has_loop () |

Check the graph for loops. | |

bool | are_adjacent (vertex *p_vertex_0, vertex *p_vertex_1) |

Check if two vertices are adjacent. | |

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

Find a vertex with the given name `name` . | |

vertex * | find_source (edge *p_edge) |

Find the source vertex of the edge. | |

bool | remove_edges_pointing_to (vertex *p_vertex) |

Remove all edges poiting to the vertex `p_vertex` . | |

## Private Attributes | |

std::string | m_name |

bool | m_parallels_allowed |

std::vector< vertex * > | m_vertices |

This is the *abstract* base class for all graphs.

This class is the base class for all graphs. It's made abstract by containing pure virtual functions.

These functions **have to** be reimplemented in the classes that inherit this class.

graph::~graph | ( | ) |

Implemented in directed_graph, and undirected_graph.

Implemented in directed_graph, and undirected_graph.

bool graph::add_vertex | ( | vertex * | p_vertex | ) |

bool graph::add_vertex | ( | std::string | name, |

int | weight = `0` |
||

) |

Check if two vertices are adjacent.

**Note:**- The class directed_graph can also be checked for strong adjacency.

**Returns:***True*if vertices are adjacent,*false*if not.

**See also:**- directed_graph

size_t graph::edges_count | ( | ) | ` [protected]` |

vertex * graph::get_vertex_by_name | ( | std::string | name | ) | ` [protected]` |

bool graph::has_loop | ( | ) | ` [protected]` |

std::string graph::name | ( | ) | ` [protected]` |

bool graph::parallels_allowed | ( | ) | ` [protected]` |

Implemented in directed_graph, and undirected_graph.

virtual DLL bool graph::remove_edge | ( | edge * | p_edge | ) | ` [pure virtual]` |

Implemented in directed_graph, and undirected_graph.

bool graph::remove_edges_pointing_to | ( | vertex * | p_vertex | ) | ` [protected]` |

bool graph::remove_vertex | ( | std::string | name | ) |

bool graph::remove_vertex | ( | vertex * | p_vertex | ) |

Removes the vertex `p_vertex`

from the graph.

When removing a vertex, all edges linked to this vertex have to be removed to.

This means that every edge that has this vertex as source or destination has to be found and removed.

**Returns:***True*if vertex could be deleted,*false*if not.

void graph::set_name | ( | std::string | name | ) | ` [protected]` |

void graph::set_parallels_allowed | ( | bool | allowed | ) | ` [protected]` |

std::vector< vertex * > & graph::vertices | ( | ) |

size_t graph::vertices_count | ( | ) | ` [protected]` |

void graph::vertices_output | ( | std::ostream & | ostream | ) |

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

bool graph::m_parallels_allowed` [private]` |

std::vector<vertex*> graph::m_vertices` [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