pub fn read_ncol<R: Read>(input: R) -> IgraphResult<NcolGraph>Expand description
Read a graph from NCOL (.ncol) format.
Each non-empty, non-comment line defines an edge:
vertex1 vertex2 [weight]Lines starting with # or % are comments. Vertex names are arbitrary
non-whitespace strings. The graph is always undirected.
A line with a single name creates an isolated vertex (igraph extension).
ยงExamples
use rust_igraph::read_ncol;
let ncol = b"Alice Bob 1.0\nBob Carol\nAlice Carol 2.5\n";
let result = read_ncol(&ncol[..]).unwrap();
assert_eq!(result.graph.vcount(), 3);
assert_eq!(result.graph.ecount(), 3);
assert_eq!(result.names, vec!["Alice", "Bob", "Carol"]);
assert!(result.weights.is_some());