Formalization of the AbstractGraph
interface from Graphs.jl, specified using Interfaces.jl.
Install GraphsInterfaceChecker.jl using the GitHub URL, and install Interfaces.jl from the general registry:
using Pkg
Pkg.add(url="https://github.com/JuliaGraphs/GraphsInterfaceChecker.jl")
Pkg.add("Interfaces")
using GraphsInterfaceChecker
using Interfaces
The only name exported by this package is AbstractGraphInterface
.
Suppose you define a new graph type MyGraphType <: Graphs.AbstractGraph
.
To declare that you implement the interface, you need to provide a list of (small) test_graphs
, then use the macro Interfaces.@implements
like so:
Interfaces.@implements AbstractGraphInterface MyGraphType test_graphs
Then, you can validate your implementation as follows:
Interfaces.test(AbstractGraphInterface, MyGraphType)