Graphs.jl
Graphs.jl copied to clipboard
[bugfix] `Base.eltype` works on graph types as well as instances
According to the Julia documentation, eltype should be defined on the ::Type{AbstractGraph} instead of the instances themselves:
"The definition eltype(x) = eltype(typeof(x)) is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types."
Currently, however:
julia> eltype(SimpleGraph{Int64})
Any
julia> eltype(SimpleGraph{Int64}())
Int64
This PR fixes this to return
julia> eltype(SimpleGraph{Int64})
Int64