JuliaGraphs / GraphsBase.jl

Basic interface and structures for the JuliaGraphs ecosystem
http://juliagraphs.org/GraphsBase.jl/
MIT License
11 stars 1 forks source link

Weight matrices #17

Open gdalle opened 9 months ago

gdalle commented 9 months ago

Do they still make sense? Should weights be defined even for edges that don't exist?

gdalle commented 9 months ago

Related:

CameronBieganek commented 9 months ago

I think it's probably best to leave the interface generic, so something like weight(g, e) seems good.

Should weights be defined even for edges that don't exist?

Probably not? But I'm not really an expert on graph algorithms, so I can't say for sure.

gdalle commented 9 months ago

Should weights be defined even for edges that don't exist?

The question arises because in Graphs.jl, the default weight matrix is basically a FillArrays.Ones, which returns 1 for every query even when the edge does not exist. I don't like that.

gdalle commented 9 months ago

I think it's probably best to leave the interface generic, so something like weight(g, e) seems good.

Yes, and it's consistent with a remark by @mtfishman about separating the data from the edge (as in, weight(e) is less flexible)