Repository navigation
3d facebook plot example - #6893
Conversation
|
Can somebody help me with the labels issue? I supposed I am supposed to spend somewhere the label "documentation" to the pull request, but I can not find it... |
|
I get the option of picking a label when I create a PR, and I can add them later also. But I suspect I have a permission setting that most people don't have. Anyway, I added the documentation label and it seems to be passing that test now. I checked -- and yes, you have to have "triage" permissions to add/change labels on a PR. |
|
Just to avoid misconceptions: There is nothing for me to do right now, right? Some of the maintainers will decide, when this pull request is "merged"... |
rossbar
left a comment
There was a problem hiding this comment.
Generally speaking the gallery example looks good, I left a few specific comments.
The big question here IMO is how to deal with the data. I realize 213 KB isn't exactly huge, but I'm always wary any time we're adding bloat to the source. FWIW there are some other data files already included in the examples directory (e.g. knuth miles) but they're all ~10x smaller.
Anyone else have an opinion on this? Could we potentially use a subset of the data instead?
|
|
||
| # Virtual environment directory | ||
| networkx-dev/ No newline at end of file | ||
| networkx-dev/ |
There was a problem hiding this comment.
This might seem strange, but I'd prefer not to touch .gitignore in this PR. I realize building the docs locally dumps these files into the dev environment which can be a bit of an eyesore, but it's an unrelated change that I'd actually propose to handle differently (i.e. with temporary files or io objects).
Anyways, let's undo the changes here. If this is something you're interested in pursuing, consider opening a separate PR!
| ================ | ||
|
|
||
| 3D spring plot for the Facebook graph investigated at https://networkx.org/nx-guides/content/exploratory_notebooks/facebook_notebook.html. | ||
| The plots are shown for two different azimuthal angles. One can see a slightly better clustering than the coreesponding spring layout in 2D. |
There was a problem hiding this comment.
FWIW I think the rendered example ends up only having a single view.
|
The image looks qualitatively similar with a dataset including the first 5000 lines of the current dataset. You can try it out by changing the graph creation line If you think that is an OK figure, then we could shrink the filesize from ~218K to ~12K. |
|
Clicking on from https://output.circle-artifacts.com/output/job/860418aa-db79-4852-92bf-e2f7c356819f/artifacts/0/doc/build/html/index.html |
|
circleci cleans up old builds, I have re triggered the doc build. |
|
I am curious if the documentation here allows moving gifs in addition to static png images. It would be fun to see this 3d plot rotating like https://i.stack.imgur.com/HnH4C.gif |
Agreed - according to the sphinx gallery documentation, animations are supported so this would be worth looking into! |
@rossbar could you please review #7025 ? It opens a door to add a 3D animation here if @Florian2Richter would like to do it. |
|
@lobpcg Hi, thank you very much for the help. It looks awesome. However, I started with 50 Frames for documentation and the local sphinx build takes forever (perhaps an hour or so), but the result looks great (even interactive)... @dschult I also shortened the file to 5000 lines... Thanks again for the help! |
|
This is only a documentation of a demo, so it should be attractive, educational, and fast, but not necessarily realistic. You can limit the number of frames, e.g., to 10 or 5, and further scale down the graph, maybe to 500?, simply saying in comments what these parameters mean and affect. Maybe read 5000, but than find a smart way to sample to down to 500 for the rotation? I have not checked if Networkx includes a smart sampling function of a graph. If still too slow, you can comment out the line with the rotation function call. But I would first try to speed it up by scaling it down. |
|
I think that it is more important for users that the example shows a graph for panda dataset via from_pandas_edgelist than the fact that it represents facebook. Maybe consider updating the title/name/description to reflect this? Finally, maybe try spectral 2D and 3D layouts checking if they are visually better or faster? |
|
@lobpcg Thanks for the proposals. I stay with the facebook descritpion this time, as it directly to the example referenced by the link. However, I did not find time enough to play with the spectral layout, which I am curious to do... Instead I added a parameters dictionary in the beginning, which motivates the user to play around with the number of samples and camera angels, etc. The result looks locally built pretty nice: |
rossbar
left a comment
There was a problem hiding this comment.
Hey @Florian2Richter , in an effort to push this forward I went ahead and pushed up some changes to simplify the example. I feel that gallery examples are best when they are tightly focused and have as few moving parts as possible, especially in this case where there is a companion notebook in nx-guides which is better suited as a sandbox for users who want to experiment with the data.
The data size problem has been dealt with, but reviewing I noticed that this example also has a large impact on the documentation runtime. On my local machine, it takes 45 sec to run this example, which is ~8x the run time of all of the other examples in the gallery combined. This is a blocker as the docs already build slowly in CI and adding an appreciable fraction to the build time for a single example is not worth it. The only real solution is to further subsample the graph (even more aggressively than was done originally) as in e.g. 1cfb54a. The problem there is that the structure of the network is largely lost. Perhaps the only real solution due to these considerations is to get rid of the animation and go back to a static image - WDYT?
|
maybe try spectral 2D and 3D layouts checking if they are visually OK but faster. |
|
The layout is only computed once. So that's not the time bottleneck. The animation is almost certainly what is taking the time... but I suppose we could profile it (compare to a static version for example, and to a 2 frame animation?) to make sure. |
|
To my recollection, the spectral layout is much faster than the spring so worth just trying. |
The layout is not the bottleneck, it is the rendering. It's possible that using |
|
Hello everyone, As I delve deeper into the project, it's becoming increasingly clear that matplotlib might not be the ideal tool for our needs. I've noticed that the rendering times on my local setup are quite lengthy, now averaging around 6 seconds. Here's a breakdown of the build times for various examples: Although these times are an improvement and the animations still present well (special thanks to @rossbar), I believe the durations are still on the longer side. I'd appreciate it if you could perform a final review on your end to determine if these rendering times are acceptable. If not, I will switch to a static image approach for efficiency. Thank you all once again for your contributions and support. |
|
I think it would be better to switch to static images for the docs. We can have animations for a specific example that shows how to do this for any others that would look nice with animation. But it does seem like the examples are not the right place for animations. Both build time and build storage requirements are pretty large. Thanks for reporting your findings. We have talked about the long term implications of animations in examples during our community meetings. And I hope I am representing that discussion here. (If anyone has more to add please join in.) Does this seem reasonable to you @Florian2Richter ? |
|
Indeed, going to a static image appears to be quite rational. In my opinion, it retains an educational or instructional significance, as it provides an opportunity to experiment with subsampling and to observe the distinctions between 3D and 2D clustering. On a personal note, I plan to utilize this graph as a practical example for clustering the graph using a graph convolutional network in a future project. |
|
What is the right place for animations in the NetworkX docs? Can the issue of long time generation be resolved by modifying the setup of documentation generation to update only the files that need to be updated rather than all the files? Matplotlib team is uninterested to add NetworkX to their requirements in examples so Matplotlib animations for NetworkX can only appear in the NetworkX repo. |
|
I think the right place would be the Take a look as let us know what do you think? |
@dschult Looking e.g., at |
|
The right place for the generated notebook is https://networkx.org/nx-guides/content/algorithms/lca/LCA.html :) |
Yes, thanks! Indeed, sorry I forgot... Yes, good suggestions. Maybe make a separate folder "gallery" and that would be a good place for heavy animations including this example with animations enabled and also extended to a larger graph as originally proposed, with cross-references. |
3f395e9 to
57cde7f
Compare
rossbar
left a comment
There was a problem hiding this comment.
I was looking through old PRs and came across this one again. I think it's a nice example and especially like that it cross-links to nx-guides to provide users with more info.
There were a few blockers that IMO had prevented this from crossing the finish line:
- I personally didn't like the inclusion of the data directly in the repo
- Selecting the subset of data that resulted in a nice visualization was tricky.
- The animation was slow
I went ahead and worked on this some and believe I have come up with a solution to all three issues:
- Source data: we can use
pandas.read_csvto load directly from a remote URL (at least until the SNAP server 403's us! If that happens we can always mirror the data ourselves) - Rather than randomly sample the edges, we can use
ego_graphto get connected induced subgraphs (this was the subject of the paper associated with the original dataset). I've arbitrarily selected one that I thought was a nice balance between size (only ~200 edges) and compelling visuals (subjective) - Step 2 already helps some with 3 by reducing the number of edges by ~10x, but I also dropped the number of frames in the animation to put things on par with the runtime of the other 3d animation examples.
With these changes, my most serious concerns have been addressed so I think this is good to go now. Thanks for putting this together @Florian2Richter !
|
For other reviewers, here's the updated gallery! |

Added 3D example to gallery [documentation]