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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• Opposite Graphs (opposite graph) are a variant of the bidirectional graph category.<br />

<strong>The</strong>y do not support the computation of the source or target node of a given edge<br />

but allow to walk from one terminal v of an edge e to the other opposite one.<br />

Not yet implemented are bidirected and undirected graph.<br />

1.4 Node and Edge Data. Static graph support several efficient ways - efficient compared<br />

to using node arrays, edge arrays, node maps, and edge maps - to associate data<br />

with the edges and nodes of the graph.<br />

1.4.1 Dynamic Slot Assignment: It is possible to attach two optional template parameters<br />

data slots at compile time:<br />

static_graph G;<br />

specifies a static directed graph G with three additional node slots and one additional<br />

edge slot. Node and edge arrays can use these data slots, instead of allocating an external<br />

array. This method is also supported for the standard <strong>LEDA</strong> data type graph. Please see<br />

the manual page for node array resp. edge array (esp. the operations use node data resp.<br />

use edge data) for the details.<br />

<strong>The</strong> method is called dynamic slot assignment since the concrete arrays are assigned<br />

during runtime to the slots.<br />

1.4.2 Static Slot Assignment: This method is even more efficient. A variant of the<br />

node and edge arrays, the so-called node slot and edge slot data types, are assigned to<br />

the slots during compilation time. <strong>The</strong>se types take three parameters: the element type<br />

of the array, an integer slot number, and the type of the graph:<br />

node_slot;<br />

edge_slot;<br />

Here is an example for the use of static slot assignment in a maxflow graph algorithm.<br />

It uses three node slots for storing distance, excess, and a successor node, and two edge<br />

slots for storing the flow and capacity.<br />

typedef static_graph maxflow_graph;<br />

node_slot succ;<br />

node_slot dist;<br />

node_slot excess;<br />

edge_slot flow;<br />

edge_slot cap;

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

Saved successfully!

Ooh no, something went wrong!