Generated on Wed Apr 29 2015 11:51:41 for GGL-4.1.2 by doxygen 1.8.3.1
Data Structures | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes
ggl::Graph_GML_grammar Class Reference

Graph GML parser. More...

#include <Graph_GML_grammar.hh>

Inheritance diagram for ggl::Graph_GML_grammar:
Inheritance graph
[legend]

Data Structures

struct  definition
 The definition of the GML grammar. More...
 
class  keys_map
 
struct  keyvalue_closure
 
struct  lt_edge
 
struct  lt_node
 

Public Member Functions

 Graph_GML_grammar (Graph &toFill)
 

Static Public Member Functions

static std::pair< Graph, int > parseGraph (const std::string &GML_string)
 

Protected Types

typedef boost::tuple< int, int,
std::string, std::string > 
edge_t
 
typedef std::map< std::string,
kv_values_t
keys_map_t
 
enum  kv_values {
  Y_CONTXT = -3, N_CONTXT = -2, UNKNOWN = -1, INT_VAL = 0,
  STR_VAL = 1, DBL_VAL = 2, LST_VAL = 3
}
 enummeration of value types in gml key-value pairs More...
 
typedef enum kv_values kv_values_t
 
typedef boost::tuple< int,
std::string, std::string > 
node_t
 

Protected Attributes

boost::property_map< Graph,
PropEdgeLabel >::type 
edgeLabel
 Access to the edge label property_map of g2fill to set edge labels. More...
 
Graphg2fill
 
boost::property_map< Graph,
PropNodeLabel >::type 
nodeLabel
 Access to the node label property_map of g2fill to set node labels. More...
 

Detailed Description

  Parses a GML string representation of a ggl::Graph object.

  Example :
      ====== GRAPH TO ENCODE =======================

        3(D) -1- 1(B)
         |      /
         2    3
         |  /
        2(C) -0- 0(A)

      ======= GRAPH IN GML =========================

      graph [
        node [ id 0 label "A" ]
        node [ id 1 label "B" ]
        node [ id 2 label "C" ]
        node [ id 3 label "D" ]
        edge [ source 0 target 2 label "-0-" ]
        edge [ source 1 target 3 label "-1-" ]
        edge [ source 1 target 2 label "-3-" ]
        edge [ source 2 target 3 label "-2-" ]
      ]

      ==============================================

BNF grammar of GML (http://www.infosun.fim.uni-passau.de/Graphlet/GML/)

       gml            ::= keyvalues
       keyvalues      ::= keyvalue (keyvalue)
       keyvalue       ::= key value
       key            ::= ['a'-'z''A'-'Z']['a'-'z''A'-'Z''0'-'9']
       value          ::= real | integer | string | list
       real           ::= sign? digit  '.' digit+ mantissa
       integer        ::= sign? digit+
       string         ::= '"' instring '"'
       list           ::= '[' keyvalues ']'
       sign           ::= '+' | '-'
       digit          ::= ['0'-'9']
       mantissa       ::= ('E' | 'e') sign? digit+
       instring       ::= ASCII-{'&', '"'} | '&' ['a'-'z''A'-'Z']  ';'
Author
Christoph Flamm (c) 2008 http://www.tbi.univie.ac.at/~xtof/
Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 102 of file Graph_GML_grammar.hh.

Member Typedef Documentation

typedef boost::tuple<int,int,std::string,std::string> ggl::Graph_GML_grammar::edge_t
protected

Definition at line 133 of file Graph_GML_grammar.hh.

typedef std::map<std::string, kv_values_t> ggl::Graph_GML_grammar::keys_map_t
protected

Definition at line 131 of file Graph_GML_grammar.hh.

Definition at line 119 of file Graph_GML_grammar.hh.

typedef boost::tuple<int,std::string,std::string> ggl::Graph_GML_grammar::node_t
protected

Definition at line 134 of file Graph_GML_grammar.hh.

Member Enumeration Documentation

Enumerator
Y_CONTXT 
N_CONTXT 
UNKNOWN 
INT_VAL 
STR_VAL 
DBL_VAL 
LST_VAL 

Definition at line 108 of file Graph_GML_grammar.hh.

Constructor & Destructor Documentation

ggl::Graph_GML_grammar::Graph_GML_grammar ( Graph toFill)
explicit

Constructs the definitions of a GML graph grammar to parse a GML graph string representation and to fill the encoded graph into a given boost graph object.

Parameters
toFillthe graph object to add nodes and edges to

Member Function Documentation

static std::pair< Graph, int > ggl::Graph_GML_grammar::parseGraph ( const std::string &  GML_string)
static

Parses a GML string and generates a Graph object

Parameters
GML_stringthe string to parse
Returns
pair.first = the parsed graph object pair.second = -1 if parsing was successful, in error case it returns the string position that caused the parsing error

Field Documentation

boost::property_map< Graph, PropEdgeLabel>::type ggl::Graph_GML_grammar::edgeLabel
mutableprotected

Definition at line 223 of file Graph_GML_grammar.hh.

Graph& ggl::Graph_GML_grammar::g2fill
protected

The boost core graph object that is filled to represent the next parsed Rule.

Definition at line 213 of file Graph_GML_grammar.hh.

boost::property_map< Graph, PropNodeLabel>::type ggl::Graph_GML_grammar::nodeLabel
mutableprotected

Definition at line 218 of file Graph_GML_grammar.hh.


The documentation for this class was generated from the following file: