Graphica
Graphica is an open-source graph crate for Rust that allows for the generation, manipulation and canonization of multi-edge graphs with mixed directed and undirected edges and arbitrary node and edge data.
Graphica was open sourced by Ruijl Research and is a part of Symbolica.
Examples
Graph generation
Generate all unique graphs with two external edges with edge data g and with vertices with specific edge attachments:
let g = undirected;
let q = incoming;
let gs = generate
.unwrap;
let r = gs.keys.next.unwrap.to_mermaid;
println!;
yields
graph TD;
0["0"];
1["0"];
2["0"];
3["1"];
4["2"];
0 ---|"g"| 1;
0 ---|"g"| 2;
0 ---|"g"| 3;
0 ---|"g"| 4;
1 -->|"q"| 2;
2 -->|"q"| 1;
Graph canonization
Use a modified version of McKay's graph canonization algorithm to canonize graphs and detect isomorphisms:
let mut g = new;
let n0 = g.add_node;
let n1 = g.add_node;
let n2 = g.add_node;
let n3 = g.add_node;
let n4 = g.add_node;
let n5 = g.add_node;
let n6 = g.add_node;
let n7 = g.add_node;
let n8 = g.add_node;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
g.add_edge.unwrap;
let c = g.canonize;
assert_eq!;
assert_eq!;
println!;
yields canonical graph
graph TD;
0["0"];
1["0"];
2["0"];
3["0"];
4["1"];
5["1"];
6["1"];
7["1"];
8["2"];
0 ---|"0"| 2;
0 ---|"0"| 3;
0 ---|"0"| 6;
0 ---|"0"| 7;
0 ---|"0"| 8;
1 ---|"0"| 2;
1 ---|"0"| 3;
1 ---|"0"| 4;
1 ---|"0"| 5;
1 ---|"0"| 8;
2 ---|"0"| 5;
2 ---|"0"| 7;
2 ---|"0"| 8;
3 ---|"0"| 4;
3 ---|"0"| 6;
3 ---|"0"| 8;
Development
Follow the development and discussions on Zulip!