Network Analysis Graphs as Matrices - Michele Coscia · Graphs as Network Analysis Matrices Michele...

of 218/218
Network Analysis Graphs as Matrices Michele Coscia & Luca Rossi ITU København
  • date post

    19-Aug-2020
  • Category

    Documents

  • view

    9
  • download

    0

Embed Size (px)

Transcript of Network Analysis Graphs as Matrices - Michele Coscia · Graphs as Network Analysis Matrices Michele...

  • Network Analysis

    Graphs as Matrices

    Michele Coscia & Luca RossiITU København

  • Background:

  • Background:

    Looking at a problem from a different

    perspective

  • Sergey Brin & Larry Page

    (1973-)

  • 55 Million!

  • 55 Million!

  • PageRank

  • PageRank● p of visiting v…

  • PageRank● p of visiting v…● … = p of visiting a neighbor u of v *

    p of going from u to v

  • PageRank● p of visiting v…● … = p of visiting a neighbor u of v *

    p of going from u to v● for v in V…

  • PageRank● p of visiting v…● … = p of visiting a neighbor u of v *

    p of going from u to v● for v in V…● 55 million times!

  • PageRankG = (V, E)

  • PageRankG = (V, E) A = 1 if uv in E

  • PageRankG = (V, E) A = 1 if uv in E

  • PageRankG = (V, E) A = 1 if uv in E

  • PageRank

    for v in V...

    G = (V, E) A = 1 if uv in E

  • PageRank

    for v in V... R := AR

    G = (V, E) A = 1 if uv in E

    ~

  • PageRank

    for v in V... R := AR

    G = (V, E) A = 1 if uv in E

    ~

    Row-normalized A

  • PageRank

    for v in V... R := AR

    G = (V, E) A = 1 if uv in E

    ~

    Row-normalized A

    Eigenvectorof A

  • Random Walks

  • Basics

    A B C D E FABCDEF

    A B

  • Basics

    A B C D E FABCDEF

    Do youknow each

    other?

    A B

  • Basics

    A B C D E FABCDEF

    Do youknow each

    other?

    A B

    Yes! Yes!

  • Basics

    A B C D E FABCDEF

    Do youknow each

    other?

    A B

    Yes! Yes!

    XX

  • Basics

  • Basics1 2 3 4 5 6 7 8 9

  • Basics1 2 3 4 5 6 7 8 9

    123456789

  • Basics1 2 3 4 5 6 7 8 9

    123456789

  • Basics1 2 3 4 5 6 7 8 9

    123456789

  • Basics1 2 3 4 5 6 7 8 9

    123456789

  • Basics1 2 3 4 5 6 7 8 9

    123456789

  • Basics1 2 3 4 5 6 7 8 9

    123456789

    Adjacency Matrix

  • Properties of Adjacency Matrices

  • Properties of Adjacency Matrices

    3

  • Properties of Adjacency Matrices

    3

    3

    2

    1

  • Properties of Adjacency Matrices

  • Stochastic Adjacency

    A B C D E FABCDEF

    AX X X

  • Stochastic Adjacency

    A B C D E FABCDEF

    Pick oneof your friends

    at random

    AX X X

  • Stochastic Adjacency

    A B C D E FABCDEF

    Pick oneof your friends

    at random

    A

    Mmm…E!

    X X X

  • Stochastic Adjacency

  • Stochastic Adjacency● p of going from

    v to u

  • Stochastic Adjacency● p of going from

    v to u

    ● A / A.sum(axis = 1)

  • Stochastic Adjacency● p of going from

    v to u

    ● A / A.sum(axis = 1)

  • Stochastic Adjacency● p of going from v

    to u

    ● A / A.sum(axis = 1)

    ● Useful eigen-properties

  • Walk Probabilities

  • Walk Probabilities

  • Walk Probabilities

  • Walk Probabilities

  • Walk Probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

  • Walk probabilities

    p(1→2) in two steps?

  • Walk probabilities

    p(1→2) in two steps?(p(1→5) * p(5→2)) + (p(1→9) * p(9→2))

  • Walk probabilities

    p(1→2) in two steps?(p(1→5) * p(5→2)) + (p(1→9) * p(9→2))

    p(u→v)?

  • Powers of Stochastic

    A

  • Powers of Stochastic

    A

  • Powers of Stochastic

    A

  • Powers of Stochastic

    A A2

  • Powers of Stochastic

    A A2

  • Powers of Stochastic

    A A2

  • Powers of Stochastic

    A A2

  • Powers of Stochastic

    A A2

  • Powers of Stochastic

  • Powers of Stochastic

  • Powers of Stochastic

  • Powers of Stochastic

  • Powers of Stochastic

    1

  • Powers of Stochastic

  • Powers of Stochastic

  • Powers of Stochastic

  • A2

  • A2

  • A2 A3

  • A2 A30

  • Stationary Distribution

  • Stationary Distribution● A∞ = π

  • Stationary Distribution● A∞ = π

  • Stationary Distribution● A∞ = π

    ● πA = π

  • Stationary Distribution● A∞ = π

    ● πA = π

    ● ~ PageRank

  • Disconnected Mazes

  • Disconnected Mazes

  • Disconnected Mazes

  • Disconnected Mazes

    ?

  • Disconnected Mazes

    ?

  • Multiple Components

    A

  • Multiple Components

    A30

  • Multiple Components

    A30

  • Multiple Components

    A30

  • Multiple Components

    A30

  • Multiple Components

    A30

  • Google’s Solution

  • Google’s Solution

  • Google’s Solution

    Beamme up,Scotty!

  • Google’s Solution

  • Google’s Solution

    A

  • Google’s Solution

    A

  • Google’s Solution

    A+ε

  • Stationary Distribution vs Degree

  • Stationary Distribution vs Degree

  • Stationary Distribution vs Degree

    Corr = 1

  • Stationary Distribution vs Degree

    Corr = 1π = k / k.sum()

  • Stationary Distribution vs PageRank

  • Stationary Distribution vs PageRank

  • Stationary Distribution vs PageRank

  • Stationary Distribution vs PageRank

  • Stationary Distribution vs PageRank

  • Graph Spectrum

  • A Recap on Eigenvectors

    v(x, y)

  • A Recap on Eigenvectors

    v

    w = Av

    (x’, y’)

    (x, y)

  • A Recap on Eigenvectors

    v

    w = Av

    (x’, y’)(λx, λy)

    (x, y)

  • A Recap on Eigenvectors

    v

    w = Av

    (x’, y’)

    w = Av = λv

    (λx, λy)

    (x, y)

  • A Recap on Eigenvectors

    v

    w = Av

    (x’, y’)

    w = Av = λv

    (λx, λy)

    Eigenvector

    (x, y)

  • A Recap on Eigenvectors

    v

    w = Av

    (x’, y’)

    w = Av = λv

    (λx, λy)

    Eigenvector

    Eigenvalue

    (x, y)

  • Right & Left

    Av = λv

  • Right & Left

    Av = λv Right Eigenvector

  • Right & Left

    Av = λv Right Eigenvector

  • Right & Left

    Av = λv

    vA = vλ

    Right Eigenvector

  • Right & Left

    Av = λv

    vA = vλ

    Right Eigenvector

    Left Eigenvector

  • Right & Left

    Av = λv

    vA = vλ

    Right Eigenvector

    Left Eigenvector

  • Right & Left

    Av = λv

    vA = vλ

    Right Eigenvector

    Left Eigenvector

  • Right & Left

    Av = λv

    vA = vλ

    Right Eigenvector

    Left Eigenvector

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

    λ1

  • Eigenvalues & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

    λ1λ2

  • Eigenvalues & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvalues & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvalues & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvectors

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvectors

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    v1 v2 v3 … vn-2 vn-1 vn

  • Eigenvectors

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    v1 v2 v3 … vn-2 vn-1 vn“Largest” Eigenvector

  • Eigenvectors

    vi

    abcdefghil

    mno

  • Eigenvectors

    vi

    abcdefghil

    mno

  • Eigenvectors

    vi

    abcdefghil

    mno

  • Eigenvectors

    vi

    abcdefghil

    mno

  • Eigenvectors

    vi

    abcdefghil

    mno

  • Eigenvectors & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

    λ1λ2

  • Eigenvectors & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

    λ1λ2

    v1 v2

  • Eigenvectors & Components

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λnIf both equal to 1

    Graph has two components

    λ1λ2

    v1 v2

    aaaaaa000

    000000bbb

  • Eigenvectors & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

  • Eigenvectors & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    v1

  • Eigenvectors & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    v1

    λ1

  • Eigenvectors & Components

    λ1 > λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    v1

    aaaaaaaaa

    λ1

  • Left Largest Eigenvector

  • Left Largest Eigenvector

  • Left Largest Eigenvector

  • Left Largest Eigenvector

    vL1 = π

  • Left Largest Eigenvector

    vL1 = π

    πA = π

  • Left Largest Eigenvector

    vL1 = π

    πA = ππA = π1

  • Left Largest Eigenvector

    vL1 = π

    πA = ππA = π1

    λ1

  • Left Largest Eigenvector

    vL1 = π

    πA = ππA = π1

    λ1

  • Left & Right

  • Left & RightvL1

  • Left & RightvL1

  • Left & RightvL1

    v1

    aaaaaaaaa

  • Left & RightvL1

    vR1v1

    aaaaaaaaa

  • Left & RightvL1

    vR1 A

  • Left & RightvL1

    vR1 AT

  • Left & RightvL1

    vR1 ATA / A.sum(axis = 0)

  • Left & Right

    ATA / A.sum(axis = 0)

  • Left & Right

    ATA / A.sum(axis = 0)

    vL1

    vR1

  • Graph Laplacian

  • Degree Matrix

  • Degree MatrixZeros everywhere

  • Degree MatrixZeros everywhere

    i-th diagonal element...

  • Degree MatrixZeros everywhere

    i-th diagonal element... … is the degree of node i

  • Degree MatrixZeros everywhere

    i-th diagonal element... … is the degree of node i

    D

  • Laplacian Matrix

    D A

  • Laplacian Matrix

    D AL = -

  • Laplacian Matrix

    L = D - A

  • Laplacian Matrix

    L = D - A

  • Laplacian Matrix

    L = D - A

  • Laplacian Matrix

    L = D - A

    0

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

    A

    L

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

    A

    L λ1 ≤ λ2 ≤ λ3 ≤ … ≤ λn-2 ≤ λn-1 ≤ λn

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

    A

    L λ1 ≤ λ2 ≤ λ3 ≤ … ≤ λn-2 ≤ λn-1 ≤ λn0

  • Eigenvalues

    λ1 ≥ λ2 ≥ λ3 ≥ … ≥ λn-2 ≥ λn-1 ≥ λn

    1

    A

    L λ1 ≤ λ2 ≤ λ3 ≤ … ≤ λn-2 ≤ λn-1 ≤ λn0

    # of 0s = # of components

  • Eigenvectors

  • Eigenvectors

    v1

  • Eigenvectors

    v1

    aaaaaaaaa

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

    .37

    .37

    .28

    .28

    .12-.23-.38-.38-.43

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

    .37

    .37

    .28

    .28

    .12-.23-.38-.38-.43

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

    .37

    .37

    .28

    .28

    .12-.23-.38-.38-.43

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

    .37

    .37

    .28

    .28

    .12-.23-.38-.38-.43

  • Eigenvectors

    v1

    aaaaaaaaa

    v2

    .37

    .37

    .28

    .28

    .12-.23-.38-.38-.43

  • Eigenvectors

  • Eigenvectors

    +

  • Eigenvectors

    + -

  • Eigenvectors

  • Eigenvectors

    2nd Eigenvector

  • Eigenvectors

    2nd Eigenvector

    3rd Eigenvector

  • Eigenvectors

  • Eigenvectors

  • Eigenvectors

  • Textbook Chapters● Adjacency Matrix

    – Section 2.4● Stochastic, Graph Spectrum &

    Laplacian– http://www.michelecoscia.com/?

    page_id=1488● Done with Chapter 2!

    – Section 2.11

    Slide 1page2 (1)page2 (2)page2 (3)Slide 5page4 (1)page4 (2)page4 (3)page4 (4)page5 (1)page5 (2)page5 (3)page5 (4)page5 (5)page6 (1)page6 (2)page6 (3)page6 (4)page6 (5)page6 (6)page6 (7)page6 (8)Slide 23page8 (1)page8 (2)page8 (3)page8 (4)page9 (1)page9 (2)page9 (3)page9 (4)page9 (5)page9 (6)page9 (7)page9 (8)page10 (1)page10 (2)page10 (3)page10 (4)page11 (1)page11 (2)page11 (3)page12 (1)page12 (2)page12 (3)page12 (4)page12 (5)page13 (1)page13 (2)page13 (3)page13 (4)page13 (5)page14 (1)page14 (2)page14 (3)page14 (4)page14 (5)page14 (6)page14 (7)page14 (8)page14 (9)page14 (10)page14 (11)page14 (12)page15 (1)page15 (2)page15 (3)page15 (4)page15 (5)page15 (6)page15 (7)page15 (8)page16 (1)page16 (2)page16 (3)page16 (4)page16 (5)page16 (6)page16 (7)page16 (8)page17 (1)page17 (2)page17 (3)page17 (4)page18 (1)page18 (2)page18 (3)page18 (4)page18 (5)page19 (1)page19 (2)page19 (3)page19 (4)page19 (5)page20 (1)page20 (2)page20 (3)page20 (4)page20 (5)page20 (6)page21 (1)page21 (2)page21 (3)page21 (4)page22 (1)page22 (2)page22 (3)page23 (1)page23 (2)page23 (3)page23 (4)page24 (1)page24 (2)page24 (3)page24 (4)page24 (5)Slide 117page26 (1)page26 (2)page26 (3)page26 (4)page26 (5)page26 (6)page27 (1)page27 (2)page27 (3)page27 (4)page27 (5)page27 (6)page27 (7)page27 (8)page28 (1)page28 (2)page28 (3)page29 (1)page29 (2)page29 (3)page29 (4)page29 (5)page29 (6)page29 (7)page30 (1)page30 (2)page30 (3)page30 (4)page30 (5)page30 (6)page30 (7)page30 (8)page30 (9)page31 (1)page31 (2)page31 (3)page32 (1)page32 (2)page32 (3)page32 (4)page32 (5)page33 (1)page33 (2)page33 (3)page33 (4)page33 (5)page33 (6)page33 (7)page34 (1)page34 (2)page34 (3)page34 (4)page34 (5)page34 (6)page34 (7)page34 (8)page35 (1)page35 (2)page35 (3)page35 (4)page35 (5)page35 (6)page35 (7)page35 (8)page35 (9)page35 (10)Slide 184page37 (1)page37 (2)page37 (3)page37 (4)page37 (5)page38 (1)page38 (2)page38 (3)page38 (4)page38 (5)page38 (6)page39 (1)page39 (2)page39 (3)page39 (4)page40 (1)page40 (2)page40 (3)page40 (4)page40 (5)page40 (6)page40 (7)page40 (8)page40 (9)page40 (10)page40 (11)page40 (12)page41 (1)page41 (2)page41 (3)page41 (4)page41 (5)page41 (6)Slide 218