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.18 Lists of Nodes ( node list )<br />

1. Definition<br />

An instance of the data type node list is a doubly linked list of nodes. It is implemented<br />

more efficiently than the general list type list (6.7). However, it can only be used<br />

with the restriction that every node is contained in at most one node list. Also many<br />

operations supported by list (for instance size) are not supported by node list.<br />

#include < <strong>LEDA</strong>/graph/node list.h ><br />

2. Creation<br />

node list L; introduces a variable L of type node list and initializes it with the<br />

empty list.<br />

3. Operations<br />

void L.append(node v) appends v to list L.<br />

void L.push(node v) adds v at the front of L.<br />

void L.insert(node v, node w) inserts v after w into L.<br />

Precondition: w ∈ L.<br />

node L.pop( ) deletes the first node from L and returns it.<br />

Precondition: L is not empty.<br />

node L.pop back( ) deletes the last node from L and returns it.<br />

Precondition: L is not empty.<br />

void L.del(node v) deletes v from L.<br />

Precondition: v ∈ L.<br />

bool L.member(node v) returns true if v ∈ L and false otherwise.<br />

bool L(node v) returns true if v ∈ L and false otherwise.<br />

node L.head( ) returns the first node in L (nil if L is empty).<br />

node L.tail( ) returns the last node in L (nil if L is empty).<br />

node L.succ(node v) returns the successor of v in L.<br />

Precondition: v ∈ L.<br />

node L.pred(node v) returns the predecessor of v in L.<br />

Precondition: v ∈ L.<br />

node L.cyclic succ(node v) returns the cyclic successor of v in L.<br />

Precondition: v ∈ L.

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

Saved successfully!

Ooh no, something went wrong!