input networkx graph into zss algorithm (tree edit distance)
问题 I want to compute the Zhang-Shasha tree-edit distance between 2 trees ( zss library). However, my trees are in the form of networkx graphs (they actually represent DOM html trees). The example in the zss documentation shows how to create a tree by hand: from zss import * A = ( Node("f") .addkid(Node("a") .addkid(Node("h")) .addkid(Node("c") .addkid(Node("l")))) .addkid(Node("e")) ) zss.simple_distance(A, A) # [0.0] Which would be the same tree as: import networkx as nx G=nx.DiGraph() G.add