A small python module to play with the friendship paradox:
"most likely your friends have more friends than you do (on average)"
All the instructions are for unix-like machines (I have a Mac), so you would have to translate if you have a PC.
This runs as a simple python module (no external libraries!), so just install the following software above.
For Mac, I'd recommend installing brew and using it to install the software.
Edit friends.dot
to change the structure of the network.
I'd recommend keeping it a very simple dot graph in the style of the first 2 examples, here:
- first line to name graph and open curly brackets
- last line to close curly brackets
- each line in between in
<name> -- <name>;
format (semi-colon is optional)
$ # run calculations (assumes friends.dot)
$ python friendship_paradox.py
$ # create png image file from friends.dot
$ dot -T png -O friends.dot
$ # open all png image files
$ open -g *.png
Assuming you use the default friends.dot
, you'll get the image at the top.
For quick experimentation, you can of course combine these into one command with the unix &&
symbol:
python friendship_paradox.py && dot -T png -O friends.dot && open -g *.png