nauty-pet

Canonical graph labelling.

Leverages nauty and Traces to find canonical labellings for petgraph graphs.

Usage

Version 2.6 or 2.7 of the nauty and Traces library has to be installed first and linked to the same C library as this crate.

Afterwards, add this to your Cargo.toml: toml [dependencies] nauty-pet = "0.3"

Example

```rust use petgraph::graph::UnGraph; use nauty_pet::prelude::*;

// Two different vertex labellings for the tree graph with two edges let g1 = UnGraph::<(), ()>::fromedges([(0, 1), (1, 2)]); let g2 = UnGraph::<(), ()>::fromedges([(0, 1), (0, 2)]);

let c1 = g1.intocanon(); let c2 = g2.intocanon(); assert!(c1.is_identical(&c2)) ```

Caveats

Edge weights are not considered when finding a canonical form. In general, the canonical form is only unique if all edge weights are the same.

License: Apache-2.0