Skip to main content

deduplicate()

The first graph of each isomorphism class, in input order.

Usage

Source

deduplicate(graphs)

Graphs are bucketed by a fingerprint (stereo-aware colour refinement: equal for isomorphic graphs) and compared with isomorphism within a bucket. All graphs must be of one type (GraphError otherwise).

>>> from protomol import from_smiles
>>> kept = deduplicate([from_smiles("OC"), from_smiles("CC"), from_smiles("CO")])
>>> [g.symbols for g in kept]

[(‘O’, ‘C’, ‘H’, ‘H’, ‘H’, ‘H’), (‘C’, ‘C’, ‘H’, ‘H’, ‘H’, ‘H’, ‘H’, ‘H’)]