Giter Club home page Giter Club logo

graphplot.jl's People

Contributors

afternone avatar andygreenwell avatar baggepinnen avatar bkamins avatar blegat avatar bovine3dom avatar ciaranomara avatar dehann avatar dilumaluthge avatar etiennedeg avatar fonsp avatar github-actions[bot] avatar goropikari avatar hdavid16 avatar jarlebring avatar juliohm avatar jzazo avatar kristofferc avatar matbesancon avatar mthelm85 avatar nmoran avatar sbromberger avatar simonschoelly avatar stevengj avatar tkelman avatar ven-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphplot.jl's Issues

License violation/attribution

Hi @afternone,

I just saw this code on julia-users. The visualizations look nice. I would like you to make clear that which code, including the spring and stress layout algorithms, have been copied directly from GraphLayouts.jl. In particular, you should adjust your license to make it clear that you do not own that code, and ideally the code would have comments indicating that it is not your work and where it came from.

Thanks!

Precompile and build error

Julia newbie here. I apologize if this is noise, but I've read through some of the other issues listed here, and it seems like they're addressing the actual usage of the package. I used pkg"add GraphPlot#master" because I had errors when trying to install via Pkg.add, and that seemed to work. However, when I try to using GraphPlot, I get this error message:

 Info: Precompiling GraphPlot [a2cc645c-3eea-5389-862e-a155d0052231]
โ”” @ Base loading.jl:1186
ERROR: LoadError: LoadError: syntax: unsupported `const` declaration on local variable around /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/layout.jl:99
Stacktrace:
 [1] include at ./boot.jl:317 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1038
 [3] include at ./sysimg.jl:29 [inlined]
 [4] include(::String) at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/GraphPlot.jl:3
 [5] top-level scope at none:0
 [6] include at ./boot.jl:317 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1038
 [8] include(::Module, ::String) at ./sysimg.jl:29
 [9] top-level scope at none:2
 [10] eval at ./boot.jl:319 [inlined]
 [11] eval(::Expr) at ./client.jl:389
 [12] top-level scope at ./none:3
in expression starting at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/layout.jl:64
in expression starting at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/GraphPlot.jl:23

Failed to precompile GraphPlot [a2cc645c-3eea-5389-862e-a155d0052231] to /home/agirdhar/.julia/compiled/v1.0/GraphPlot/bUwXr.ji.

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] macro expansion at ./logging.jl:311 [inlined]
 [5] _require(::Base.PkgId) at ./loading.jl:941
 [6] require(::Base.PkgId) at ./loading.jl:852
 [7] macro expansion at ./logging.jl:311 [inlined]
 [8] require(::Module, ::Symbol) at ./loading.jl:834
 [9] top-level scope at In[9]:25

I'm using Julia 1.0 in Jupyter with the most current version of LightGraphs. Any thoughts on this issue?

Failure to compile GraphPlot

When I try to compile GraphPlot, I get the following error.

Is this the correct place to report this, and is there a simple way to resolve? I tried removing either LightGraphs or Graphs packages, but GraphPlot seems to depend on both so it seems like a catch-22.

Possibly this is just because I am using Julia v0.5 and I should be using Julia v0.6.

julia> using(GraphPlot)
INFO: Precompiling module GraphPlot.
WARNING: Method definition open_file(Any) in module GraphPlot at /home/.../.julia/v0.5/GraphPlot/src/plot.jl:229 overwritten at /home.../.julia/v0.5/GraphPlot/src/plot_test.jl:297.
WARNING: both Graphs and LightGraphs export "AbstractGraph"; uses of it in module GraphPlot must be qualified
ERROR: LoadError: UndefVarError: AbstractGraph not defined

Plot with MetaGraphs?

I'm wondering if we set the plot layouts, e.g vertices color, edge color with MetaGraphs, and then we will be able to use a single command gplot(g) to plot a graph.

But I didn't find any integration between these two packages, or there's some package I didn't notice?

Edges aren't drawn in output file

Consider the following graph correctly displayed in a Jupyter notebook with display:

screenshot from 2016-04-17 13-53-06

When I try to save the graph to a file, the edges disappear:

draw(SVG("foo.svg", 16cm, 16cm), gplot(G))

There is an easy fix to this issue? I am preparing a presentation by the end of the week and I would like to include a GIF of the graph algorithm in action.

Tag a new version

Could you please tag a new version? The latest tag is not functioning with the latest LG tag.

I wrote a utility that uses graphplot - useful for macs with iterm

Hi,

Now that @juliohm has fixed some graphplot stuff, it works again in the REPL. If you have a mac and iterm with the iterm shell extensions installed, you can use graphcat to display a graph in repl. This uses Plots, which gives a different view of the graph than GraphPlot.

If you have iterm with TerminalExtensions, gcat will give you the GraphPlot view which (IMO) is a bit nicer. Screenshots attached.

You can download the code by cloning https://github.com/sbromberger/MiscGraphUtils.jl.

screen shot 2017-06-25 at 11 52 37

screen shot 2017-06-25 at 11 52 48

spectral_layout gives an error

using LightGraphs
using GraphPlot

G =  Graph(3)
gplot(G, layout=spectral_layout)

LoadError: MethodError: _spectral has no method matching _spectral(::SparseMatrixCSC{Int64,Int64})
while loading In[2], in expression starting on line 5

linetype="curve" option not working

using LightGraphs
using GraphPlot

G = DiGraph(2)
add_edge!(G, 1,2)
add_edge!(G, 2,1)

display(gplot(G, linetype="curve"))

LoadError: MethodError: convert has no method matching convert(::Type{Measures.Measure}, ::Float64)
This may have arisen from a call to the constructor Measures.Measure(...),
since type constructors fall back to convert methods.
Closest candidates are:
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, !Matched::T)
while loading In[50], in expression starting on line 8

in call at /home/julio/.julia/v0.5/Compose/src/form.jl:894
in parsepathop at /home/julio/.julia/v0.5/Compose/src/form.jl:901
in parsepath at /home/julio/.julia/v0.5/Compose/src/form.jl:1098
in path at /home/julio/.julia/v0.5/Compose/src/form.jl:1125
in gplot#7 at /home/julio/.julia/v0.5/GraphPlot/src/plot.jl:191
in gplot at /home/julio/.julia/v0.5/GraphPlot/src/plot.jl:217
[inlined code] from essentials.jl:114

SVG missing in LG tutorials

For some reason, some of the SVG generated by GraphPlot.jl are not appearing in the notebook online:

https://github.com/JuliaGraphs/JuliaGraphsTutorials/blob/master/Basics.ipynb

I am not sure this is an issue in the GraphPlot.jl package or an issue of the visualization feature of GitHub. The notebook shows correctly on my laptop locally.

@afternone do you have a guess of what may be happening? I don't want to interrupt you too much, I know you are about to defend your thesis.

Feature request: NetworkLayout.jl and SimpleWeightedGraphs.jl integration

Thanks for making a great package! Would it be possible to integrate this with the above two mentioned packages? I'm thinking that we then could write

gplot(g; layout=NetworkLayout:Stress)

where g is a weighted graph, which means that we directly use those weights as input to the NetworkLayout-algorithm?

Edge coloring?

Is it possible to adjust the colors of the edges? I don't see it anywhere in the examples. If not, could this be a feature? I have an application where I'd like to change the weight or transparency of the edges, and it seems like something that would be generally useful.

gplothtml doesn't work

I get the following error with julia v0.6.1, GraphPlot 0.2.0 and Compose 0.5.4

julia> gplothtml(graphfamous("karate"))
 WARNING: takebuf_string(b) is deprecated, use String(take!(b)) instead.
 Stacktrace:
  [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
  [2] takebuf_string(::Base.AbstractIOBuffer{Array{UInt8,1}}) at ./deprecated.jl:57
  [3] #gplothtml#39(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:248
  [4] gplothtml(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:242
  [5] eval(::Module, ::Any) at ./boot.jl:235
  [6] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
  [7] macro expansion at ./REPL.jl:97 [inlined]
  [8] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
 while loading no file, in expression starting on line 0
 ERROR: UndefVarError: OS_NAME not defined
 Stacktrace:
  [1] open_file(::String) at ~/.julia/v0.6/GraphPlot/src/plot.jl:229
  [2] #gplothtml#39(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:270
  [3] gplothtml(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:242

I can use Compose to draw an svg without problem.

 julia> Compose.draw(Compose.SVG("dessin.svg", 20cm, 20cm), gplot(graphfamous("karate")))
 false
 => svg created as expected

document ability to pass x,y locations to gplot

Inspired by a stackoverflow question.

It would be nice to allow the vertices' positions to be specified by, say, a vector of (x, y) tuples, which are then normalized to whatever canvas is being used and plotted.

Register and tag package

Can this package be registered and tagged with METADATA.jl such that one does not need to perform Pkg.clone to make use of it?

ERROR: LoadError: MethodError: `_src_index` has no method matching _src_index(::Graphs.ExEdge{Graphs.ExVertex}, ::Graphs.GenericEdgeList{Graphs.ExVertex,Graphs.ExEdge{V},Array{Graphs.ExVertex,1},Array{Graphs.ExEdge{V},1}})

I can plot a graph fine using the built in graphs plot, but the gplot command fails with the following error
ERROR: LoadError: MethodError: _src_index has no method matching _src_index(::Graphs.ExEdge{Graphs.ExVertex}, ::Graphs.GenericEdgeList{Graphs.ExVertex,Graphs.ExEdge{V},Array{Graphs.ExVertex,1},Array{Graphs.ExEdge{V},1}})
Closest candidates are:
_src_index{V}(::Graphs.Edge{V}, ::Graphs.AbstractGraph{V,E})
in graphline at /home/rachel/.julia/v0.4/GraphPlot/src/lines.jl:29
in gplot at /home/rachel/.julia/v0.4/GraphPlot/src/plot.jl:201
in gplot at /home/rachel/.julia/v0.4/GraphPlot/src/plot.jl:219

Compilation Error with Julia 0.6

GraphPlot does not precompile properly on my computer (Windows 10 and Julia 0.6). It used to work with 0.5.2. Here is the error, it seems to be linked to the Graphs.jl dependency.

ERROR: LoadError: LoadError: TypeError: Type{...} expression: expected UnionAll, got base.Collections.#PriorityQueue  
Stacktrace:    
[1] include_from_node1(::String) at .\loading.jl:569  
[2] include(::String) at .\sysimg.jl:14 
[3] include_from_node1(::String) at .\loading.jl:569 
[4] include(::String) at .\sysimg.jl:14  
[5] anonymous at .\<missing>:2 
while loading C:\Users\bouac\.julia\v0.6\Graphs\src\maximum_adjacency_visit.jl, in expression starting on line 15 
while loading C:\Users\bouac\.julia\v0.6\Graphs\src\Graphs.jl, in expression starting on line 140 
ERROR: LoadError: Failed to precompile Graphs to C:\Users\bouac\.julia\lib\v0.6\Graphs.ji. 
Stacktrace:     
[1] compilecache(::String) at .\loading.jl:703   
[2] _require(::Symbol) at .\loading.jl:456  
[3] require(::Symbol) at .\loading.jl:398  
[4] include_from_node1(::String) at .\loading.jl:569 
[5] include(::String) at .\sysimg.jl:14  
[6] anonymous at .\<missing>:2
while loading C:\Users\bouac\.julia\v0.6\GraphPlot\src\GraphPlot.jl, in expression starting on line 7  
ERROR: Failed to precompile GraphPlot to C:\Users\bouac\.julia\lib\v0.6\GraphPlot.ji.   
Stacktrace: 
[1] compilecache(::String) at .\loading.jl:703    
[2] _require(::Symbol) at .\loading.jl:490    
[3] require(::Symbol) at .\loading.jl:398         

Thanks!

Problem with the tutorial

The following tutorial does not seem to work.
https://github.com/JuliaGraphs/GraphPlot.jl/blob/master/examples/graphplot.ipynb

I have executed the first two cells and I get the following errors.

 julia> using Graphs, GraphPlot
 Warning:[...]
 
 julia> g = simple_graph(3, is_directed=false)
 add_edge!(g, 1, 2)
 add_edge!(g, 2, 3)
 add_edge!(g, 3, 1)
 # just plot it
 gplot(g) 
 Undirected Graph (3 vertices, 0 edges)
 
 julia> edge [1]: 1 -- 2
 
 julia> edge [2]: 2 -- 3
 
 julia> edge [3]: 3 -- 1
 
 julia> 
 julia> ERROR: MethodError: no method matching _nv(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}})
 Closest candidates are:
   _nv(!Matched::LightGraphs.AbstractGraph) at ~/.julia/v0.6/GraphPlot/src/GraphPlot.jl:41
 Stacktrace:
  [1] spring_layout(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/layout.jl:99
  [2] #gplot#38(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:224
  [3] gplot(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:224

GraphPlot needs more tests

There are large parts of the code that are not covered by tests. Furthermore, there should be tests special cases, such as graphs with 0, 1, 2 or three vertices, few edges, self-loops and so on as some of the layouts have problems with these cases.

Subplots?

I would like to create a figure with several graphs. Does GraphPlot support anything like subplot?

spring_layout does not use the correct Fruchterman-Reingold aglorithm

The documentation for spring_layoutsays, that the algorithm uses the the forces

Attractive force:  f_a(d) =  d^2 / k
Repulsive force:  f_r(d) = -k^2 / d

but what it actually does, is using

Attractive force:  f_a(d) =  d / k
Repulsive force:  f_r(d) = -k^2 / d^2

where d is the distance between two vertices and k is some constant. That also works, so I'm wondering, if we want to keep using this modified version or use the original version by Fruchterman and Reingold.
Networkx uses the same modified version, so either this is done on purpose or the error was copied when implementing it in Julia.

Make Release

I'd like to use #76 (deterministic spring layout) without telling my colleagues to install GraphPlots#master. That was the last change in almost four months, so I'd really appreciate a minor release.

Thanks for all your hard work!

Directed Graphs edgelabels fix?

This commit modified the placement of edge labels for directed graphs such that the edge label location cannot be altered by the end user. Can this change be reverted such as to allow for the placement of edge labels to still be controlled by the edgelabeldistx and edgelabeldisty arguments?

Remove plot_test.jl

Can we remove plot_test.jl from the project? It seems that it was copied from plot.jl and slightly modified for...?

Please let me know if I can proceed and I will submit a PR with the deletion.

GraphPlot package isn't loading when debugging

Hi, I'm using the GraphPlot package in my Julia program. I added that to Julia and even updated it several times.I checked whether the required GraphPlot.ji is in /Users/user/.julia/lib/v0.5. But it's located in the following path. /Users/user/.julia/v0.5/GraphPlot/src.

Is there anything that we could do to fix this one? The following is the error message that I'm getting when running the code.

LoadError: Failed to precompile GraphPlot to /Users/user/.julia/lib/v0.5/GraphPlot.ji. while loading /Users/user/Dropbox/P/M/ip.jl, in expression starting on line 5 in compilecache(::String) at loading.jl:593 in require(::Symbol) at loading.jl:422 in require(::Symbol) at sys.dylib:? in include_string(::String, ::String) at loading.jl:441 in include_string(::String, ::String) at sys.dylib:? in include_string(::Module, ::String, ::String) at eval.jl:34 in (::Atom.##59#62{String,String})() at eval.jl:73 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30 in withpath(::Function, ::String) at eval.jl:38 in macro expansion at eval.jl:71 [inlined] in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60

Conditional dependencies?

It seems strange to REQUIRE LightGraphs and Graphs when in all likelihood people will want to use this great package for either one or the other. Could I recommend something along the lines of what we do in LightGraphs for conditional dependencies?

try
    using LightGraphs
    nothing
catch
end

then you can have

if isdefined(:LightGraphs)
...

for the LG specific code, repeating for Graphs.jl as necessary.

add Erdos support

I'd like to add Erdos support to GraphPlot. The implementation is kinda trivial but there is a design decision I would like to discuss with @afternone @jpfairbanks @sbromberger before I file a PR.
Up to few days ago, when both Graphs and LightGraphs where supported, they where both required and imported by GraphPlot. We could do the same with Erdos and LG, also dependencywise it wouldn't be a burden since most dependence are in common, but I think that a cleaner design for GraphPlot would be to have it depend on no package:

try
     import LightGraphs
catch
    println("LightGraphs not installed. Once installed, execute the command `Base.compilecache(\"GraphPlot\")` 
   to activate plotting functionalities for LightGraphs.")
end
try
     import Erdos
catch
    println("Erdos not installed. Once installed, execute the command `Base.compilecache(\"GraphPlot\")` 
   to activate plotting functionalities for Erdos.")
end

if !isdefined(:Erdos) && !isdefined(:LightGraphs)
   warn("No supported graph package installed.")
end

if isdefined(:LightGraphs)
_nv(g::LightGraphs.SimpleGraph) = LightGraphs.nv(g)
_ne(g::LightGraphs.SimpleGraph) = LightGraphs.ne(g)
_vertices(g::LightGraphs.SimpleGraph) = LightGraphs.vertices(g)
_edges(g::LightGraphs.SimpleGraph) = LightGraphs.edges(g)
_src_index(e::LightGraphs.Edge, g::LightGraphs.SimpleGraph) = LightGraphs.src(e)
_dst_index(e::LightGraphs.Edge, g::LightGraphs.SimpleGraph) = LightGraphs.dst(e)
_adjacency_matrix(g::LightGraphs.SimpleGraph) = LightGraphs.adjacency_matrix(g)
_is_directed(g::LightGraphs.SimpleGraph) = LightGraphs.is_directed(g)
_laplacian_matrix(g::LightGraphs.SimpleGraph) = LightGraphs.laplacian_matrix(g)
end
....

What do you think?

nodestrokec has no effect

Hi (and thanks for the fantastic package!)
When using

using Colors
using GraphPlot
g = graphfamous("karate")
gplothtml(g,nodestrokec = RGB(1,0,0))

nodes remain as in case when I skip the nodestrokec argument. Am I misunderstanding something or is it a bug?
EDIT: nevermind; just figured out that nodestroke linewidth is 0 buy default, sorry for creating an issue!

discussion: deprecate Graphs.jl compatibility

Graphs.jl itself is now part of JuliaArchive, and it's a fairly heavy dependency. I'd like to propose that we tag a final version that has Graphs.jl compatibility and then remove it from REQUIRE.

Thoughts?

gplot throws an InexactError() exception when the input x and y locations are integers

It looks like the signature for gplot indicates that the x_loc_in and y_loc_in arguments can be any subtype of Real, but when I input integer arrays for those arguments, an InexactError() is thrown:

grid = Grid([4, 8])
xloc = repeat(collect(1:8); inner = 4)
yloc = repeat(collect(1:4); outer = 8)
gplot(grid, xloc, yloc)

ERROR: InexactError()
Stacktrace:
[1] convert(::Type{Int64}, ::Float64) at ./float.jl:679
[2] map!(::GraphPlot.##29#34, ::Array{Int64,1}, ::Array{Int64,1}) at ./abstractarray.jl:1862
[3] #gplot#28(::Void, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::Float64, ::Float64, ::Array{Any,1}, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Void, ::Float64, ::Float64, ::Float64, ::String, ::Float64, ::GraphPlot.#gplot, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}, ::Array{Int64,1}, ::Array{Int64,1}) at /home/cbieganek/.julia/v0.6/GraphPlot/src/plot.jl:134
[4] gplot(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}, ::Array{Int64,1}, ::Array{Int64,1}) at /home/cbieganek/.julia/v0.6/GraphPlot/src/plot.jl:115

It works fine if I input arrays of floats instead:

gplot(grid, Float64.(xloc), Float64.(yloc))

_src not defined in spectral_layout (nv > 500)

Could you please fix this issue?

LoadError: UndefVarError: _src not defined
while loading In[10], in expression starting on line 5

in spectral_layout at /home/juliohm/.julia/v0.4/GraphPlot/src/layout.jl:238
in gplot at /home/juliohm/.julia/v0.4/GraphPlot/src/plot.jl:219

Layout problems with directed graph containing many disconnected components

I'm attaching some files that show the result of rendering with GraphPlot (gets it wrong) and with TikzGraph (gets it right).

The data are here: https://drive.google.com/file/d/12CfjV7kv2r7EAmSQoudfMog7p9r-OAr1/view?usp=sharing

Save that to /tmp/backedges.jld2 or something similar. Then you can create the graph with

julia> using FileIO

julia> backedges = load("/tmp/backedges.jld2", "backedges");

julia> using LightGraphs

julia> g = SimpleDiGraph(length(backedges))
{652, 0} directed simple Int64 graph

julia> for (i, deps) in enumerate(backedges)
           for src in deps
               add_edge!(g, src, i)
           end
       end

and then plot g.

backedges.pdf
backedges2.pdf

With GraphPlot you can see the edges don't connect to nodes on both ends.

make default layout deterministic

The default spring_layout is non-deterministic, which doesn't seem desirable to me. It seems better to do something like:

function deterministic_spring_layout(g::AbstractGraph; seed::Integer=0, kws...)
    rng = MersenneTwister(seed)
    spring_layout(g, 2 .* rand(rng, nv(g)) .- 1.0, 2 .* rand(rng,nv(g)) .- 1.0; kws...)
end

Node colors does not work for large graphs on Jupyter/IJulia

I'm looking at a version of the connectome("neural wiring") of the C. elegans worm, a graph of 297 vertices. I'm trying to display the graph with each vertex colored according to it's eccentricity, with more central vertices in a hotter color.

However, gplot() colors each node black, even with the nodefillc parameter assigned. It seems that this is an issue with plotting large graphs. Test code, adapted from the documentation:

using LightGraphs
using GraphPlot

n=195
g=erdos_renyi(n,.05)
membership=rand([1,2], nv(g));
nodecolor = [colorant"lightseagreen", colorant"orange"]
nodefillc = nodecolor[membership]
gplot(g, nodefillc=nodefillc)

When n is larger than 195, the nodes are all filled in black, as opposed to green and orange.

Ploting DiGraph error

using LightGraphs
using GraphPlot

h = DiGraph(5)
add_edge!(h,1,2)
add_edge!(h,1,4)

gplot(h)
LoadError: MethodError: `_nv` has no method matching _nv(::LightGraphs.DiGraph)
while loading In[6], in expression starting on line 1

 in spring_layout at /home/ollin/.julia/v0.4/GraphPlot/src/layout.jl:99
 in gplot at /home/ollin/.julia/v0.4/GraphPlot/src/plot.jl:224

GraphPlot not plotting - Simple mistake?

Hi,
I am very new to Julia and its packages. I just tried to plot the following simple example. But instead of returning a plot, I actually receive only text (when executing in the terminal; however, it is plotting just fine when running in an IJulia notebook):

julia> using LightGraphs
julia> using GraphPlot
julia> g = Graph(10)
{10, 0} undirected simple Int64 graph
julia> add_edge!(g,1,2)
true
julia> add_edge!(g,1,3)
true
julia> add_edge!(g,2,4)
true
julia> gplot(g)
Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(Compose.UnitBox{Float64,Float64,Float64,Float64}(-1.2, -1.2, 2.4, 2.4, 0.0mm, 0.0mm, 0.0mm, 0.0mm)), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([Compose.Form{Compose.LinePrimitive}(Compose.LinePrimitive[Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.450282cx, -0.154949cy), (0.42973cx, -0.145017cy)]), Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.592226cx, -0.224599cy), (0.599174cx, -0.22806cy)]), Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.287127cx, -0.0767231cy), (0.283029cx, -0.0747783cy)])], Symbol(""))]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.948683mm)]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.827451,0.827451,0.827451,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.948683mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.827451,0.827451,0.827451,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(4.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([Compose.Form{Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}}(Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}[Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.521462cx, -0.18935cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.35855cx, -0.110616cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.669937cx, -0.263309cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.211605cx, -0.0408853cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((1.0cx, 0.842752cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-1.0cx, 0.0422872cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.513202cx, 0.981626cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-0.720904cx, -0.747201cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-0.311552cx, 1.0cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.0961543cx, -1.0cy), 0.0316228w)], Symbol(""))]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.25098,0.878431,0.815686,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(4.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))]), List([]), List([]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))
julia> 

