Sie sind auf Seite 1von 185

Networks

With R

LJasny

Intro Intro to Social Network Analysis


Basic SNA
Measures
with R
Graph Level
Indices

Simulation Lorien Jasny1

1 University of Exeter

L.Jasny@exeter.ac.uk

Sunbelt XXXVI
Irvine, California; 5 April, 2016

1-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N
and edges E

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N
and edges E that can
be directed

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N
and edges E that can
be directed or
undirected.

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N
and edges E that can
be directed or
undirected. We can
include information on
the nodes

2-47
Networks
With R

LJasny
Think Formally

Intro

Basic SNA
Measures A network is not just a
Graph Level metaphor: it is a
Indices
precise, mathematical
Simulation
construct of nodes N
and edges E that can
be directed or
undirected. We can
include information on
the nodes as well as
the edges.

2-47
Networks
With R

LJasny
Network Intuition

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

3-47
Networks
With R

LJasny
Network Intuition

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

3-47
Networks
With R

LJasny
Why network methods

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

4-47
Networks
With R

LJasny
Why network methods

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• Cannot simply use existing statistical methods

4-47
Networks
With R

LJasny
Why network methods

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• Cannot simply use existing statistical methods
• The whole point is that observations are interdependent

4-47
Networks
With R

LJasny
Why network methods

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• Cannot simply use existing statistical methods
• The whole point is that observations are interdependent
• Want to explicitly model these interdependencies

4-47
Networks
With R

LJasny
The R Environment

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

5-47
Networks
With R

LJasny
The R Environment

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• R is both a language and a software platform

5-47
Networks
With R

LJasny
The R Environment

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• R is both a language and a software platform
• R software is open-source, cross-platform, and free

5-47
Networks
With R

LJasny
The R Environment

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• R is both a language and a software platform
• R software is open-source, cross-platform, and free
• Its home on the web: http://www.r-project.org

5-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices

Simulation

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices
• R is highly extendable
Simulation

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices
• R is highly extendable
Simulation
• You can write your own custom functions

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices
• R is highly extendable
Simulation
• You can write your own custom functions
• There are 6000 free add-on packages

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices
• R is highly extendable
Simulation
• You can write your own custom functions
• There are 6000 free add-on packages
• Generally good at reading in/writing out other file
formats

6-47
Networks
With R

LJasny
Basics

Intro

Basic SNA
Measures

Graph Level • R uses a command-like environment, like stata or sas


Indices
• R is highly extendable
Simulation
• You can write your own custom functions
• There are 6000 free add-on packages
• Generally good at reading in/writing out other file
formats
• Everything in R is an object – data, functions,
everything

6-47
Networks
With R

LJasny
Fundamentals

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
Indices

Simulation

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation • If it understands what you’ve written, it does it
(execution)

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation • If it understands what you’ve written, it does it
(execution)
• If it doesn’t, it will likely give you an error or a warning

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation • If it understands what you’ve written, it does it
(execution)
• If it doesn’t, it will likely give you an error or a warning
• Some commands trigger R to print to the screen, others
don’t

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation • If it understands what you’ve written, it does it
(execution)
• If it doesn’t, it will likely give you an error or a warning
• Some commands trigger R to print to the screen, others
don’t
• If you type an incomplete command, R will usually
respond by changing the command prompt to the ‘+’
character

7-47
Networks
With R

LJasny
Fundamentals

Intro
• When you type commands at the prompt ‘>’ and hit
Basic SNA
Measures
ENTER
Graph Level
• R tries to interpret what you’ve asked it to do
Indices (evaluation)
Simulation • If it understands what you’ve written, it does it
(execution)
• If it doesn’t, it will likely give you an error or a warning
• Some commands trigger R to print to the screen, others
don’t
• If you type an incomplete command, R will usually
respond by changing the command prompt to the ‘+’
character
• Hit ESC on a Mac to cancel
• Type in Ctrl + C on Windows and Linux to cancel

7-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures

Graph Level
Indices

Simulation

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices

Simulation

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”
• Common data structures

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”
• Common data structures
• Vectors

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”
• Common data structures
• Vectors
• Matrices

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”
• Common data structures
• Vectors
• Matrices
• Data Frames

8-47
Networks
With R

LJasny
Data Structures in R

Intro

Basic SNA • R has several built-in data types and structures


Measures
• Common data types:
Graph Level
Indices • Numeric (integers, numbers, etc.)
Simulation • 12
• 3.14
• Strings (alphanumeric characters in quotation marks)
• “hello”
• “3.14”
• Common data structures
• Vectors
• Matrices
• Data Frames
• Network objects

8-47
Networks
With R

LJasny
Vectors

Intro A vector is a one-dimensional data structure


Basic SNA
Measures

Graph Level
Indices

Simulation

9-47
Networks
With R

LJasny
Vectors

Intro A vector is a one-dimensional data structure


Basic SNA
Measures

Graph Level
Indices

Simulation

1 2 3 4
• Vectors are indexed starting at 1

9-47
Networks
With R

LJasny
Vectors

Intro A vector is a one-dimensional data structure


Basic SNA
Measures

Graph Level
Indices

Simulation

1 2 3 4 n
• Vectors are indexed starting at 1
• A vector of length n has n cells

9-47
Networks
With R

LJasny
Vectors

Intro A vector is a one-dimensional data structure


Basic SNA
Measures

Graph Level
Indices

Simulation

1 2 3 4 n
• Vectors are indexed starting at 1
• A vector of length n has n cells
• Each cell can hold a single value

9-47
Networks
With R

LJasny
Vectors

Intro A vector is a one-dimensional data structure


Basic SNA
Measures

Graph Level
Indices

Simulation

1 2 3 4 n
• Vectors are indexed starting at 1
• A vector of length n has n cells
• Each cell can hold a single value
• Vectors can only store data of the same type – either all
strings or all numerical but not both

9-47
Networks
With R

LJasny
Working with Vectors in R

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

10-47
Networks
With R

LJasny
Working with Vectors in R

Intro

Basic SNA
Measures

Graph Level
Indices • We index vectors in R using “square bracket notation”
Simulation

10-47
Networks
With R

LJasny
Working with Vectors in R

Intro

Basic SNA
Measures

Graph Level
Indices • We index vectors in R using “square bracket notation”
Simulation
• Example:
• you have a vector of numeric values called testScores

10-47
Networks
With R

LJasny
Working with Vectors in R

Intro

Basic SNA
Measures

Graph Level
Indices • We index vectors in R using “square bracket notation”
Simulation
• Example:
• you have a vector of numeric values called testScores
• To retrieve the value in the third cell, type
testScores[3]

10-47
Networks
With R

LJasny
Working with Vectors in R

Intro

Basic SNA
Measures

Graph Level
Indices • We index vectors in R using “square bracket notation”
Simulation
• Example:
• you have a vector of numeric values called testScores
• To retrieve the value in the third cell, type
testScores[3]
• To retrieve all BUT the third value, type
testScoress[-3]

10-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation

11-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation
• R has two built-in data structures for storing
two-dimensional data

11-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation
• R has two built-in data structures for storing
two-dimensional data
• Matrices

11-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation
• R has two built-in data structures for storing
two-dimensional data
• Matrices
• Data Frames

11-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation
• R has two built-in data structures for storing
two-dimensional data
• Matrices
• Data Frames
• In most instances, they behave the same

11-47
Networks
With R

LJasny
Two-dimensional data in R

Intro

Basic SNA
Measures
• Most (all?) of us are familiar with two-dimensional
Graph Level
Indices data like that in spreadsheets
Simulation
• R has two built-in data structures for storing
two-dimensional data
• Matrices
• Data Frames
• In most instances, they behave the same
• Most functions will accept either a matrix or a data
frame

11-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

