Mace C++ Graph Library 1.0
The fast and flexible graph library for C++. Developed by Matthias Mace Hädrich.
Public Member Functions
directed_graph Class Reference

This is the class that represents a directed graph. More...

#include <directed_graph.h>

Inheritance diagram for directed_graph:
graph

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

bool directed_graph::add_edge ( vertex p_src,
vertex p_dest,
int  weight = 0 
) [virtual]

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.

Returns:
True if edge could be added, false if edge could not be added.

Implements graph.

Definition at line 65 of file directed_graph.cpp.

bool directed_graph::add_edge ( vertex p_src,
edge p_edge 
) [virtual]

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|)

Returns:
True if edge could be added, false if edge could not be added.

Implements graph.

Definition at line 88 of file directed_graph.cpp.

bool directed_graph::are_strongly_adjacent ( vertex p_vertex_0,
vertex p_vertex_1 
)

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.

Returns:
True if vertex 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.

See also:
remove_edge( vertex *p_vertex_0, vertex *p_vertex_1 )
Returns:
True if edge could be removed, false if not.

Implements graph.

Definition at line 135 of file directed_graph.cpp.

bool directed_graph::remove_edge ( vertex p_vertex_0,
vertex p_vertex_1 
) [virtual]

Remove an edge from vertex p_vertex_0 to p_vertex_1.

Returns:
True if edge could be removed, false if not.

Implements graph.

Definition at line 109 of file directed_graph.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines