JuliaGraphs / JuliaGraphs/GraphPlot.jl

dim=3 plotting non-edges

Open
#116 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
213
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I posted the following on discourse.julialang.org. I am hoping somebody can help me.

I am successfully interacting with a 3D graph created with LightGraphs, but plotly backend is rather slow when I have 2000 nodes and 10,000 edges. It might be slow because the curvature argument creates intermediate points on an edge modeled by a spline. However, there is no acceleration when curvature is zero, and yet, a straight line is sufficient. That is not reasonable. Also, when curvature is low, an edge could be modeled with a reduced number of intermediate nodes. So I created a graph with a single edge, and ran the following code (notice the x,y,z arguments to graphplot.

using LightGraphs
using GraphRecipes
import Plots
Plots.plotly()

function plotGraph()
    graph = SimpleGraph(20, 1)
    nb_nodes = nv(graph)
    xx = rand(nb_nodes)
    yy = rand(nb_nodes)
    zz = rand(nb_nodes)
    p = graphplot(graph, dim=3, curvature=0, x=xx, y=yy, z=zz)
end

p = plotGraph()

The graph has edges associated with it. How is that possible? It is as if the position matrices are being used to create edges.

I looked at the source code to graphplot and it is very complex because of the level of generality. It seems to me that the code could be refactored to be more efficient. For example, if not graph restructuring is needed and edges are straight, processing can be decreased substantially. I like the generality when it is needed, but really do not understand why a graph of 2000 nodes with 10000 edges needs a minute to display (if I am luck), in 3D when curvature =0. I would expect a factor 100 speedup. The timing has nothing to do with first-time execution of my function. It is the same for the 2nd and 3rd execution. Thank you.

Any ideas?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the graphplot entry point and reproduce the supplied Julia example with dim=3, curvature=0, and explicit x, y, and z positions. Check why a graph with one edge appears to contain additional edges and compare the straight-edge path with the slower curved path; done means the plotted edges match the graph and zero-curvature 3D plots are materially faster.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, plotly
Domain
data-visualization, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.