You left out the initialization code for the fields in your excerpt above. 
What happens when you call Graph(Int16(5))?

On Friday, March 6, 2015 at 2:42:20 PM UTC-5, Seth wrote:
>
>
>
> I have
>
> abstract AbstractGraph{T<:Integer}
>
> type Graph{T}<:AbstractGraph{T}
>     vertices::UnitRange{T}
>     edges::Set{Edge{T}}
>     finclist::Vector{Vector{Edge{T}}} # [src]: ((src,dst), (src,dst), 
> (src,dst))
>     binclist::Vector{Vector{Edge{T}}} # [dst]: ((src,dst), (src,dst), 
> (src,dst))
> end
>
> function Graph{T<:Integer}(n::T)
>
>
>
>
>
> and g = Graph(5) works and produces a graph of type Graph{Int64}, but g = 
> Graph{Int64}(5) produces
>
> ERROR: MethodError: `convert` has no method matching 
> convert(::Type{LightGraphs.Graph{Int64}}, ::Int64)
>
> This is a problem because I have 
>
> function union{T<:AbstractGraph}(g::T, h::T)
>     gnv = nv(g)
>     r = T(gnv + nv(h))
>     for e in edges(g)
>         add_edge!(r,e)
>     end
>     for e in edges(h)
>         add_edge!(r, gnv+src(e), gnv+dst(e))
>     end
>     return r
> end
>
>
>
> Which is failing on line 3 (in the creation of the graph).
>
> What's the proper way of creating the object from a parameterized type? 
> Thanks.
>

Reply via email to