Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

distance calculation with a_star fails with SimpleWeightedGraph and SimpleWeightedDiGraph #69

@henrik-wolf

Description

@henrik-wolf

I was trying to calculate the distance between two nodes using the A* algorithm implemented in LightGraphs. For example

using LightGraphs, SimpleWeightedGraphs
t = SimpleWeightedGraph(3)
add_edge!(t, 1, 2, 0.5)
add_edge!(t, 2, 3, 0.8)
add_edge!(t, 1, 3, 2.0)
a_star(t, 1,  3)

throws an error:

MethodError: no method matching SimpleWeightedGraphs.SimpleWeightedEdge{Int64,Float64}(::Int64, ::Int64)

So far I have worked out, that the problem arises, when the a_star algorithm tries to call the constructor of the SimpleWeightedEdge type in the a_start.jl file.
I would have believed that the definition of

SimpleWeightedEdge(x, y) = SimpleWeightedEdge(x, y, one(Float64))

in line 18 of simpleweightededge.jl would exactly match this case. Am I missing something, or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions