{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/12063","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/12063/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/12063/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/12063/events","html_url":"https://github.com/JuliaLang/julia/issues/12063","id":93778760,"number":12063,"title":"Strange type parameterization issue introduced around 30 June (or perhaps 16 June)","user":{"login":"sbromberger","id":941359,"avatar_url":"https://avatars.githubusercontent.com/u/941359?v=3","gravatar_id":"","url":"https://api.github.com/users/sbromberger","html_url":"https://github.com/sbromberger","followers_url":"https://api.github.com/users/sbromberger/followers","following_url":"https://api.github.com/users/sbromberger/following{/other_user}","gists_url":"https://api.github.com/users/sbromberger/gists{/gist_id}","starred_url":"https://api.github.com/users/sbromberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbromberger/subscriptions","organizations_url":"https://api.github.com/users/sbromberger/orgs","repos_url":"https://api.github.com/users/sbromberger/repos","events_url":"https://api.github.com/users/sbromberger/events{/privacy}","received_events_url":"https://api.github.com/users/sbromberger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-08T12:39:05Z","updated_at":"2015-07-08T22:32:13Z","closed_at":null,"body":"My LightGraphs.jl code started failing tests around 6/30. Before that date, it was working. The problem is in this code:\r\n\r\n```\r\ntype MinCutVisitor{T} <: AbstractMASVisitor\r\n  graph::SimpleGraph\r\n  parities::AbstractArray{Bool,1}\r\n  colormap::Vector{Int}\r\n  bestweight::T\r\n  cutweight::T\r\n  visited::Integer\r\n  distmx::AbstractArray{T, 2}\r\n  vertices::Vector{Int}\r\nend\r\n\r\nfunction MinCutVisitor{T}(graph::SimpleGraph, distmx::AbstractArray{T, 2})\r\n  n = nv(graph)\r\n  MinCutVisitor(\r\n    graph,\r\n    falses(n),\r\n    zeros(Int,n),\r\n    typemax(T),\r\n    zero(T),\r\n    zero(Int),\r\n    distmx,\r\n    @compat(Vector{Int}())\r\n)\r\nend\r\n...\r\nfunction mincut{T}(\r\n  graph::SimpleGraph,\r\n  distmx::AbstractArray{T, 2}\r\n )\r\n\r\n  visitor = MinCutVisitor(graph, distmx)     # <------ failure is here\r\n  colormap = zeros(Int, nv(graph))\r\n\r\n  traverse_graph(graph, T, MaximumAdjacency(), 1, visitor, colormap)\r\n\r\n  return( visitor.parities, visitor.bestweight)\r\nend\r\n\r\n```\r\n\r\nwith this test:\r\n```\r\ng = Graph(8)\r\n\r\n# Original example by Stoer\r\n\r\nwedges = [\r\n    (1, 2, 2.),\r\n    (1, 5, 3.),\r\n    (2, 3, 3.),\r\n    (2, 5, 2.),\r\n    (2, 6, 2.),\r\n    (3, 4, 4.),\r\n    (3, 7, 2.),\r\n    (4, 7, 2.),\r\n    (4, 8, 2.),\r\n    (5, 6, 3.),\r\n    (6, 7, 1.),\r\n    (7, 8, 3.) ]\r\n\r\n\r\nm = length(wedges)\r\neweights = spzeros(nv(g),nv(g))\r\n\r\nfor (s, d, w) in wedges\r\n    add_edge!(g, s, d)\r\n    eweights[s, d] = w\r\n    eweights[d, s] = w\r\nend\r\n...\r\nparity, bestcut = mincut(g, eweights)  # <------ failure is here\r\n```\r\n\r\nwith this error:\r\n```\r\nERROR: LoadError: LoadError: MethodError: `convert` has no method matching convert(::Type{LightGraphs.MinCutVisitor{T}}, ::LightGraphs.Graph, ::BitArray{1}, ::Array{Int64,1}, ::Float64, ::Float64, ::Int64, ::Base.SparseMatrix.SparseMatrixCSC{Float64,Int64}, ::Array{Int64,1})\r\nThis may have arisen from a call to the constructor LightGraphs.MinCutVisitor{T}(...),\r\nsince type constructors fall back to convert methods.\r\nClosest candidates are:\r\n  LightGraphs.MinCutVisitor{T}(::Union{LightGraphs.DiGraph,LightGraphs.Graph}, ::AbstractArray{Bool,1}, ::Array{Int64,1}, ::T, ::T, ::Integer, ::AbstractArray{T,2}, ::Array{Int64,1})\r\n  LightGraphs.MinCutVisitor{T}(::Union{LightGraphs.DiGraph,LightGraphs.Graph}, ::AbstractArray{T,2})\r\n  call{T}(::Type{T}, ::Any)\r\n```\r\n\r\nNow, the strange part: if I change the outer constructor in one of two ways, the tests pass:\r\n\r\n1) if I explicitly call the inner constructor with `{T}`, it works\r\n2) if I get rid of the `{T}` parameterization in the outer constructor definition (and change `AbstractArray{T,2}` to `AbstractArray`), it works.\r\n\r\nThe first one is confusing because I don't know why I'd have to pass the type to the inner constructor.\r\n\r\nThe second one is particularly confusing since I reference `T` in the code of the outer constructor. Yet the tests pass.\r\n\r\nEven more confusing: if the `distmx` is a sparse array of Integers (instead of Floats as in the test), it works without any modification.\r\n\r\nIn any case, more details are here: https://groups.google.com/d/msg/julia-users/uAntZ-eJ7kY/Heqq32Lhr3EJ\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/119750086","html_url":"https://github.com/JuliaLang/julia/issues/12063#issuecomment-119750086","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/12063","id":119750086,"user":{"login":"sbromberger","id":941359,"avatar_url":"https://avatars.githubusercontent.com/u/941359?v=3","gravatar_id":"","url":"https://api.github.com/users/sbromberger","html_url":"https://github.com/sbromberger","followers_url":"https://api.github.com/users/sbromberger/followers","following_url":"https://api.github.com/users/sbromberger/following{/other_user}","gists_url":"https://api.github.com/users/sbromberger/gists{/gist_id}","starred_url":"https://api.github.com/users/sbromberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbromberger/subscriptions","organizations_url":"https://api.github.com/users/sbromberger/orgs","repos_url":"https://api.github.com/users/sbromberger/repos","events_url":"https://api.github.com/users/sbromberger/events{/privacy}","received_events_url":"https://api.github.com/users/sbromberger/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T22:32:13Z","updated_at":"2015-07-08T22:32:13Z","body":"Appears to be an issue with sparse matrices? because\r\n\r\n```\r\njulia> LightGraphs.MinCutVisitor(g,zeros(Float64,8,8))\r\nLightGraphs.MinCutVisitor{Float64}({8, 0} directed graph,Bool[false,false,false,false,false,false,false,false],[0,0,0,0,0,0,0,0],Inf,0.0,0,8x8 Array{Float64,2}:\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0\r\n 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0,Int64[])\r\n```\r\nworks."}}