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

ENH: Graph visual #1223

Merged
merged 76 commits into from May 19, 2016
Merged

ENH: Graph visual #1223

merged 76 commits into from May 19, 2016

Conversation

larsoner
Copy link
Member

We'll see if the CIs are happy. I think that's all that's left to be done. The rest could be subsequent PRs/improvements.

Lucas van Dijk added 30 commits May 19, 2016 13:45
Currently the nodes are placed at random.
The len() function does not work with sparse matrices.
Allow the user to also configure the arrow size when
using the GraphVisual.
The graph layout API will be based on iterators, to make
sure it is possible to get intermediate results of an
graph layout algorithm. This allows us to animate the
application of a certain layout on a graph.

This is the initial code, and is far from complete.
It currently only contains a function for a random
graph layout, which also doesn't provide any intermediate
results.
The GraphVisual does not compute the locations of the nodes
anymore. This is delegated to the `layout` property.

A layout is any iterator yielding a (node_vertices, line_vertices)
tuple. Using the iterator we can let layout algorithms yield
intermediate results, which the GraphVisual can use to animate
the layout.

The user can specify if it wants the the application of a layout on
a graph to be animated. But it is the responsibility of the user to
call GraphVisual.animate_layout() repeatedly until the calculation
of the layout is done.
Generation of line vertices have been moved to a separate function,
to reduce code duplication. Directed graphs are also supported again.

We let each graph layout generate their own line/edge vertices to allow
the layouts to decide how the edges look like (orthogonal, straight
lines).
The algorithm is adapted from NetworkX.
This makes more sense if you store the return value of animate_layout
in a variable called `ready`.
This function is adapted from NetworkX.
* Yield initial (random) positions
* Fix adjacency_mat square check
* Properly delegate the layout calculation
* Use float32 for `pos` array
* Normalize the layout to make sure it's in the range [0, 1]
It now uses a force directed layout by default, and animates the
layout generation.
Lucas van Dijk and others added 20 commits May 19, 2016 13:45
This fixes the conversion from dense arrays.
Prevents a numpy error if an empty array is given.
We already use the complete array.
It currently includes a test for the random and circular layout.
'f32' is not recognized anymore as proper datatype.
Under some conditions self._arrow_vbo was used before is was
actually initialized. This has now been fixed.
Setting the right pseudo-random-number-generator seeds was not enough
to produce reproducable outputs.
Use a hardcoded adjacency matrix.
@larsoner larsoner added this to the version 0.5 milestone May 19, 2016
@coveralls
Copy link

coveralls commented May 19, 2016

Coverage Status

Coverage decreased (-0.3%) to 70.353% when pulling 07cd175 on Eric89GXL:graph-visual into b8b14e5 on vispy:master.

@coveralls
Copy link

coveralls commented May 19, 2016

Coverage Status

Coverage decreased (-0.3%) to 70.361% when pulling 2622212 on Eric89GXL:graph-visual into b8b14e5 on vispy:master.

@larsoner
Copy link
Member Author

Phew, CIs are good

@larsoner larsoner merged commit 48b0409 into vispy:master May 19, 2016
@larsoner larsoner deleted the graph-visual branch May 19, 2016 20:09
@larsoner larsoner mentioned this pull request May 19, 2016
8 tasks
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.

None yet

2 participants