Pure Python

The most natural way to describe a network in pure Python is to represent each edge as a tuple or list of two nodes and collect all edge tuples or list in another list—the edge list.

 lincoln_list = [
  (​"A.L."​, ​"Edward Baker L."​), (​"A.L."​, ​"Robert Todd L."​),
  (​"A.L."​, ​"William Wallace L."​), (​"A.L."​, ​"Thomas L. III"​),
  (​"Jessie Harlan L."​, ​"Mary L. Beckwith"​),
  (​"Jessie Harlan L."​, ​"Robert Todd L. Beckwith"​),
  (​"Mary L."​, ​"L. Isham"​), (​"Robert Todd L."​, ​"A.L. II"​),
  (​"Robert Todd L."​, ​"Jessie Harlan L."​),
  (​"Robert Todd L."​, ​"Mary L."​), (​"Thomas L."​, ​"A.L."​),
  (​"Thomas L."​, ​"Sarah L. Grigsby"​), (​"Thomas L."​, ​"Thomas L. Jr."​),
 ]

The previous ...

Get Complex Network Analysis in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.