-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Zhang Tree Edit Distance for labeled unordered trees #26
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* jgrapht library is used for the implementation of zhang unordered tree edit distance
* maxFlowMinCost() computes the min cost of the max flow in a simple directed weighted graph considering the given costs (weights) and capacities * Equivalent to: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.flow.max_flow_min_cost.html * Unit-test example taken from: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.flow.max_flow_min_cost.html
…e Zhang Distance of unordered labeled trees * original code here: https://gitlab.inria.fr/mosaic/treex/-/blob/master/src/treex/analysis/edit_distance/zhang_labeled_trees.py
…tances and treeDistances * This removes the costly calls to subtree1.indexOf(tree)
Co-authored-by: Matthias Arzt <arzt@mpi-cbg.de>
…n in ZhangUnorderedTreeEditDistanceTest
For small number of entries (normally two in our cases) List seems to be faster than Set: https://forum.unity.com/threads/hashset-vs-list-vs-array-performance.1124380/
stefanhahmann
force-pushed
the
zhang_unordered
branch
from
June 27, 2023 15:53
9c11882
to
a42f86f
Compare
This allows to reduce the number of Map<Tree, something> from 4 to 2 in ZhangUnorderedTreeEditDistance
Fix 2 typos: * Operation 3b * Operation 4a Add description of 4b
…eEditDistance more precise
Kudos, SonarCloud Quality Gate passed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request adds a method to compute The Zhang tree edit distance for labeled unordered trees, cf.: Zhang (1996) Algorithmica (1996) 15:205-222 "A Constrained Edit Distance Between Unordered Labeled Trees"
It is based on a refactored version of the Python implementation of it: https://gitlab.inria.fr/mosaic/treex/-/blob/master/src/treex/analysis/edit_distance/zhang_labeled_trees.py
Resolves #24