Skip to main content

read_leda

Function read_leda 

Source
pub fn read_leda<R: Read>(input: R) -> IgraphResult<LedaGraph>
Expand description

Read a graph from LEDA native graph format.

Parses the header (LEDA.GRAPH), attribute type declarations, directedness flag, vertex section, and edge section. Vertex IDs in the file are 1-based and converted to 0-based internally.

ยงExamples

use rust_igraph::read_leda;

let input = b"LEDA.GRAPH\nvoid\nvoid\n-2\n# Vertices\n3\n|{}|\n|{}|\n|{}|\n# Edges\n2\n1 2 0 |{}|\n2 3 0 |{}|\n";
let result = read_leda(&input[..]).unwrap();
assert_eq!(result.graph.vcount(), 3);
assert_eq!(result.graph.ecount(), 2);
assert!(!result.graph.is_directed());