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
ENH: Graph visual #1223
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This fixes the conversion from dense arrays.
Prevents a numpy error if an empty array is given.
Improves readability
It's faster this way.
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.
Phew, CIs are good |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.