{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/171","labels_url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/171/comments","events_url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/171/events","html_url":"https://github.com/JuliaLang/Graphs.jl/issues/171","id":57701461,"number":171,"title":"Graphs is too general to be useful","user":{"login":"mlubin","id":1733683,"avatar_url":"https://avatars.githubusercontent.com/u/1733683?v=3","gravatar_id":"","url":"https://api.github.com/users/mlubin","html_url":"https://github.com/mlubin","followers_url":"https://api.github.com/users/mlubin/followers","following_url":"https://api.github.com/users/mlubin/following{/other_user}","gists_url":"https://api.github.com/users/mlubin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlubin/subscriptions","organizations_url":"https://api.github.com/users/mlubin/orgs","repos_url":"https://api.github.com/users/mlubin/repos","events_url":"https://api.github.com/users/mlubin/events{/privacy}","received_events_url":"https://api.github.com/users/mlubin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-14T18:16:15Z","updated_at":"2015-02-14T19:10:33Z","closed_at":null,"body":"There have been some grumbles before about this in the abstract sense, but here's a concrete technical example of how the overparameterization of the ``Graph`` object limits its usability:\r\n\r\nWith Julia 0.4:\r\n```julia\r\njulia> g = simple_graph(2)\r\nDirected Graph (2 vertices, 0 edges)\r\n\r\njulia> add_edge!(g,1,2)\r\nedge [1]: 1 -- 2\r\n\r\njulia> @code_warntype Pair(g,2)\r\nVariables:\r\n  first::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}\r\n  second::Int64\r\n\r\nBody:\r\n  begin \r\n      return ((top(apply_type))(Pair,A,B)::Type{_<:Pair{A,B}})(first::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}},second::Int64)::Pair{A,B}\r\n  end::Pair{A,B}\r\n```\r\n\r\nNote that the return type of ``Pair`` can't be inferred. I'm guessing this is because of ``MAX_TYPE_DEPTH`` recently discussed [here](https://groups.google.com/forum/#!topic/julia-users/q2QMptFeRuE).\r\n\r\nIn general it seems like any type which is parameterized by a type of a graph suffers from this. This affects ``TargetIterator``, ``SourceIterator``, ``out_neighbors``, ``in_neighbors``, and maybe more.\r\n\r\n@lindahua @sbromberger @JeffBezanson @IainNZ "},"comment":{"url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/comments/74387886","html_url":"https://github.com/JuliaLang/Graphs.jl/issues/171#issuecomment-74387886","issue_url":"https://api.github.com/repos/JuliaLang/Graphs.jl/issues/171","id":74387886,"user":{"login":"mlubin","id":1733683,"avatar_url":"https://avatars.githubusercontent.com/u/1733683?v=3","gravatar_id":"","url":"https://api.github.com/users/mlubin","html_url":"https://github.com/mlubin","followers_url":"https://api.github.com/users/mlubin/followers","following_url":"https://api.github.com/users/mlubin/following{/other_user}","gists_url":"https://api.github.com/users/mlubin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlubin/subscriptions","organizations_url":"https://api.github.com/users/mlubin/orgs","repos_url":"https://api.github.com/users/mlubin/repos","events_url":"https://api.github.com/users/mlubin/events{/privacy}","received_events_url":"https://api.github.com/users/mlubin/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T19:10:33Z","updated_at":"2015-02-14T19:10:33Z","body":"I bumped up ``MAX_TYPE_DEPTH`` in my local build and the timings on a particular graph coloring instance in ReverseDiffSparse went from\r\n```\r\nelapsed time: 18.321259555 seconds (4459 MB allocated, 3.41% gc time in 204 pauses with 1 full sweep)\r\n```\r\nto\r\n```\r\nelapsed time: 4.350620804 seconds (1383 MB allocated, 4.43% gc time in 63 pauses with 1 full sweep)\r\n```"}}