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.

ool (*gml node rule)(const gml object*, graph*, node), the type for edge rules<br />

is bool (*gml edge rule)(const gml object*, graph*, edge), and the type for<br />

graph rules is bool (*gml graph rule)(const gml object*, graph*). A GML<br />

object is represented by an instance of class gml object. You can get its<br />

value by using double gml object::get double(), int gml object::get int() or<br />

char* gml object::get string(). If one of your rules returns false during parsing,<br />

then parsing fails and the graph is cleared.<br />

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

2. Creation<br />

gml graph parser(graph& G);<br />

creates an instance parser of type gml graph and initializes it for<br />

graph G.<br />

gml graph parser(graph& G, const char ∗ filename);<br />

creates an instance parser of type gml graph and reads graph G<br />

from the file filename.<br />

gml graph parser(graph& G, istream& ins);<br />

creates an instance parser of type gml graph and reads graph G<br />

from the input stream ins.<br />

3. Operations<br />

3.1 Parsing<br />

bool<br />

bool<br />

parser.parse(const char ∗ filename)<br />

parser.parse(istream& ins)<br />

parses the input taken from the file filename using the current<br />

set of rules. <strong>The</strong> graph specified in the constructor is<br />

set up accordingly. This operations returns false and clears<br />

the graph, if syntax or parse errors occur. Otherwise true is<br />

returned.<br />

parses the input taken from the input stream ins.<br />

bool parser.parse string(string s)<br />

3.2 Path Manipulation<br />

parses the input taken from string s.<br />

void parser.reset path( )<br />

resets the current path to the empty path.

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

Saved successfully!

Ooh no, something went wrong!