In the last chapter, I said that networks were entirely defined by the number of nodes and which nodes were connected. I lied. Kind of. Now that we're all a little older and wiser than we were in Chapter 1, What is a Network?, I can tell you the whole truth: sometimes, network nodes and edges are annotated with additional information. In the Graph class, each node and edge can have a set of attributes to store this additional information. Attributes can simply be a convenient place to store information related to the nodes and edges, or they can be used by visualizations and network algorithms.
The Graph class allows you to add any number of attributes to a node. For a G, network, each node's attributes ...