-
Notifications
You must be signed in to change notification settings - Fork 86
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
Edit distance between 2 equal graphs is not 0. #111
Comments
Hi! Judging by the current implementation, this is expected behavior, because the default value for the help?> edit_distance
search: edit_distance
edit_distance(G₁::AbstractGraph, G₂::AbstractGraph)
Compute the edit distance between graphs G₁ and G₂. Return the minimum edit cost
and edit path to transform graph G₁ into graph G₂. An edit path consists of a
sequence of pairs of vertices(u,v) ∈ [0,|G₁|] × [0,|G₂|]` representing vertex
operations:
• (0,v): insertion of vertex v ∈ G₂
• (u,0): deletion of vertex u ∈ G₁
• (u>0,v>0): substitution of vertex u ∈ G₁ by vertex v ∈ G₂
Optional Arguments
––––––––––––––––––––
• insert_cost::Function=v->1.0
• delete_cost::Function=u->1.0
• subst_cost::Function=(u,v)->0.5 Therefore, if you specify that the substitution cost should be zero for identical vertices, you end up with an edit distance of zero: julia> dist, _ = edit_distance(G1, G2, subst_cost=(u, v) -> (u == v ? 0 : 1))
(0.0, Tuple[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]) You may wonder why the edit path is still non-empty. This is a design choice specifying that we have to substitute every vertex of Does that help you? |
|
Yeah, I can reproduce this but I have no clue why this happens. @etiennedeg ? |
Yes, I identified the issue, this function is totally broken. I started working on a fix, but I get caught by other occupations. I will try to get something clean this week-end. |
* fix edit_distance * some fixes * add tests; little bit of cleaning * make code type stable * use something; initiate cost with a float * Apply formatter * Fix docstring --------- Co-authored-by: Guillaume Dalle <22795598+gdalle@users.noreply.github.com>
Hi
I was using the python library networkX to find isomorphic graphs, but I moved the code to Julia because I need efficiency. My problem is with the file edit_distance.jl.
Check this lines of code
The outputed distance is 3, but shouln't it be 0?
The two graphs are the same.
Thank you
The text was updated successfully, but these errors were encountered: