JuliaGraphs / GraphPlot.jl

Graph visualization for Julia.
http://JuliaGraphs.github.io/GraphPlot.jl/
Other
203 stars 62 forks source link

Adding Kamada Kawai layout #88

Open BCRARL opened 5 years ago

BCRARL commented 5 years ago

I've written a simple implementation of the Kamada Kawai layout using Optim. Is there interest in a general inclusion? If so, I'll clean it up and put in a pull-request.

sbromberger commented 5 years ago

Hi @BCRARL - does it require Optim.jl or other dependency? If so, we'd want to take a close look since we're trying not to explode the number of package dependencies in JuliaGraphs projects.

Thanks! Sorry for the delayed response.

BCRARL commented 5 years ago

Yeah, it requires Optim for the optimization. Kamada Kawai solves a non-linear least squares problem. $$ \min_{xi} \sum{i,j} (\sqrt{\lVert x_i-xj\rVert^2} - r{ij})^2, $$ where $r_{ij}$ is the shortest path along the graph between vertices $i$ and $j$. In my opinion,

atthom commented 4 years ago

Hi,

It's been a while since the last update. Is this layout will be added in GraphPlot? If not, is there an alternative package to add for Kamada Kawai layout?

BCRARL commented 4 years ago

You can just use my fork, @atthom . I haven't kept up to date with the master branch, so some minor manual merging might be necessary. If you need me to update my kamada_kawai branch, let me know.

BCRARL commented 4 years ago

I just merged all upstream changes, but I have not run any tests to see whether anything has broken in the meantime. If you run into an issue open it on my fork and I'll try to figure it out.

atthom commented 4 years ago

Alright, thank you for the fast update.

atthom commented 4 years ago

I actually developed something similar in the meantime, using Optim.jl. I have a significantly smaller implementation than you, though. I am sure there a lot missing but maybe there are a thing or two to take. https://gist.github.com/atthom/565f91aad416c400c280ed45b138123a

Constructive criticism is welcome :)