12-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices • Matrices can only store data of one type
Simulation

12-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices • Matrices can only store data of one type
Simulation • Either all strings or all numbers, but not both

12-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices • Matrices can only store data of one type
Simulation • Either all strings or all numbers, but not both
• If you try to give it multiple types, R converts
everything to string format

12-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices • Matrices can only store data of one type
Simulation • Either all strings or all numbers, but not both
• If you try to give it multiple types, R converts
everything to string format
• Data frames can store data of multiple types

12-47
Networks
With R

LJasny
Matrices versus data frames in R

Intro

Basic SNA
Measures

Graph Level
Indices • Matrices can only store data of one type
Simulation • Either all strings or all numbers, but not both
• If you try to give it multiple types, R converts
everything to string format
• Data frames can store data of multiple types
• Ideal for classical data analysis where you might have a
mix of numerical and string data

12-47
Networks
With R

LJasny
Working with matrices

Intro id name age sex handed lastDocVisit


Basic SNA 5012 Danielle 44 F R 2012
Measures

Graph Level
2331 Josh 44 M R 2008
Indices 1989 Mark 40 M R 2010
Simulation 2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

13-47
Networks
With R

LJasny
Working with matrices

Intro id name age sex handed lastDocVisit


Basic SNA 5012 Danielle 44 F R 2012
Measures

Graph Level
2331 Josh 44 M R 2008
Indices 1989 Mark 40 M R 2010
Simulation 2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

• Can also use “square bracket notation”

13-47
Networks
With R

LJasny
Working with matrices

Intro id name age sex handed lastDocVisit


Basic SNA 5012 Danielle 44 F R 2012
Measures

Graph Level
2331 Josh 44 M R 2008
Indices 1989 Mark 40 M R 2010
Simulation 2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

• Can also use “square bracket notation”


• Inside the square brackets, the first position refers to
the row(s) and the second to the column(s)

13-47
Networks
With R

LJasny
Working with matrices

Intro id name age sex handed lastDocVisit


Basic SNA 5012 Danielle 44 F R 2012
Measures

Graph Level
2331 Josh 44 M R 2008
Indices 1989 Mark 40 M R 2010
Simulation 2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

• Can also use “square bracket notation”


• Inside the square brackets, the first position refers to
the row(s) and the second to the column(s)
• If this matrix is called friendSurvey, the command to
retrieve Josh’s age is friendSurvey[2,3]

13-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

14-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• Square bracket notation works for data frames as well

14-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• Square bracket notation works for data frames as well
• Data frames provide another option: dollar sign
notation

14-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
id name age sex handed lastDocVisit
Measures 5012 Danielle 44 F R 2012
Graph Level
Indices
2331 Josh 44 M R 2008
Simulation 1989 Mark 40 M R 2010
2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

15-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
id name age sex handed lastDocVisit
Measures 5012 Danielle 44 F R 2012
Graph Level
Indices
2331 Josh 44 M R 2008
Simulation 1989 Mark 40 M R 2010
2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

• To retrieve the ‘sex’ column as a vector, use


friendSurvey$sex

15-47
Networks
With R

LJasny
Working with data frames

Intro

Basic SNA
id name age sex handed lastDocVisit
Measures 5012 Danielle 44 F R 2012
Graph Level
Indices
2331 Josh 44 M R 2008
Simulation 1989 Mark 40 M R 2010
2217 Emma 32 F L 2012
2912 Sarah 33 F R 2011

• To retrieve the ‘sex’ column as a vector, use


friendSurvey$sex
• To retrieve Josh’s age, use friendSurvey$age[2]

15-47
Networks
With R

LJasny
Code Time

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• Sections 1 and 2

16-47
Networks
With R

LJasny
Basic SNA Measures

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

17-47
Networks
With R

LJasny
Network Objects

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

18-47
Networks
With R

LJasny
Network Objects
• stores an adjacency matrix or an edgelist as well as
Intro
metadata
Basic SNA
Measures

