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.

When using the data types node slot resp.<br />

<strong>LEDA</strong>/graph/edge slot.h.<br />

edge slot one has to include the files<br />

1.4.3 Customizable Node and Edge Types: It is also possible to pass any structure<br />

derived from data slots as second or third parameter. <strong>The</strong>reby the nodes and edges<br />

are extended by named data members. <strong>The</strong>se are added in addition to the data slots<br />

specified in the base type. In the example<br />

struct flow_node:public data_slots<br />

{ int excess;<br />

int level;<br />

}<br />

struct flow_edge:public data_slots<br />

{ int flow;<br />

int cap;<br />

}<br />

typedef static_graph flow_graph;<br />

there are three data slots (one of them unnamed) associated with each node and four data<br />

slots (two of them unnamed) associated with each edge of a flow graph.<br />

<strong>The</strong> named slots can be used as follows:<br />

flow_graph::node v;<br />

forall_nodes(v, G) v->excess = 0;<br />

#include < <strong>LEDA</strong>/graph/static graph.h ><br />

2. Creation<br />

static graph, edge d ata = data slots < 0 > > G;<br />

creates an empty static graph G. category is either directed graph, or bidirectional graph,<br />

or opposite graph. <strong>The</strong> use of the other parameters is explained in the section Node and<br />

Edge Data given above.<br />

3. Types<br />

static graph :: node<br />

static graph :: edge<br />

the node type. Note: It is different from graph :: node.<br />

the edge type. Note: It is different from graph :: edge.

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

Saved successfully!

Ooh no, something went wrong!