View
371
Download
0
Category
Preview:
Citation preview
UP AND RUNNING WITH NETWORK GRAPHS
Connections
Sarah Cullem
Inspiration
Node Edge
Systems of nodes and edges that form a
structured representation of connected things and
how they are related
What is a network graph?
Node Edge
Edges can have weight that describes the strength of a
relationship
What is a network graph?
Node Edge
Edges can be lines (undirected graphs) or
arrows (directed graphs)
What is a network graph?
Node Edge
Nodes can vary in size based on the degree of
their relationships to other nodes
What is a network graph?
Node Edge
Nodes can vary in color based on selected
attributes
What is a network graph?
Network graphs allow you to visualize patterns in complex, multidimensional data
Who/what is the most central in the network?
How strong are the connections between nodes?
What is the shortest path between nodes?
Are there communities within the larger network?
How dense is the network?
Who/what is the most influential?
Micro vs. MacroLevel
Static vs. TimeSeries
Social Semantic Geographic
One vs. ManyDimensions
Types of Relationships
Analytical Decisions
Graph Type: DirectedNodes: Girls in a 1960s dormitoryEdges: 1st & 2nd choices when asked which other girls they liked best as their dining partners
http://www.slideshare.net/ValaAliRohani/social-network-analysis-part-1-40046689
Graph Type: UndirectedNodes: Adverse drug reactions in instagram postsEdges: Co-occurrence of adverse reactions to drugs treating depression
http://psb.stanford.edu/psb-online/proceedings/psb16/brattigcorreia.pdf
http://truthy.indiana.edu/highlights/
Social Butterflies or Frequent Fliers?Twitter trends follow similar patterns as epidemics, diffusing across the
country along the same pathways as human travelers
And now for an example using the Congressional Voting Records dataset
https://archive.ics.uci.edu/ml/datasets/Congressional+Voting+Records
Type: Undirected GraphNodes: Names of bills and party affiliationEdges: Every pairing of “yes” on bills or party affiliationWeight: # of times each bill-bill or bill- party pairing appears as “yes” together
Example 1: Which bills share common voters/parties?
Education Religious Republican Democrat
Voter A Yes Yes Yes No
Voter B Not Yes Yes No YesVoter C Yes Not Yes Yes NoVoter D Not Yes Not Yes No Yes
Our initial dataset consists of each voter, their vote on each bill, and their party affiliation
Note: Using “Not Yes” for bills instead of “No” because data set contains cases of “?” where the vote was neither “yes” nor “no”
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
We recode all “Yes” votes to 1 and “No/Not Yes” votes to 0
Note: Using “Not Yes” for bills instead of “No” because data set contains cases of “?” where the vote was neither “yes” nor “no”
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
Nodes
Education
Religious
Republican
Democrat
Our nodes are the bill and party “tags” for each voter
Edges Weights
Education, Religious
Education, Republican
Education, Democrat
Religious, Republican
Religious, Democrat
Republican, Democrat
Our edges are all possible “bill-bill” and “bill-party” combinations in the dataset
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
Edges Weights
Education, Religious
Education, Republican
Education, Democrat
Religious, Republican
Religious, Democrat
Republican, Democrat
Our weights are the number of times our
nodes/tags occur together
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
Edges Weights
Education, Religious 1
Education, Republican 2
Education, Democrat 0
Religious, Republican 1
Religious, Democrat 1
Republican, Democrat 0
There is one case where a voter voted “yes” on
Education and on Religious
Education Religious Republican Democrat
Voter A 1 1 1 0
Voter B 0 1 0 1Voter C 1 0 1 0Voter D 0 0 0 1
There are two cases where a voter was Republican and also
voted “yes” on Education
Edges Weights
Education, Religious 1
Education, Republican 2
Education, Democrat 0
Religious, Republican 1
Religious, Democrat 1
Republican, Democrat 0
Which bills share common voters/parties?
Network graph created with open source tool Gephi: https://gephi.org/
On average, 70% of democrats and 20%
of republicans voted yes
On average, 30% of democrats and 79%
of republicans voted yes
Network graph created with open source tool Gephi: https://gephi.org/
Network graph created with open source tool Gephi: https://gephi.org/
56% of democrats and 56% of
republicans voted yes
20% of democrats and 89% of
republicans voted yes
72% of democrats and 14% of
republicans voted yes
Do members of both parties vote together?
Network graph created with open source tool Gephi: https://gephi.org/
• My GitHub repo: https://github.com/scullem/network_graphs• NetworkX python: https://networkx.github.io/• NetworkX tutorial: https://github.com/sarguido/networkx-tutorial• Gephi download: https://gephi.org/• Sebastien Heymann Exploratory Network Analysis with Gephi
Part 1: https://www.youtube.com/watch?v=Y7Ah6VylIak• Gephi guides: http://meta-guide.com/videography/100-best-gephi-
videos• Graph Analysis and Visualization: Discovering Business
Opportunity in Linked Data: http://www.amazon.com/Graph-Analysis-Visualization-Discovering-Opportunity-ebook/dp/B00T1JQUQE
Resources
Recommended