# gexf
A tiny, dependency-light Rust library to export graphs to the [GEXF](https://gexf.net/) 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
```bash
cargo add gexf
```
```rust
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.