#graph #symmetry #canonicalization #isomorphism #automorphism

graph_symmetry

Symmetry perception for graphs and its applications on canonicalization

2 releases

0.1.1 Nov 7, 2021
0.1.0 Nov 5, 2021

#463 in Science

Apache-2.0

185KB
3.5K SLoC

Crate graph_symmetry

Symmetry perception algorithm for graphs and its applications on canonicalization implemented in Rust

Examples

SMILES canonicalization

use graph_symmetry;

assert_eq!(graph_symmetry::ext::molecule::get_canon_smiles(&String::from("c1ccccc1CN")), "NCc1ccccc1".to_string());

Symmetry perception

use graph_symmetry;

let atom_vec = graph_symmetry::ext::molecule::smiles_to_atom_vec("C(C)(C)CCN");
let (orbits_givp, numbering) = graph_symmetry::ext::molecule::symmetry_perception_givp(&atom_vec);
assert_eq!(orbits_givp, vec![vec![1, 2]]);
assert_eq!(numbering, vec![6, 2, 2, 5, 4, 3]);
let (orbits_cnap) = graph_symmetry::ext::molecule::symmetry_perception_cnap(&atom_vec, &orbits_givp, &numbering);
assert_eq!(orbits_cnap, vec![vec![1, 2]]);

Tests

Unit tests

cargo test --lib

Integration tests

cargo test --test chembl_test
cargo test --test krotko_test

Dependencies

~190KB