Skip to content

period function does not work correctly for abstract directed graphs #89

Closed
@simonschoelly

Description

@simonschoelly

Currently the period functions seems to work only for SimpleDiGraph. It should either be restricted to that type or implemented in a way that works with other directed AbstractGraph.

How to reproduce:

julia> using Graphs, SimpleWeightedGraphs

julia> g = cycle_digraph(4)
{4, 4} directed simple Int64 graph

julia> gw = SimpleWeightedDiGraph(g)
{4, 4} directed simple Int64 graph with Float64 weights

julia> period(g)
4

julia> period(gw)
ERROR: MethodError: no method matching difference(::SimpleWeightedDiGraph{Int64, Float64}, ::SimpleDiGraph{Int64})
Closest candidates are:
  difference(::T, ::T) where T<:AbstractGraph at ~/.julia/dev/Graphs/src/operators.jl:196
Stacktrace:
 [1] period(::Type{IsDirected{SimpleWeightedDiGraph{Int64, Float64}}}, g::SimpleWeightedDiGraph{Int64, Float64})
   @ Graphs ~/.julia/dev/Graphs/src/connectivity.jl:503
 [2] period(g::SimpleWeightedDiGraph{Int64, Float64})
   @ Graphs ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:331
 [3] top-level scope
   @ REPL[20]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions