Skip to content
James Wellnitz edited this page Jun 21, 2025 · 2 revisions

ChemGED is a Python package for enabling the appoximate graph edit distance (GED) computation between chemicals. Normally, GED is a NP-hard problem, but ChemGED uses heuristics to approximate the GED in a reasonable time.

    from chemged import ApproximateChemicalGED, UniformElementCostMatrix

    ged_calc = ApproximateChemicalGED(cost_matrix=UniformElementCostMatrix())

    # Compute the approximate GED
    ged = ged_calc.compute_ged("CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O", "CC(=O)Nc1ccc(O)cc1")
    print(f"Approximate GED: {ged}")
    >>> Approximate GED: 12.0

Clone this wiki locally