Edges and Weights

Module 5: Complex Networks

Toolkit page

This page is self-study material for Session 23. It continues NetworkX Basics.

The first chunk rebuilds the country graph of the previous page, with four nodes and a population attribute.

import networkx as nx

G = nx.Graph()
G.add_node("Spain", population=47_000_000)
G.add_node("Portugal", population=10_000_000)
G.add_node("France", population=67_000_000)
G.add_node("Italy", population=60_000_000)

What’s Next?

The next page draws these graphs.

Drawing Graphs