Graph Level
Indices

Simulation

18-47
Networks
With R

LJasny
Network Objects
• stores an adjacency matrix or an edgelist as well as
Intro
metadata
Basic SNA
Measures • vertex, edge, and network attributes
Graph Level
Indices

Simulation

18-47
Networks
With R

LJasny
Network Objects
• stores an adjacency matrix or an edgelist as well as
Intro
metadata
Basic SNA
Measures • vertex, edge, and network attributes
Graph Level • can use square-bracket notation just like a matrix
Indices

Simulation

18-47
Networks
With R

LJasny
Network Objects
• stores an adjacency matrix or an edgelist as well as
Intro
metadata
Basic SNA
Measures • vertex, edge, and network attributes
Graph Level • can use square-bracket notation just like a matrix
Indices

Simulation

18-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

19-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation • One isolate

19-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation • One isolate


• Two components

19-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation • One isolate


• Two components
• Diameter is 5

19-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation • One isolate


• Two components
• Diameter is 5
• Medici is most popular

19-47
Networks
With R

LJasny
Descriptives

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation • One isolate


• Two components
• Diameter is 5
• Medici is most popular
• Three triads

19-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA
Measures

Graph Level
Indices

Simulation

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level
Indices

Simulation

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

• Pucci has degree 0

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

• Pucci has degree 0


• Lamberteschi has degree 1

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

• Pucci has degree 0


• Lamberteschi has degree 1
• Guadagni has degree 4

20-47
Networks
With R

LJasny
Degree

Intro For each node, its degree is


Basic SNA • the number of nodes adjacent to it
Measures

Graph Level • or, the number of lines incident with it


Indices

Simulation

• Pucci has degree 0


• Lamberteschi has degree 1
• Guadagni has degree 4
• Medici has degree 6

20-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
Indices

Simulation

A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices

Simulation

A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B

A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree

A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree and 3
indegree
A D

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree and 3
indegree
A D • C has 2 outdegree

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree and 3
indegree
A D • C has 2 outdegree and 1
indegree
C

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree and 3
indegree
A D • C has 2 outdegree and 1
indegree
C
• D has 1 outdegree

21-47
Networks
With R

LJasny
Directed Degree

Intro

Basic SNA In directed graphs,


Measures

Graph Level
• Indegree indicates the number of received ties
Indices
• Outdegree indicates the number of sent ties
Simulation

• A has 1 outdegree
B • B has 1 outdegree and 3
indegree
A D • C has 2 outdegree and 1
indegree
C
• D has 1 outdegree and 1
indegree

21-47
Networks
With R

LJasny
Betweenness Centrality

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

Proportion of
shortest paths
that the given
node lies on

22-47
Networks
With R

LJasny
Betweenness Centrality

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

Proportion of
shortest paths
that the given
node lies on

Forrest Pitts 1978 ”The River Trade Ntework of Russia,


Revisited”

22-47
Networks
With R

LJasny
Betweenness Centrality

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

Proportion of
shortest paths
that the given
node lies on

Forrest Pitts 1978 ”The River Trade Ntework of Russia,


Revisited”

22-47
Networks
With R

LJasny
Additional Centrality Measures

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

23-47
Networks
With R

LJasny
Additional Centrality Measures

Intro

Basic SNA
Measures

Graph Level
Indices • Closeness: the sum of the distances to all other nodes
Simulation
in the network

23-47
Networks
With R

LJasny
Additional Centrality Measures

Intro

Basic SNA
Measures

Graph Level
Indices • Closeness: the sum of the distances to all other nodes
Simulation
in the network
• Eigenvector: an iterated measure where nodes have
higher eigenvector centrality if they are tied to nodes
with high eigenvector centrality

23-47
Networks
With R

LJasny
Additional Centrality Measures

Intro

Basic SNA
Measures

Graph Level
Indices • Closeness: the sum of the distances to all other nodes
Simulation
in the network
• Eigenvector: an iterated measure where nodes have
higher eigenvector centrality if they are tied to nodes
with high eigenvector centrality
• Many, many others

