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

Inconsistent adjacency matrix for weighted and unweighted graphs #53

@rodrigolece

Description

@rodrigolece

We have the correct behaviour (self-edges should be double counted as pointed out in #38)

julia> g = SimpleGraph(1)
{1, 0} undirected simple Int64 graph

julia> add_edge!(g,1, 1)
true

julia> adjacency_matrix(g)

1×1 SparseArrays.SparseMatrixCSC{Int64,Int64} with 1 stored entry:
[1, 1] = 2

but we have the following which is inconsistent

julia> w = SimpleWeightedGraph(1)
{1, 0} undirected simple Int64 graph with Float64 weights

julia> add_edge!(w, 1, 1, 10)
true

julia> adjacency_matrix(w)
1×1 SparseArrays.SparseMatrixCSC{Int64,Int64} with 1 stored entry:
  [1, 1]  =  1

Ideally I would expect to see 20 (which is correct for weighted and undirected graphs) but at the very least I would expect to see 2 and not 1.

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