[RFC] GraphInterface.jl: An interface proposal for Graphs.jl version 2.0

Thanks for your work @CameronBieganek !

I’ll do my best to outline the differences based on both project descriptions.
Keep in mind that GraphsBase.jl and GraphInterface.jl are just preliminary proposals (at least that’s how I view them), so in the end I hope there will be just one package which does whatever the community thinks is best.
There are plenty of open GraphsBase.jl issues you can weigh in on, in addition to the current thread.

TLDR: GraphInterface.jl sounds cool, and I’m excited to look at the code! However, there are some key aspects that GraphsBase.jl aims at tackling:

  • support for metadata (to decrease user confusion)
  • support for multigraphs (which makes sense e.g. for transportation, where you can have various edges between 2 nodes)
  • interface with optional parts, formally specified and with tests (I’m betting on Interfaces.jl to help us get there)

What do people here think?

GraphsBase.jl will probably contain an interface and base types.
The idea is to offer at the very least SimpleGraph, SimpleWeightedGraph and MetaGraph in one place, hoping that the overhead of these struct definitions is fairly negligible.

Same in GraphsBase.jl, that is indeed one of the main goals.

Possible in GraphsBase.jl, although edges can be arbitrary objects.

Possible in GraphsBase.jl, but we would like to try and handle edge multiplicity, which raises the question of how to check if two edges are “equal”.

Strong disagreement 1: last time I checked there were 15 different packages for graphs with metadata, which is immensely confusing for the users. I think the only way to prevent that is to offer a common interface and a solid default MetaGraph type.

Strong disagreement 2, some graph types simply do not support vertex addition (think of GridGraphs.jl). The question of interfaces with optional parts is an unsolved one at the moment, but I’ve been working closely with @Raf on his package Interfaces.jl, which will soon be usable for graphs.

GraphsBase.jl takes directedness into account but the best mechanism for traits-based dispatch is not yet clear. In addition, the question of directed vs undirected edges has never been handled consistently.

That is also the main worry for GraphsBase.jl, and a good first step would be to clean up the Graphs.jl benchmarks. We also need to define the basic algorithms that we want to test for regressions in a 2.0 interface (cause we won’t be able to test them all while we iterate on the design).

That is an interesting suggestion! There was an old branch of mine on MetaGraphsNext.jl which took an atlernate route:

  • keep all algorithms defined on integers
  • add a macro to be able to call them and retrieve their results with actual vertex objects
dijkstra(g, 1, 2)
@labels dijkstra(g, 'a', 'b')
6 Likes