pub fn read_gml<R: Read>(input: R) -> IgraphResult<Graph>Expand description
Read a graph from GML format.
Parses the first graph [ ... ] block. Extracts directed (0 or 1,
default 0), node [ id N ] entries, and edge [ source N target N ]
entries. All other keys/values are skipped.
Node ids need not be contiguous or start at 0 — the reader maps them to internal vertex indices in the order they appear.
§Examples
use rust_igraph::{Graph, read_gml};
let gml = b"graph [\n directed 0\n node [ id 1 ]\n node [ id 2 ]\n node [ id 3 ]\n edge [ source 1 target 2 ]\n edge [ source 2 target 3 ]\n]";
let g = read_gml(&gml[..]).unwrap();
assert_eq!(g.vcount(), 3);
assert_eq!(g.ecount(), 2);
assert!(!g.is_directed());