Skip to content

A* Star is problematic when working with SimpleWeightedGraph #48

@mzy2240

Description

@mzy2240

The MWE is modified from the test:

using Graphs, SimpleWeightedGraphs

g = SimpleWeightedGraph(3)
add_edge!(g, 1, 2, 0.5)
add_edge!(g, 2, 3, 0.8)
add_edge!(g, 1, 3, 2.0)
a_star(g, 1, 3)

and the return does not match the actual edge weight

2-element Vector{SimpleWeightedEdge{Int64, Float64}}:
 Edge 1 => 2 with weight 1.0  # should be 0.5
 Edge 2 => 3 with weight 1.0  # should be 0.8

Querying the weight using SimpleWeightedGraphs.weight on the vector returned by a_star would give the default weight 1.0, which can be observed by running SimpleWeightedGraphs.weight(a_star(g, 1, 3)[1]) == 1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions