Skip to content

Conversion from a SimpleWeightedGraph incorrectly swaps edge weights #56

@Keluaa

Description

@Keluaa

Example:

julia> using SimpleWeightedGraphs

julia> g = SimpleWeightedDiGraph([1], [2], [1])
{2, 1} directed simple Int64 graph with Int64 weights

julia> SimpleWeightedGraphs.get_weight(g, 1, 2)
1

julia> SimpleWeightedGraphs.get_weight(g, 2, 1)
0

julia> metis_g = Metis.graph(g)
ERROR: weights must be positive integers, got weight 0 for edge (2, 1)
...

The error comes from this line:

weight = get_weight(G, i, j)

Which should be get_weight(G, j, i).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions