0

使用 python 库 networkx 可以使用函数检查同构is_isomorphic(G1, G2),其中 G1 和 G2 是两个图(https://networkx.github.io/documentation/stable/reference/algorithms/isomorphism.html)。

但是在检查存在一个之后,如何得到同构的一一对应的节点呢?

假设我们专门执行节点匹配。

4

1 回答 1

2

这是要走的路,实际上是在这里:https ://networkx.github.io/documentation/stable/reference/algorithms/isomorphism.vf2.html

import networkx as nx
from networkx.algorithms import isomorphism
G1 = nx.path_graph(4) # create super simple graphs
G2 = nx.path_graph(4)
GM = isomorphism.GraphMatcher(G1,G2)
GM.is_isomorphic()
GM.mapping # prints the matching/mapping
于 2019-07-26T23:54:34.257 回答