Mace C++ Graph Library 1.0
The fast and flexible graph library for C++. Developed by Matthias Mace Hädrich.
|
This is the class that represents a directed graph. More...
#include <directed_graph.h>
Public Member Functions | |
DLL | directed_graph (std::string name="", bool parallels_allowed=true) |
The constructor. | |
~directed_graph () | |
The destructor. | |
bool | are_strongly_adjacent (vertex *p_vertex_0, vertex *p_vertex_1) |
Check if two vertices are strongly adjacent. | |
DLL bool | add_edge (vertex *p_src, vertex *p_dest, int weight=0) |
Add an edge to the graph. | |
DLL bool | add_edge (vertex *p_src, edge *p_edge) |
Add an edge to the graph. | |
DLL bool | remove_edge (vertex *p_vertex_0, vertex *p_vertex_1) |
Remove an edge from vertex p_vertex_0 to p_vertex_1 . | |
DLL bool | remove_edge (edge *p_edge) |
Remove an edge from the graph. |
This is the class that represents a directed graph.
A directed graph has edges pointing from one vertex to another.
While undirected graphs have bidirectional edges, an edge in a directes graph only points from one edge to another.
Creating strong adjacency by adding edges from vertex 1 to vertex 2 and vice versa, results in a cycle.
Definition at line 23 of file directed_graph.h.
directed_graph::directed_graph | ( | std::string | name = "" , |
bool | parallels_allowed = true |
||
) |
The constructor.
A directed graph can be initialized with a name name
and the instruction of allowing parallel edges or not.
parallels_allowed
is true by default.
Definition at line 11 of file directed_graph.cpp.
directed_graph::~directed_graph | ( | ) |
The destructor.
For all vertices there has been memory allocated which should be freed now.
Definition at line 22 of file directed_graph.cpp.
Add an edge to the graph.
Creates an edge with the destination vertex p_dest
and weight
, then appends it to the source vertex p_src
.
Implements graph.
Definition at line 65 of file directed_graph.cpp.
Add an edge to the graph.
Appends the edge _edge
to the vertex p_src
. Parallel edges can only be created if the graph allows that.
Memory needed: O(|V| + |E|)
Implements graph.
Definition at line 88 of file directed_graph.cpp.
Check if two vertices are strongly adjacent.
In a directed graph strong adjacency is given when a vertex has an adge towards another edge and the destination vertex has an edge towards the source vertex, too.
p_vertex_0
and vertex p_vertex_1
are strongly adjacent, false if not. Definition at line 47 of file directed_graph.cpp.
bool directed_graph::remove_edge | ( | edge * | p_edge | ) | [virtual] |
Remove an edge from the graph.
Implements graph.
Definition at line 135 of file directed_graph.cpp.
Remove an edge from vertex p_vertex_0
to p_vertex_1
.
Implements graph.
Definition at line 109 of file directed_graph.cpp.