Skip to content
This repository was archived by the owner on Apr 26, 2019. It is now read-only.
This repository was archived by the owner on Apr 26, 2019. It is now read-only.

graph: consider adding multigraph support/API #109

@kortschak

Description

@kortschak

When the API has stabilised somewhat we can consider adding multigraph API support. This will have API flow-on consequences.

The main difference from an API perspective is that instead of an Edge method, the graph has an Edges(u, v Node) []Edge method. It is not entirely clear how the Weighter interface should work, but that can be defined as implementation dependent (min/max of edges, sum of edges, mean of edges etc).

Then from the perspective of graph mutation, adding edges is easy, the distinction from simple graphs being that they SetEdges while multi-graphs AddEdges. The issue of edge deletion is more complicated since currently edges are not distinguishable via the API except for their From and To nodes and their Weight. This may not be a problem, since if an Edge is Go language comparable, that test could be made (if two edges are identical, there is no issue and if they are otherwise distinguishable then the correct edge will be deleted); following this path requires that we specify that an Edge must be a Go comparable type. The alternative is to make Edge have an ID method and use that.

/cc @vladimir-ch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions