O'Reilly logo

Complex Network Analysis in Python by Dmitry Zinoviev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required