Skip to content
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

Drawing graphs without edges not working. #141

Open
simonschoelly opened this issue Dec 9, 2020 · 1 comment
Open

Drawing graphs without edges not working. #141

simonschoelly opened this issue Dec 9, 2020 · 1 comment

Comments

@simonschoelly
Copy link

It looks as if it is not possible to plot a graph without edges:

julia> using LightGraphs, Plots, GraphRecipes

julia> plot(SimpleGraph(5))
ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] _empty_reduce_error() at ./reduce.jl:299
 [2] reduce_empty(::Function, ::Type{Int64}) at ./reduce.jl:309
 [3] mapreduce_empty(::typeof(identity), ::Function, ::Type{T} where T) at ./reduce.jl:343
 [4] reduce_empty(::Base.MappingRF{typeof(identity),typeof(max)}, ::Type{Int64}) at ./reduce.jl:329
 [5] reduce_empty_iter at ./reduce.jl:355 [inlined]
 [6] mapreduce_empty_iter(::Function, ::Function, ::Array{Int64,1}, ::Base.HasEltype) at ./reduce.jl:351
 [7] _mapreduce at ./reduce.jl:400 [inlined]
 [8] _mapreduce_dim at ./reducedim.jl:318 [inlined]
 [9] #mapreduce#620 at ./reducedim.jl:310 [inlined]
 [10] mapreduce at ./reducedim.jl:310 [inlined]
 [11] _maximum at ./reducedim.jl:727 [inlined]
 [12] _maximum at ./reducedim.jl:726 [inlined]
 [13] #maximum#631 at ./reducedim.jl:722 [inlined]
 [14] maximum at ./reducedim.jl:722 [inlined]
 [15] get_adjacency_matrix(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Float64,1}) at /home/simon/.julia/dev/GraphRecipes/src/graphs.jl:108
 [16] macro expansion at /home/simon/.julia/dev/GraphRecipes/src/graphs.jl:360 [inlined]
 [17] apply_recipe(::AbstractDict{Symbol,Any}, ::GraphRecipes.GraphPlot) at /home/simon/.julia/packages/RecipesBase/92zOw/src/RecipesBase.jl:282
 [18] _process_userrecipes!(::Any, ::Any, ::Any) at /home/simon/.julia/packages/RecipesPipeline/uPBKQ/src/user_recipe.jl:36
 [19] recipe_pipeline!(::Any, ::Any, ::Any) at /home/simon/.julia/packages/RecipesPipeline/uPBKQ/src/RecipesPipeline.jl:70
 [20] _plot!(::Plots.Plot, ::Any, ::Any) at /home/simon/.julia/packages/Plots/vsE7b/src/plot.jl:172
 [21] #plot#129 at /home/simon/.julia/packages/Plots/vsE7b/src/plot.jl:58 [inlined]
 [22] plot(::Any) at /home/simon/.julia/packages/Plots/vsE7b/src/plot.jl:52
 [23] top-level scope at REPL[146]:1
@xinyuhuang97
Copy link

I met the same problem and I have no choice but add an edge (i,i) for each node which doesn't cause misunderstanding for my question, may this will help someone and may the author find a solution one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants