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.
What factors do Easley and Klienberg mention in their discussion of Moody's famous 2001 study of American high schools?
Selection
The tendency for relationships to form amongst people who have similar immutable characteristics.
How are mutable characteristics different?
Immutable/mutable charachteristics are also reffered to sometimes as status and value homophily.
Socialization or Social Influence
Do birds of a feather flock together? Or do they conform? What does the research say?
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:
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?
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)
In [5]:
proj = bipartite.collaboration_weighted_projected_graph(B, top_nodes)
nx.draw_networkx(proj)
In [6]:
proj.edges(data=True)
Out[6]:
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
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...