-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphSpace support for agent based models #11
Comments
Haha, sorry about that!!! What I say is totally wrong! They work for systems in GridSpace or ContinuousSpace! To my understanding, what you would have to do is to port the So, in short: as soon as Makie has support for plotting graphs from LightGraphs.jl, then we can do this! I'll change the wrong statement in the docs asap. |
Also @SimonDanisch |
Ah ok, that's roughly what I expected. Nice to know that GridSpace and ContinuousSpace do work indeed. I'm not on Slack but will ask around on Zulip if somebody knows something about such efforts. I'm not familiar with Makie.jl myself (although I should really look into it...) so I personally wouldn't know where to start looking. So to understand it correctly: interactive_abm solely relies on Makie functions for plotting? Nothing else needed? So once Makie can plot graphs from LightGraphs, we're all set to use them in our interactive abms? |
I was referred to https://github.com/JuliaPlots/MakieRecipes.jl but it was unclear how complete that package is. |
Now that 16 months have passed, I think I want to carefully look into this issue again. Will see where it takes me. :) |
Makie has graph plotting now I have actually used it already for my book. See here: https://github.com/JuliaDynamics/NonlinearDynamicsTextbook/blob/master/figure_generation/10/10.2.jl You can use this code as a start! |
How did you make GraphMakie work with LightGraphs? I get the following when trying a MWE: julia> using LightGraphs, GraphMakie, GLMakie
julia> g = SimpleDiGraph(5, 20)
{5, 20} directed simple Int64 graph
julia> graphplot(g)
ERROR: MethodError: no method matching ne(::SimpleDiGraph{Int64})
Closest candidates are:
ne(::Graphs.SimpleGraphs.AbstractSimpleGraph) at /home/fbanning/.julia/packages/Graphs/5lMKo/src/SimpleGraphs/SimpleGraphs.jl:119
ne(::Graphs.AbstractGraph) at /home/fbanning/.julia/packages/Graphs/5lMKo/src/interface.jl:158
Stacktrace:
[1] find_edge_paths(g::SimpleDiGraph{Int64}, attr::Attributes, pos::Vector{Point{2, Float32}})
@ GraphMakie ~/.julia/packages/GraphMakie/tEQ8U/src/recipes.jl:307
[2] (::GraphMakie.var"#16#32"{Combined{GraphMakie.graphplot, Tuple{SimpleDiGraph{Int64}}}, Observable{SimpleDiGraph{Int64}}})(pos::Vector{Point{2, Float32}}, s::MakieCore.Automatic, d::MakieCore.Automatic, w::MakieCore.Automatic)
@ GraphMakie ~/.julia/packages/GraphMakie/tEQ8U/src/recipes.jl:162
[3] lift(::Function, ::Observable{Any}, ::Observable{Any}, ::Vararg{Observable{Any}, N} where N; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Makie ~/.julia/packages/Makie/gQOQF/src/interaction/nodes.jl:13
[4] lift(::Function, ::Observable{Any}, ::Observable{Any}, ::Observable{Any}, ::Vararg{Observable{Any}, N} where N)
@ Makie ~/.julia/packages/Makie/gQOQF/src/interaction/nodes.jl:10
[5] plot!(gp::Combined{GraphMakie.graphplot, Tuple{SimpleDiGraph{Int64}}})
@ GraphMakie ~/.julia/packages/GraphMakie/tEQ8U/src/recipes.jl:160
[6] plot!(scene::Scene, P::Type{Combined{GraphMakie.graphplot, Tuple{SimpleDiGraph{Int64}}}}, attributes::Attributes, input::Tuple{Observable{SimpleDiGraph{Int64}}}, args::Observable{Tuple{SimpleDiGraph{Int64}}})
@ Makie ~/.julia/packages/Makie/gQOQF/src/interfaces.jl:428
[7] plot!(scene::Scene, P::Type{Combined{GraphMakie.graphplot, ArgType} where ArgType}, attributes::Attributes, args::SimpleDiGraph{Int64}; kw_attributes::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:show_axis,), Tuple{Bool}}})
@ Makie ~/.julia/packages/Makie/gQOQF/src/interfaces.jl:339
[8] plot(P::Type{Combined{GraphMakie.graphplot, ArgType} where ArgType}, args::SimpleDiGraph{Int64}; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:28
[9] plot
@ ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:18 [inlined]
[10] graphplot(args::SimpleDiGraph{Int64}; attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GraphMakie ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
[11] graphplot(args::SimpleDiGraph{Int64})
@ GraphMakie ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
[12] top-level scope
@ REPL[4]:1 |
Ah just found this post saying
Edit: Just saw that the dep in Agents.jl has been changed to Graphs.jl as well. Will continue my work on adding GraphSpace to the abmplot recipe with the Agents.jl#master then, I suppose. |
LightGraphs.jl is deprecated and abandoned, Graphs.jl is literally its continuation. There are absolutely no reasons to be using Graphs.jl instead of LightGraphs.jl at the moment. EDIT: t h e o t h e r w a y a r o u n d |
You mean the other way around, right? :D Anyways, I agree. |
I'm going to pick up work on this again. Want to have basic support for |
The documentation of Agents.jl states that
interactive applications of Agents.jl work for any agent based model
. So I went ahead and tried it with two differentGraphSpace()
models and found out that this doesn't work.interactive_abm()
throws the following error in both cases:What could be done to make this work? Do you need any more information to understand the case?
Thanks in advance!
The text was updated successfully, but these errors were encountered: