def full_isomorphism(xgr1, xgr2): """ full graph isomorphism """ assert xgr1 == explicit(xgr1) and xgr2 == explicit(xgr2) nxg1 = _networkx.from_graph(xgr1) nxg2 = _networkx.from_graph(xgr2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct
def full_isomorphism(gra1, gra2): """ full graph isomorphism """ assert gra1 == explicit(gra1) and gra2 == explicit(gra2) nxg1 = _networkx.from_graph(gra1) nxg2 = _networkx.from_graph(gra2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct
def backbone_isomorphism(xgr1, xgr2): """ graph backbone isomorphism for implicit graphs, this is the relabeling of `xgr1` to produce `xgr2` for other graphs, it gives the correspondences between backbone atoms """ xgr1 = implicit(xgr1) xgr2 = implicit(xgr2) nxg1 = _networkx.from_graph(xgr1) nxg2 = _networkx.from_graph(xgr2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct
def _isomorphism(gra1, gra2, igraph=False): """ """ if igraph: igr1 = _igraph.from_graph(gra1) igr2 = _igraph.from_graph(gra2) iso_dcts = _igraph.isomorphisms(igr1, igr2) iso_dct = iso_dcts[0] if iso_dcts else None else: nxg1 = _networkx.from_graph(gra1) nxg2 = _networkx.from_graph(gra2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct
def full_isomorphism(gra1, gra2, igraph=False): """ full graph isomorphism """ assert gra1 == explicit(gra1) and gra2 == explicit(gra2) if igraph: igr1 = _igraph.from_graph(gra1) igr2 = _igraph.from_graph(gra2) iso_dcts = _igraph.isomorphisms(igr1, igr2) iso_dct = iso_dcts[0] if iso_dcts else None else: nxg1 = _networkx.from_graph(gra1) nxg2 = _networkx.from_graph(gra2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct
def backbone_isomorphism(gra1, gra2, igraph=False): """ graph backbone isomorphism for implicit graphs, this is the relabeling of `gra1` to produce `gra2` for other graphs, it gives the correspondences between backbone atoms """ gra1 = implicit(gra1) gra2 = implicit(gra2) if igraph: igr1 = _igraph.from_graph(gra1) igr2 = _igraph.from_graph(gra2) iso_dcts = _igraph.isomorphisms(igr1, igr2) iso_dct = iso_dcts[0] if iso_dcts else None else: nxg1 = _networkx.from_graph(gra1) nxg2 = _networkx.from_graph(gra2) iso_dct = _networkx.isomorphism(nxg1, nxg2) return iso_dct