Skip to main content

read_pajek

Function read_pajek 

Source
pub fn read_pajek<R: Read>(input: R) -> IgraphResult<PajekGraph>
Expand description

Read a graph from Pajek (.net) format.

Supports *Vertices, *Edges (undirected), and *Arcs (directed) sections. Vertex IDs in the file are 1-based.

ยงExamples

use rust_igraph::read_pajek;

let pajek = b"*Vertices 3\n1 \"A\"\n2 \"B\"\n3 \"C\"\n*Edges\n1 2\n2 3\n1 3\n";
let result = read_pajek(&pajek[..]).unwrap();
assert_eq!(result.graph.vcount(), 3);
assert_eq!(result.graph.ecount(), 3);
assert!(!result.graph.is_directed());