Adding a new magic command: %degreeDistribution#749
Conversation
| "we will default to using all the edge labels.") | ||
|
|
||
|
|
||
| # TODO: Additional parameter for saving the visualization? |
There was a problem hiding this comment.
any estimates on how much effort this would require to implement as well?
There was a problem hiding this comment.
It's trivial but not sure if needed, will confirm with Dave/Ozan.
adityaramesh12
left a comment
There was a problem hiding this comment.
Congratulations on your first contribution, @sariyuce! :)
Nice work on implementing the degree distribution visualization! This is a great addition implementing the degree distribution visualization functionality for Neptune Analytics.
The implementation is well-structured and the interactive widget approach will be very useful for users exploring graph degree distributions. Really nice work!
I've added a few suggestions to enhance the code further.
Additionally, Since there are multiple commits in this PR, please remember to squash them when merging to keep our commit history clean. Also ensure you modify the commit message.
Let me know if you need any clarification on the suggestions!
Looking forward to more contributions from you. 🚀
|
Thanks for the comments! I addressed the comments but will have some more changes before the next push. Will squash all. |
…heel for progress, plot is added as the first tab
| if degree_spread >= 100 and n > 1000: | ||
| x_scale = 'Log' | ||
| bin_type = 'Logarithmic' | ||
| initial_bin_width = (np.log10(max_deg+1) - np.log10(min_deg+1)) / np.log10(expected_nbins) |
There was a problem hiding this comment.
Here shouldn't we divide by expected_nbins directly instead of log(expected_nbins) ?
There was a problem hiding this comment.
Nope, this does logarithmic binning.
| with stats_output: | ||
| stats_output.clear_output(wait=True) | ||
| total_nodes = sum(counts) | ||
| total_edges = sum(d * c for d, c in zip(unique_degrees, counts)) // 2 |
There was a problem hiding this comment.
when td is inbound or outbound isn't the total_edges just sum(d * c for d, c in zip(unique_degrees, counts))?
There was a problem hiding this comment.
That's right, thanks for catching this.
Description of changes:
%degreeDistribution visualizes the degree distribution of the graph. It'll make use of a newly implemented
degreeDistributionalgorithm in NA (not GA yet).By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.