Back to Browse

Dynamic Edges in Graphs (Python and PyVis Tutorial 12)

6.4K views
May 4, 2020
8:57

New JSON File: https://drive.google.com/file/d/1vkskhq5e_kv7z11vlq8zCT6YhkZibsqe/view?usp=sharing Updated Code: def map_data(letter_data, ep_color="#03DAC6", ms_color="#da03b3", edge_color="#018786", ep_shape="triangle", ms_shape="box", alg="barnes", buttons=False, recipient_color="#FFA300", recipient_shape="ellipse", cited_color="#DFEE9A", cited_shape="square"): g = Network(height="1500px", width="100%", bgcolor="#222222", font_color="white", directed=True) g.add_node("Alcuin 1", color="#EB9090") if buttons==True: g.width = "75%" g.show_buttons(filter_=["edges"]) for letter in letter_data[0:10]: ep = (letter["ep_num"])[0] mss = (letter["mss"]) recipients = (letter["recipients"]) people_cited = (letter["people_cited"]) g.add_node(ep, color=ep_color, shape=ep_shape) g.add_edge("Alcuin 1", ep, color=edge_color) for ms in mss: g.add_node(ms, color=ms_color, shape=ms_shape) g.add_edge(ep, ms, color=edge_color) for recipient in recipients: g.add_node(recipient, color=recipient_color, shape=recipient_shape) g.add_edge(ep, recipient, color=recipient_color) g.add_edge("Alcuin 1", recipient, color="#EB9090") for cited in people_cited: if "Alcuin 1" not in cited: g.add_node(cited, color=recipient_color, shape=recipient_shape) g.add_edge(ep, cited, color=cited_color) map_algs(g, alg=alg) g.set_edge_smooth("dynamic") If you enjoy this video, please subscribe. I provide all my content at no cost. If you want to support my channel, please donate via PayPal: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=AZ73QW52SUX8N&currency_code=USD&source=url Patreon: https://www.patreon.com/WJBMattingly (its my www.themedievalworld.com account as well). If there's a specific video you would like to see or a tutorial series, let me know in the comments and I will try and make it. If you liked this video, check out www.PythonHumanities.com, where I have Coding Exercises, Lessons, on-site Python shells where you can experiment with code, and a text version of the material discussed here.

Download

0 formats

No download links available.

Dynamic Edges in Graphs (Python and PyVis Tutorial 12) | NatokHD