NetworkX

The striking difference between the NetworkX code and the other previously shown code fragments is the ability to add named edges and nodes directly to the graph, which is a natural way of building a real-world complex network.

 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." ...

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.