pub fn write_pajek<W: Write>(
graph: &Graph,
labels: Option<&[String]>,
weights: Option<&[f64]>,
writer: &mut W,
) -> IgraphResult<()>Expand description
Write a graph in Pajek (.net) format.
Writes *Vertices section (with optional labels), then *Edges
(undirected) or *Arcs (directed) section with optional weights.
§Examples
use rust_igraph::{Graph, write_pajek};
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let labels = vec!["A".to_string(), "B".to_string(), "C".to_string()];
let mut buf = Vec::new();
write_pajek(&g, Some(&labels), None, &mut buf).unwrap();
let s = String::from_utf8(buf).unwrap();
assert!(s.contains("*Vertices 3"));
assert!(s.contains("\"A\""));
assert!(s.contains("*Edges"));