Class ZhangShashaTreeEditDistance.TreeOrdering
java.lang.Object
org.jgrapht.alg.similarity.ZhangShashaTreeEditDistance.TreeOrdering
- Enclosing class:
ZhangShashaTreeEditDistance<V,E>
Auxiliary class which for computes keyroot vertices, tree ordering and $l()$ function for a
particular tree.
A keyroot of a tree is a vertex which has a left sibling. Ordering of a tree assings an integer index to every its vertex. Indices are assigned using post-order traversal. $l()$ function for every vertex in a tree returns ordering index of its leftmost child. For leaf vertex the function returns its own ordering index.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classAuxiliary class which stores all needed variables to emulate recursive execution of DFS algorithm incomputeKeyrootsAndMapping()method. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) intOrdering index to be assigned to the next traversed vertex.List which at every position $i$ stores value of $l()$ function for a vertex fromtreewhihc has ordering index equal to $i$.List which at very position $i$ stores a vertex fromtreewhich has ordering index equal to $i$.List of keyroots oftree.Underlying tree of this ordering.(package private) final VRoot vertex oftree. -
Constructor Summary
ConstructorsConstructorDescriptionTreeOrdering(Graph<V, E> tree, V treeRoot) Constructs an instance of the tree ordering for the givengraphandtreeRoot. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcomputeKeyrootsAndMapping(V treeRoot) Runs post-order DFS ontreestarting attreeRoot.
-
Field Details
-
tree
-
treeRoot
Root vertex oftree. -
keyroots
-
indexToVertexList
-
indexToLValueList
-
currentIndex
int currentIndexOrdering index to be assigned to the next traversed vertex.
-
-
Constructor Details
-
TreeOrdering
-
-
Method Details
-
computeKeyrootsAndMapping
Runs post-order DFS ontreestarting attreeRoot. Assigns consecutive integer index to every traversed vertex and computes keyroots fortree.- Parameters:
treeRoot- root vertex oftree
-