gexf

Crates.iogexf
lib.rsgexf
version0.1.1
created_at2025-10-13 13:30:20.412112+00
updated_at2025-10-13 13:33:54.270766+00
descriptionLightweight Rust library to export graphs in the GEXF format (Gephi)
homepage
repositoryhttps://github.com/roeeshoshani/gexf.git
max_upload_size
id1880518
size20,297
Roee Shoshani (roeeshoshani)

documentation

README

gexf

A tiny, dependency-light Rust library to export graphs to the GEXF format, compatible with Gephi and other tools.

Features

  • Directed / undirected / mutual graphs (defaultedgetype)
  • Node labels and arbitrary attributes
  • Gephi viz extras: position, size, color
  • Metadata (<meta>): creator, description, last modified date
  • Write to any std::io::Write sink or straight to String

Quick start

cargo add gexf
use gexf::{GraphBuilder, EdgeType, Node};

let gexf = GraphBuilder::new(EdgeType::Directed)
    .meta("my-app", "Sample")
    .add_node(Node::new("n0").with_label("Alice"))?
    .add_node(Node::new("n1").with_label("Bob"))?
    .add_edge("n0", "n1")?
    .try_build()?;

let xml = gexf.to_string()?; // or gexf.write(File::create("graph.gexf")?)

Notes

  • This crate emits GEXF 1.3 with the viz namespace (viz:*).
  • Dynamic graphs (spells, time slices) are not supported.
  • Attributes here are simple key–value pairs written under <attvalues>. The full <attributes> schema is not supported.

Disclaimer

This crate was mostly developed by ChatGPT. I only cleaned it up and fixed a bunch of bugs.

Commit count: 0

cargo fmt