31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11.3 Static Graphs ( static graph )<br />

1. Definition<br />

1.1 Motivation. <strong>The</strong> data type static graph representing static graph is the result of<br />

two observations:<br />

First, most graph algorithms do not change the underlying graph, they work on a constant<br />

or static graph and second, different algorithms are based on different models (we call<br />

them categories) of graph.<br />

<strong>The</strong> <strong>LEDA</strong> data type graph represents all types of graph used in the library, such as<br />

directed, undirected, and bidirected graph, networks, planar maps, and geometric graph.<br />

It provides the operations for all of these graph in one fat interface. For efficiency reasons<br />

it makes sense to provide special graph data types for special purposes. <strong>The</strong> template data<br />

type static graph, which is parameterized with the graph category, provides specialized<br />

implementations for some of these graph types.<br />

1.2 Static Graphs. A static graph consists of a fixed sequence of nodes and edges. <strong>The</strong><br />

parameterized data type static graph is used to represent<br />

static graph. <strong>The</strong> first template parameter category defines the graph category and is<br />

taken from {directed graph, bidirectional graph, opposite graph} (see 1.3 for the details).<br />

<strong>The</strong> last two parameters are optional and can be used to define user-defined data structures<br />

to be included into the node and edge objects (see 1.4 for the details). An instance G of<br />

the parameterized data type static graph contains a sequence V of nodes and a sequence<br />

E of edges. New nodes or edges can be appended only in a construction phase which has<br />

to be started by calling G.start construction( ) and terminated by G.finish construction( ).<br />

For every node or edge x we define index(x) to be equal to the rank of x in its sequence.<br />

During the construction phase, the sequence of the source node index of all inserted edges<br />

must be non-decreasing. After the construction phase both sequences V and E are fixed.<br />

1.3 Graph Categories. We distinguish between five categories where currently only<br />

the first three are supported by static graph:<br />

• Directed Graphs (directed graph) represent the concept of a directed graph by providing<br />

the ability to iterate over all edges incident to a given node v and to ask for<br />

the target node of a given edge e.<br />

• Bidirectional Graphs (bidirectional graph) extend directed graph by supporting in<br />

addition iterations over all incoming edges at a given node v and to ask for the<br />

source node of a given edge e.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!