23-47
Networks
With R

LJasny
Graph Level Indices

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

24-47
Networks
With R

LJasny
Density

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

25-47
Networks
With R

LJasny
Density

Intro
• Number of ties, expressed as a percentage of the
Basic SNA
Measures number of possible ties
Graph Level
Indices

Simulation

25-47
Networks
With R

LJasny
Density

Intro
• Number of ties, expressed as a percentage of the
Basic SNA
Measures number of possible ties
Graph Level
Indices E
• For directed graphs:
Simulation N (N −1)

25-47
Networks
With R

LJasny
Density

Intro
• Number of ties, expressed as a percentage of the
Basic SNA
Measures number of possible ties
Graph Level
Indices E
• For directed graphs:
Simulation N (N −1)
E
N (N −1)
• For undirected graphs:
2

25-47
Networks
With R

LJasny
Density

Intro
• Number of ties, expressed as a percentage of the
Basic SNA
Measures number of possible ties
Graph Level
Indices E
• For directed graphs:
Simulation N (N −1)
E
N (N −1)
• For undirected graphs:
2

1 3

25-47
Networks
With R

LJasny
Density

Intro
• Number of ties, expressed as a percentage of the
Basic SNA
Measures number of possible ties
Graph Level
Indices E
• For directed graphs:
Simulation N (N −1)
E
N (N −1)
• For undirected graphs:
2

2
2
3(3−1) 4
= 2 = 6
1 3

25-47
Networks
With R

LJasny
Mean Degree

Intro
¯ of all nodes in the graph is
The mean degree, d,
Basic SNA
Measures

Graph Level
Indices

Simulation

1 3

26-47
Networks
With R

LJasny
Mean Degree

Intro
¯ of all nodes in the graph is
The mean degree, d,
Basic SNA
Measures
PN
¯ = i=1 d(ni )
Graph Level
2E
Indices

Simulation
d(n) N = N

1 3

26-47
Networks
With R

LJasny
Mean Degree

Intro
¯ of all nodes in the graph is
The mean degree, d,
Basic SNA
Measures
PN
¯ = i=1 d(ni )
Graph Level
2E
Indices

Simulation
d(n) N = N
1+2+1 4
= 3 = 3

1 3

26-47
Networks
With R

LJasny
Size, Density, and Mean Degree

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
If we hold the mean
degree constant, but
vary size, what
happens to density?

27-47
Networks
With R

LJasny
Size, Density, and Mean Degree

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
If we hold the mean
degree constant, but
vary size, what
happens to density?

27-47
Networks
With R

LJasny
Centralization

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

28-47
Networks
With R

LJasny
Centralization

Intro

Basic SNA
• Extent to which centrality is concentrated on a single
Measures
vertex
Graph Level
Indices

Simulation

28-47
Networks
With R

LJasny
Centralization

Intro

Basic SNA
• Extent to which centrality is concentrated on a single
Measures
vertex
Graph Level
Indices • Calculated as the sum of the differences between each
Simulation node’s centrality score and the maximum score

28-47
Networks
With R

LJasny
Centralization

Intro

Basic SNA
• Extent to which centrality is concentrated on a single
Measures
vertex
Graph Level
Indices • Calculated as the sum of the differences between each
Simulation node’s centrality score and the maximum score
• Most centralized structure is usually a star network

28-47
Networks
With R

LJasny
Dyad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

29-47
Networks
With R

LJasny
Dyad Census

Intro

Basic SNA
Measures

Graph Level
Mutual (M)
Indices

Simulation

29-47
Networks
With R

LJasny
Dyad Census

Intro

Basic SNA
Measures

Graph Level
Mutual (M)
Indices

Simulation

Assymetric (A)

29-47
Networks
With R

LJasny
Dyad Census

Intro

Basic SNA
Measures

Graph Level
Mutual (M)
Indices

Simulation

Assymetric (A)

Null (N)

29-47
Networks
With R

LJasny
Reciprocity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

30-47
Networks
With R

LJasny
Reciprocity

Intro

Basic SNA
Measures

Graph Level
Indices • Dyadic: the proportion of dyads that are symmetric
Simulation M +N
M +A+N

30-47
Networks
With R

LJasny
Reciprocity

Intro

Basic SNA
Measures

Graph Level
Indices • Dyadic: the proportion of dyads that are symmetric
Simulation M +N
M +A+N
• Dyadic non-null: the proportion of non-null dyads that
M
are reciprocal
M +A

30-47
Networks
With R

LJasny
Reciprocity

Intro

Basic SNA
Measures

Graph Level
Indices • Dyadic: the proportion of dyads that are symmetric
Simulation M +N
M +A+N
• Dyadic non-null: the proportion of non-null dyads that
M
are reciprocal
M +A
2∗M
• Edgewise:
2∗M +A

30-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

31-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

31-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures 16 different triad types
Graph Level
Indices
One row per network

Simulation

32-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures 16 different triad types
Graph Level
Indices
One row per network

i,j cell is the number


Simulation
of triad type j
in network i

32-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

33-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation Dominance Relationships

33-47
Networks
With R

LJasny
Triad Census

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

Friendship, Assistance

33-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
2

1 3

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
2

1 3

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
2

1 3

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
2

1 3

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices
2 • Usually calculated as the
Simulation
fraction of completed
two-paths

1 3

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices
2 • Usually calculated as the
Simulation
fraction of completed
two-paths
• Related to Grannovetter’s
1 3 ‘forbidden triad’

34-47
Networks
With R

LJasny
Transitivity

Intro

Basic SNA
Measures

Graph Level
Indices
2 • Usually calculated as the
Simulation
fraction of completed
two-paths
• Related to Grannovetter’s
1 3 ‘forbidden triad’
• Can be directed or undirected

34-47
Networks
With R

LJasny
Example

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

Janet Box-Steffensmeier and Dino Christenson


“The evolution and formation of amicus curiae networks”
Social Networks 2012

35-47
Networks
With R

LJasny
Code Time

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• Section 3-4.7

36-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

37-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• A probability
distribution for a
success/failure

37-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation
• A probability
distribution for a
success/failure
• Best known example is
the coin flip

37-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Bernoulli ‘Random’ Graphs

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

38-47
Networks
With R

LJasny
Small Worlds

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

What were the characteristics of Milgram’s small world?

39-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

40-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• high clustering coefficient

40-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• high clustering coefficient


• low diameter

40-47
Networks
With R

LJasny
Clustering Coefficient and
Diameter
Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

41-47
Networks
With R

LJasny
Clustering Coefficient and
Diameter
Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• The diameter of a graph is the longest shortest path


between any pair nodes

41-47
Networks
With R

LJasny
Clustering Coefficient and
Diameter
Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• The diameter of a graph is the longest shortest path


between any pair nodes
• The clustering coefficient of a graph is the number
of triangles divided by the number of two-paths

41-47
Networks
With R

LJasny
Clustering Coefficient

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

42-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices • high clustering
Simulation coefficient
• low diameter

43-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices
• high clustering
Simulation
coefficient
• low diameter
• starts with a
lattice structure

43-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices
• high clustering
Simulation
coefficient
• low diameter
• starts with a
lattice structure
• randomly
re-wires ties

43-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

44-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

45-47
Networks
With R

LJasny
Watts-Strogatz Model

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation Lactual L1 Cactual C1


Film Actors 3.65 2.99 0.79 0.00027
Power Grid 18.7 12.4 0.08 0.005
C. Elegans 2.65 2.25 0.28 0.05

46-47
Networks
With R

LJasny
Code Time

Intro

Basic SNA
Measures

Graph Level
Indices

Simulation

• the rest! whew!

47-47

Das könnte Ihnen auch gefallen