LightGraphs.jl icon indicating copy to clipboard operation
LightGraphs.jl copied to clipboard

Fallback for all edge operations

Open matbesancon opened this issue 4 years ago • 15 comments

It would be handy for all edge operations to have both f(g, e) and f(g, src(e), dst(e)) defined by default on abstract graphs

matbesancon avatar Feb 19 '20 18:02 matbesancon

(Agreed, but since this currently isn't manifesting as incorrect / unintended behavior, I've removed the "bug" tag.)

sbromberger avatar Feb 19 '20 21:02 sbromberger

@matbesancon could you start compiling a list of functions that will require new methods?

sbromberger avatar Feb 19 '20 21:02 sbromberger

Indeed the bug tag was my mistake, the github mobile interface is a bit of a pain

matbesancon avatar Feb 20 '20 17:02 matbesancon

I've mostly noticed it for add_edge! rem_edge! has_edge

matbesancon avatar Feb 20 '20 17:02 matbesancon

Do you have an example of code that demonstrates a case where one of those definitions doesn't work?

birm avatar Mar 08 '20 01:03 birm

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 09 '20 01:05 stale[bot]

bump

matbesancon avatar May 09 '20 09:05 matbesancon

(just for stalebot)

matbesancon avatar May 09 '20 09:05 matbesancon

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 11 '20 01:07 stale[bot]

go away bot

matbesancon avatar Jul 13 '20 12:07 matbesancon

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 11 '20 14:09 stale[bot]

@matbesancon did we ever fix this?

sbromberger avatar Dec 24 '20 13:12 sbromberger

No I don't think we did. It is done for has_edge: https://github.com/JuliaGraphs/LightGraphs.jl/blob/stable/src/interface.jl#L277

But it is the only function using edges in the interface. So not for all mutation functions adding and removing edges

matbesancon avatar Dec 26 '20 10:12 matbesancon

Since the discussion is not closed about this, I have a related issue. Would it be possible to access edges based on src and dst, mainly to get their index in the list of all edges? Does it fit in the same batch of potential changes? Just a newbie speaking, so don't mind me too much

gdalle avatar Dec 29 '20 11:12 gdalle

There is no Lightgraphs-based graph type that I know of that allows global edge indexing (e.g., get_edge(g, 15) returns whatever you determine to be the "15th" edge in the graph).

You could always make a graph type that does this (just define your data type with methods that allow indexing of the edges, and implement the 10 or so API functions that LightGraphs needs, and everything else should just work).

If you don't care about memory usage and you don't make changes to the graph, a collect(edges(g)) might suffice. But you're storing |2E| memory to do that (but with O(1) lookup, so that might be more important).

sbromberger avatar Dec 29 '20 12:12 sbromberger