Skip to content

Instantly share code, notes, and snippets.

@MJacobs1985
Last active September 29, 2021 08:13
Show Gist options
  • Save MJacobs1985/e50c48f056bf097e7c3efab93150959d to your computer and use it in GitHub Desktop.
Save MJacobs1985/e50c48f056bf097e7c3efab93150959d to your computer and use it in GitHub Desktop.
Network Graphs for Epidemiology
import networkx as nx
G = nx.Graph()
G.add_node(1)
nx.draw(G, with_labels=True, font_weight='bold', font_color='white', node_color='black', node_size=500)
G.add_nodes_from([2, 3])
nx.draw(G, with_labels=True, font_weight='bold', font_color='white', node_color='black', node_size=500)
H = nx.path_graph(10)
G.add_nodes_from(H)
nx.draw(G, with_labels=True, font_weight='bold', font_color='white', node_color='black', node_size=500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment