## canonical_form()


The canonical graph and the atom map to it: `(canonical, atom_map)`.


Usage

``` python
canonical_form(gra: G) -> tuple[G, tuple[int, ...]]
 
canonical_form(gra: AnyGraph) -> tuple[AnyGraph, tuple[int, ...]]
```


Atom k of `canonical` is atom `atom_map[k]` of `gra` (AutoStorage's `atom_map` direction, P22), so `canonical == relabel(gra, atom_map)`. Two graphs are the same up to atom numbering exactly when their canonical graphs are equal, chain LS included (P92).

``` python
>>> from protomol import from_smiles
>>> canonical, atom_map = canonical_form(from_smiles("OC"))
>>> canonical.symbols, atom_map
```

(('C', 'O', 'H', 'H', 'H', 'H'), (1, 0, 2, 3, 4, 5))

``` python
>>> canonical == canonical_form(from_smiles("CO"))[0]
```

True