I am sure I am doing something wrong. I just cannot figure out what it is. I googled the issue but I couldn't find a similar issue.

Many thanks for your help and feedback!
Marco

change node size to fit labels

It would be nice if the node size automatically stretched out to fit the label text. (Also, currently you can only change the node radius, but for this you would want to stretch the node elliptically in one direction.)

For example, consider the following labelled graph:
image
and compare to the output of GraphViz for similar labels:
image
(Note also that GraphViz has proper arrowheads.)

Error while Precompiling module GraphPlot

Hi,

I want to use GraphPlot to visualize my graphs from LightGraphs.
By using GraphPlot i have got the following error in the Precompiling state.

Can you help me ?

ERROR:
julia> using GraphPlot
INFO: Precompiling module GraphPlot.
WARNING: Method definition open_file(Any) in module GraphPlot at /home/simon/.julia/v0.5/GraphPlot/src/plot.jl:229 overwritten at /home/simon/.julia/v0.5/GraphPlot/src/plot_test.jl:297.
WARNING: both Graphs and LightGraphs export "AbstractGraph"; uses of it in module GraphPlot must be qualified
ERROR: LoadError: UndefVarError: AbstractGraph not defined
in macro expansion; at ./none:2 [inlined]
in anonymous at ./:?
while loading /home/simon/.julia/v0.5/GraphPlot/src/GraphPlot.jl, in expression starting on line 56
ERROR: Failed to precompile GraphPlot to /home/simon/.julia/lib/v0.5/GraphPlot.ji.
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
in macro expansion at ./REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68

Julia Version
Version 0.5.1

Installed Packages:
julia> Pkg.status()
14 required packages:

  • Atom 0.5.10
  • Distributions 0.13.0
  • GaussianMixtures 0.1.0
  • GraphPlot 0.1.0
  • Grid 0.4.2
  • ImageMagick 0.4.0
  • Images 0.10.1
  • Interpolations 0.6.2
  • JLD 0.6.11
  • LightGraphs 0.7.7
  • Optim 0.7.8
  • PyCall 1.14.0
  • PyPlot 2.3.2
  • TestImages 0.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.