Skip to content

gonum/graph.Edges() is non-deterministic #6394

Closed

Description

@0xmichalis

When a graph G contains a set of edges, G.Edges() most of the time returns the set deterministically (the first edge starts from the root ie. the first node added in the graph, etc.) but that doesn't happen all the time. See #6246 (comment)

Currently there is no place in our graph code where we are based on the way Edges() returns edges, except Fprint which 1) we don't use anywhere, 2) probably has another bug (note that we always print the From node) too.

cc: @deads2k

Activity

  1. deads2k commented on Dec 18, 2015

    @deads2k
    Contributor

    There is no guarantee of ordering for edges. Code that relies on ordering is improper. If calling code needs ordering, it can choose the order it wants.

    In the case of Fprint if ordering has value (and I accept that it might), enforce ordering there. Since its dead, I'd just as soon see the method deleted.

  2. deads2k commented on Dec 18, 2015

    @deads2k
    Contributor

    Ok, I see why it seems like there should be. Bad API shape in the library we pulled in. There's still no natural ordering.

  3. 0xmichalis commented on Dec 18, 2015

    @0xmichalis
    ContributorAuthor

    @deads2k so what do you want to do with this issue? Remove Fprint, godoc Edges explaining what's what, and close, or you have any graph api changes in mind?

  4. deads2k commented on Dec 18, 2015

    @deads2k
    Contributor

    @deads2k so what do you want to do with this issue? Remove Fprint, godoc Edges explaining what's what, and close, or you have any graph api changes in mind?

    Remove Fprint and godoc the method explaining the lack of ordering. Lacking a proper Set, I think that returning a map is even less clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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