DH3501: Advanced Social Networks

Class 9: Homophily and Association in Networks

Western University
Department of Modern Languages and Literatures
Digital Humanities – DH 3501

Instructor: David Brown
E-mail: dbrow52@uwo.ca
Office: AHB 1R14

We have talked about structure and the dynamics of networks, but what about other factors that go beyond nodes and edges? Contextual factors often effect the behaviour of members of a social network.

What are some example of contextual factors?


Greek - "the love of the similiar"

  • Intrinsic vs. contextual motivation for link formation.

    • While some relationships form as the result of a network processes such as triadic closure, others are driven by other factors...can you think of any examples?

What factors do Easley and Klienberg mention in their discussion of Moody's famous 2001 study of American high schools?

Homophily: Underlying mechanisms


  • The tendency for relationships to form amongst people who have similar immutable characteristics.

    • Active <--> Implicit
  • How are mutable characteristics different?

  • Immutable/mutable charachteristics are also reffered to sometimes as status and value homophily.

Socialization or Social Influence

  • Behavour modification that aligns an individuales characteristics with those of their relationships.

Do birds of a feather flock together? Or do they conform? What does the research say?

Affiliation networks

Affiliation networks include context within the network!

  • Based on the idea that if someone shares an interest, hobby, or other activity (like a job), that the likelihood of interaction tends to be higher.

  • Activites serve as a focal point for interaction.

  • Social and affiliation networks coevolve.

  • In an affiliation network, there are two distinct kinds of nodes (bipartite, bimodal, two-mode).

  • Closure (edge formation) on an affiliation network can be viewed as one of various types of processes:

    • If A, B, and C each represent a person, then the formation of the link between B and C is triadic closure.
    • If B and C represent people, but A represents a focus, then this is something different: it is the tendency of two people to form a link when they have a focus in comon. This is an aspect of the more general principle of selection, forming links to other who share characteristics with you. To emphasize the analogy with triadic closure, this process has been called focal closure.
    • If A and B are people, and C is a focus, then we have the formation of a new affiliation: B takes part in a focus that her friend A is already involved int. This is a kind of social influence, in which B's behavior come into closer alignment with that of her friend A. Continuing the analogy with triiadic closure, we will refer to this kind of link formation as membership closure. E & K, 96-97

In order to analyze an association network, we usually use a graph compression technique called projection.

  • Projection compresses a multi-mode graph into a single mode graph (usually a social network).

  • This allows use to use measures like centrality.

Wait a second! Why can't we use these measures with a multi-partite graph? Even after projection, can you forsee any problems? How do transformations such as projection affect the information contained within the graph?

Bipartite network analysis - projection

Hmmm...it would be nice to be able to make projections in Python...you can!!!

In [2]:
%matplotlib inline
import networkx as nx
from networkx.algorithms import bipartite

In [3]:
B = nx.Graph()
B.add_nodes_from([1,2,3,4], bipartite=0)  # Add the node attribute "bipartite"
B.add_nodes_from(['a','b','c'], bipartite=1)
B.add_edges_from([(1,'a'), (1,'b'), (2,'b'), (2,'c'), (3,'c'), (4,'a')])

In [4]:
bottom_nodes, top_nodes = bipartite.sets(B)
print(bottom_nodes, top_nodes)

(set(['a', 'c', 'b']), set([1, 2, 3, 4]))

In [5]:
proj = bipartite.collaboration_weighted_projected_graph(B, top_nodes)

In [6]:

[(1, 2, {'weight': 1.0}), (1, 4, {'weight': 1.0}), (2, 3, {'weight': 1.0})]

Pretty cool huh? But there is a catch...anyone got it?

...enter projx

projx provides (amongst other things) a DSL for that allows the user to perform transformations on NetworkX graphs...

Let's check out an example:

class continues with this example

Coding challenge: Modelling Harry Potter House affiliation

This is an intense coding challenge, so we will have a bit of extra time:

  • Get a list of Harry Potter characters by house from this list.

  • Then, generate an bipartite affiliation network where every character is connected to their house.

  • Use projx to transfer the name of the house to each character as a property, then project a social network of Harry Potter characters.

  • Finally, try to get a nice little visualization here in the notebook.

In [7]:
# Your code goes here...