I have a graph stored in an adjacency list format. I randomly select a bunch of nodes and note the number of neighbors each of them have. I now want to plot the distribution, and the way I do it right now is by manually checking if the size of the neighbor set falls into a particular bucket (I set the bucket sizes manually and this checking process results in a bunch of very ugly if-then-else statements) and then increment the frequency accordingly. I then call matplotlib and plot the graph. This entire process seems really cumbersome and not pythonic at all. It's totally doable in Excel but I'm trying to make it as programmatic as possible.
I'm sure there's a better way to do this but I couldn't find anything related to frequency plotting. Any suggestions would be awesome.
Is matplotlib.pyplot.hist() what you are looking for?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With