Introduction to Network Analysis in Python
Eric Ma
Data Carpentry instructor and author of nxviz package
Examples:
Social
Transportation
Model relationships between entities
Insights:
Important entities: influencers in social network
Pathfinding: most efficient transport path
Clustering: finding communities
import networkx as nx
G = nx.Graph()
G.add_nodes_from([1, 2, 3])
G.nodes()
NodeView([1, 2, 3])
G.add_edge(1, 2)
G.edges()
EdgeView([(1, 2)])
G.nodes[1]['label'] = 'blue'
G.nodes(data=True)
[(1, {'label': 'blue'}), (2, {}), (3, {})]
nx.draw(G)
import matplotlib.pyplot as plt plt.show()
Introduction to Network Analysis in Python