Skip to content
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
merged 142 commits into from
Jun 29, 2023

Conversation

stefanhahmann
Copy link
Collaborator

@stefanhahmann stefanhahmann commented Jun 19, 2023

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

@stefanhahmann stefanhahmann self-assigned this Jun 19, 2023
* 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
stefanhahmann and others added 16 commits June 27, 2023 15:35
…tances and treeDistances

* This removes the costly calls to subtree1.indexOf(tree)
Co-authored-by: Matthias Arzt <arzt@mpi-cbg.de>
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/
@sonarcloud
Copy link

sonarcloud bot commented Jun 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

91.0% 91.0% Coverage
0.0% 0.0% Duplication

@stefanhahmann stefanhahmann merged commit 5501dc9 into master Jun 29, 2023
@stefanhahmann stefanhahmann deleted the zhang_unordered branch June 29, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation of Zhang Tree Edit Distance for unordered trees
2 participants