Crate gml_parser
source ·Expand description
This crate allows for reading Graph Modeling Language (GML) files.
This crate first parses the GML into GMLObjects and GMLValues. Then the root GMLObject can be transformed into a Graph containing Nodes and Edges.
Examples
use gml_parser::{GMLObject, Graph};
let data = r#"
graph [
id 4
node [
id 0
]
node [
id 1
]
edge [
source 1
target 0
label "Edge"
]
]"#;
let root = GMLObject::from_str(data).unwrap();
let graph = Graph::from_gml(root).unwrap();
assert_eq!(graph.id, Some(4));
assert_eq!(graph.nodes.len(), 2);
assert_eq!(graph.edges.len(), 1);
Limitations
- This implementation can be fragile and GML is not a very picky standard
- We duplicate the data when parsing which can have performance impacts on very large graphs