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

fix stress layout #193

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

GiggleLiu
Copy link

List of changes

  1. Fix the incorrect implementation of stress layout,
  2. Speed up the code.

In the paper "Graph Drawing by Stress Majorization", it is mentioned that the expect distance matrix δ (or dij in the paper) should be the graph theoretical distance, rather than the uniform matrix implemented in the original implementation.
image

The current implementation is also more than 10x faster for large graphs in my test case.

Example

The visualization of a chain like graph

Before the change

image

After the change

image

@etiennedeg
Copy link
Member

For directed graphs, we want to ignore directedness. We would need an efficient wrapper for that instead of allocating a new graph.

@GiggleLiu
Copy link
Author

For directed graphs, we want to ignore directedness. We would need an efficient wrapper for that instead of allocating a new graph.

Sorry, I am not very familiar with directed graphs. Any comments on how to implement the suggested change?

@etiennedeg
Copy link
Member

We would need to write

if is_directed(g)
    g = Graph(g)
end

before computing δ, but this is dramatic for big graphs since it will fully allocate a new graph. We need here a wrapper around g that simulates an undirected graph without allocating. This wrapper would be of general interest for Graphs.jl, so I will add it.

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

Successfully merging this pull request may close these issues.

2 participants