Reader small image

You're reading from  Network Science with Python and NetworkX Quick Start Guide

Product typeBook
Published inApr 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789955316
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Edward L. Platt
Edward L. Platt
author image
Edward L. Platt

Edward L. Platt creates technology for communities and communities for technology. He is currently a researcher at the University of Michigan School of Information and the Center for the Study of Complex Systems. He has published research on large-scale collective action, social networks, and online communities. He was formerly a staff researcher at the MIT Center for Civic Media. He contributes to many free/open source software projects, including tools for media analysis, network science, and cooperative organizations. He has also done research on quantum computing and fault tolerance. He has an M.Math in Applied Mathematics from the University of Waterloo, as well as B.S degrees in both Computer Science and Physics from MIT.
Read more about Edward L. Platt

Right arrow

Affiliation Networks

Edges represent connections or relationships between two nodes and only those two nodes, but some relationships involve more than two nodes. Typically, such relationships take the form of multiple nodes belonging to a common group or sharing a common affiliation. This relationship structure can be set up by adding a second type of node representing the groups or affiliations. Such networks are called affiliation networks. This chapter describes how to work with complex relational data using affiliation networks, as well as how affiliation networks are represented and manipulated in NetworkX.

The topics that are covered in this chapter include the following:

  • Nodes and affiliations: How data with complex relationships can be represented by affiliation networks and how to recognize an affiliation network structures
  • Affiliation networks in NetworkX: How to create...

Nodes and affiliations

In the game Six Degrees of Kevin Bacon, perhaps the most widely-known application of network science principles, the goal is to find a link between a given actor and the actor Kevin Bacon. For example, Jon Hamm can be connected to Kevin Bacon as follows: Jon Hamm was in Bridesmaids with Rose Byrne, who was in X-Men: First Class, with Kevin Bacon. This game takes place on a network. In one version of the network, nodes represent actors and edges represent movies that two actors both appeared in. This version of the network (let's call it the actor-actor network) is sufficient for finding Kevin Bacon, but it doesn't fully represent the relationships between actors and movies. Movies typically have a cast of many actors, but each edge in the actor-actor network only corresponds to two actors. Consequently, there need to be many edges for each movie...

Affiliation networks in NetworkX

Affiliation networks are represented in NetworkX using the same classes as other networks: Graph and DiGraph. The only difference is that you need to keep track of which nodes are of which type. In NetworkX, this is done by using a container (list, set, and so on) to store all node IDs for one node type. For convenience, the node type can also be stored as a node attribute. A network can be tested for an affiliation network structure using the sets() function. Usually, this function can also find the nodes of each type (the exception being when the network has groups of nodes that are not connected to the rest of the network). The following example loads our dear old friend from Chapter 2, Working with Networks in NetworkX, the Zachary karate club network, and checks it for affiliation network structure:

# Import bipartite module
from networkx.algorithms...

Projections

While affiliation networks are useful for representing the full structure of many-to-many relationships, it is sometimes easier to work with standard single-mode networks. This might be the case if an analysis focuses on a particular type of node, or if a necessary technique is only available for single-mode networks, or if the affiliation network has too many nodes to visualize clearly. Luckily, it is possible to create single-mode networks out of an affiliation network using a process called projection. And, as you might expect, NetworkX makes it easy.

Single-mode networks built from affiliation networks are called co-affiliation networks, because the nodes are connected by an edge if they have common affiliations. There are several types of projections that are used to create co-affiliation networks, but they all revolve around the same idea: connecting nodes with...

Summary

This chapter introduced affiliation networks and the tools provided by NetworkX for working with affiliation networks, with special attention to using projections to create co-affiliation networks. Affiliation networks are ubiquitous in network data. Whenever there is a symmetrical relationship that can connect more than two things, there is an underlying affiliation structure. Many single-mode networks are really co-affiliation networks—projections of affiliation networks onto one type of node. Different projections have different interpretations, such as the number of paths or similarities. Choosing an appropriate projection for the data and for the question being asked can reveal important properties of a network that might otherwise be overlooked. Even as you encounter standard single-mode networks in the rest of this book, and in real-world data, it is often...

References

The following is a list of resources that you can consider to get further knowledge:

  • Bartomeus, I., Vilà, M., & Santamaría, L. (2008). Contrasting effects of invasive plants in plant–pollinator networks. Oecologia, 155(4).
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Network Science with Python and NetworkX Quick Start Guide
Published in: Apr 2019Publisher: PacktISBN-13: 9781789955316
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Edward L. Platt

Edward L. Platt creates technology for communities and communities for technology. He is currently a researcher at the University of Michigan School of Information and the Center for the Study of Complex Systems. He has published research on large-scale collective action, social networks, and online communities. He was formerly a staff researcher at the MIT Center for Civic Media. He contributes to many free/open source software projects, including tools for media analysis, network science, and cooperative organizations. He has also done research on quantum computing and fault tolerance. He has an M.Math in Applied Mathematics from the University of Waterloo, as well as B.S degrees in both Computer Science and Physics from MIT.
Read more about Edward L. Platt