Skip to main content

write_dl

Function write_dl 

Source
pub fn write_dl<W: Write>(
    graph: &Graph,
    vertex_labels: Option<&[String]>,
    edge_weights: Option<&[f64]>,
    writer: &mut W,
) -> IgraphResult<()>
Expand description

Write a graph in UCINET DL edgelist1 format.

Uses the edgelist1 representation with 1-based vertex IDs. Vertex labels are emitted as a labels: section if provided. Edge weights appear as a third field on each edge line.

ยงExamples

use rust_igraph::{Graph, write_dl};

let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();

let mut buf = Vec::new();
write_dl(&g, None, None, &mut buf).unwrap();
let s = String::from_utf8(buf).unwrap();
assert!(s.contains("DL n=3"));
assert!(s.contains("format = edgelist1"));