2012-12-04 34 views

回答

2

您可以檢索兩個圖之間的同構映射。會這樣嗎?見here

>>> from networkx.algorithms import isomorphism 
>>> G1 = nx.path_graph(4) 
>>> G2 = nx.path_graph(4) 
>>> GM = isomorphism.GraphMatcher(G1,G2) 
>>> GM.is_isomorphic() 
True 
>>> GM.mapping 
{0: 0, 1: 1, 2: 2, 3: 3}