i foolishly tried to do this in python - https://python-graph-gallery.com/323-directed-or-undirected-network/

but this is a lot closer to what i want: https://codepen.io/ValYouW/pen/BpbWNX