30
Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Embed Size (px)

Citation preview

Page 1: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Lecture 4:

Mathematics of Networks

CS 790g: Complex Networks

Slides are modified from Networks: Theory and Application by Lada Adamic

Page 2: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

What are networks?

Networks are collections of points joined by lines.

“Network” ≡ “Graph”

points lines Domain

vertices edges, arcs math

nodes links computer science

sites bonds physics

actors ties, relations sociology

node

edge

2

Page 3: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Network elements: edges

Directed (also called arcs) A -> B (EBA)

A likes B, A gave a gift to B, A is B’s child

Undirected A <-> B or A – B

A and B like each other A and B are siblings A and B are co-authors

Edge attributes weight (e.g. frequency of communication) ranking (best friend, second best friend…) type (friend, relative, co-worker) properties depending on the structure of the rest of the graph: e.g.

betweenness Multiedge: multiple edges between two pair of nodes Self-edge: from a node to itself

3

Page 4: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Directed networks

2

1

1

2

1

2

1

2

1

2

21

1

2

1

2

1

2

12

1

2

1

2

1

2

1

21

2 1

2

1

2

12 1

2

1

2

12

1

2

12

1

2

1 2

12

Ada

Cora

Louise

Jean

Helen

Martha

Alice

Robin

Marion

Maxine

Lena

Hazel Hilda

Frances

Eva

RuthEdna

Adele

Jane

Anna

Mary

Betty

Ella

Ellen

Laura

Irene

girls’ school dormitory dining-table partners (Moreno, The sociometry reader, 1960)

first and second choices shown

4

Page 5: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Edge weights can have positive or negative values

One gene activates/ inhibits another

One person trusting/ distrusting another

Research challenge: How does one

‘propagate’ negative feelings in a social network?

Is my enemy’s enemy my friend?

Transcription regulatory network in baker’s yeast

5

Page 6: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Adjacency matrices

Representing edges (who is adjacent to whom) as a matrix Aij = 1 if node i has an edge to node j

= 0 if node i does not have an edge to j

Aii = 0 unless the network has self-loops

If self-loop, Aii=?

Aij = Aji if the network is undirected,or if i and j share a reciprocated edge

ij

i

ij

1

2

3

4

Example:

5

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 0 0 0 1

1 1 0 0 0

A =

6

Page 7: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Adjacency lists

Edge list 2 3 2 4 3 2 3 4 4 5 5 2 5 1

Adjacency list is easier to work with if network is

large sparse

quickly retrieve all neighbors for a node 1: 2: 3 4 3: 2 4 4: 5 5: 1 2

1

2

3

45

7

Page 8: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Nodes

Node network properties from immediate connections

indegreehow many directed edges (arcs) are incident on a node

outdegreehow many directed edges (arcs) originate at a node

degree (in or out)number of edges incident on a node

outdegree=2

indegree=3

degree=5

8

Page 9: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

HyperGraphs

Edges join more than two nodes at a time (hyperEdge)

Affliation networks

Examples Families Subnetworks

Can be transformed to a bipartite network

9

C D

A B

C D

A B

Page 10: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Bipartite (two-mode) networks

edges occur only between two groups of nodes, not within those groups

for example, we may have individuals and events directors and boards of directors customers and the items they purchase metabolites and the reactions they participate in

Page 11: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

in matrix notation

Bij = 1 if node i from the first group

links to node j from the second group = 0 otherwise

B is usually not a square matrix! for example: we have n customers and m products

i

j

1 0 0 0

1 0 0 0

1 1 0 0

1 1 1 1

0 0 0 1

B =

Page 12: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

going from a bipartite to a one-mode graph

One mode projection two nodes from the first group

are connected if they link to the same node in the second group

naturally high occurrence of cliques

some loss of information Can use weighted edges to

preserve group occurrences

Two-mode networkgroup 1

group 2

Page 13: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Collapsing to a one-mode network

i and k are linked if they both link to j Pij = k Bki Bkj

P’ = B BT

the transpose of a matrix swaps Bxy and Byx

if B is an nxm matrix, BT is an mxn matrix

i

j=1

k

j=2

B = BT =

1 0 0 0

1 0 0 0

1 1 0 0

1 1 1 1

0 0 0 1

1 1 1 1 0

0 0 1 1 0

0 0 0 1 0

0 0 0 1 1

Page 14: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Matrix multiplication

general formula for matrix multiplication Zij= k Xik Ykj

let Z = P’, X = B, Y = BT

1 0 0 0

1 0 0 0

1 1 0 0

1 1 1 1

0 0 0 1

P’ =

1 1 1 1 0

0 0 1 1 0

0 0 0 1 0

0 0 0 1 1

=

1 1 1 1 0

1 1 1 1 0

1 1 2 2 0

1 1 2 4 1

0 0 0 1 1

1 1

1 2

11 1 1 1 1

1

0

0

= 1*1+1*1 + 1*0 + 1*0= 2

Page 15: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Collapsing a two-mode network to a one mode-network

Assume the nodes in group 1 are people and the nodes in group 2 are movies

The diagonal entries of P’ give the number of movies each person has seen

The off-diagonal elements of P’ give the number of movies that both people have seen

P’ is symmetric

P’ =

1 1 1 1 0

1 1 1 1 0

1 1 2 2 0

1 1 2 4 1

0 0 0 1 1

1 1

1 2

1

Page 16: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Trees

Trees are undirected graphs that contain no cycles

For n nodes, number of edges m = n-1 A node can be dedicated as the root

Page 17: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

examples of trees

In nature trees river networks arteries (or veins, but not both)

Man made sewer system

Computer science binary search trees decision trees (AI)

Network analysis minimum spanning trees

from one node – how to reach all other nodes most quickly may not be unique, because shortest paths are not always unique depends on weight of edges

Page 18: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Planar graphs

A graph is planar if it can be drawn on a plane without any edges crossing

Page 19: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Kuratowski’s theorem

Every non-planar network contains at least one subgraph that is an expansion of K5 or K3,3.

K5 K3,3

Expansion: Addition of new node in the middle of edges.

Research challenge: Degree of planarity?

19

Page 20: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

#s of planar graphs of different sizes

1:1

2:2

3:4

4:11

Every planar graph

has a straight line

embedding

Page 21: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Edge contractions defined

A finite graph G is planar if and only if it has no subgraph that is homeomorphic or edge-contractible to the complete graph in five vertices (K5) or the complete bipartite graph K3, 3. (Kuratowski's Theorem)

Page 22: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Peterson graph

Example of using edge contractions to show a graph is not planar

Page 23: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Cliques and complete graphs

Kn is the complete graph (clique) with K vertices each vertex is connected to every other vertex there are n*(n-1)/2 undirected edges

K5 K8K3

Page 24: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Bi-cliques (cliques in bipartite graphs)

Km,n is the complete bipartite graph with m and n vertices of the two different types

K3,3 maps to the utility graph Is there a way to connect three utilities, e.g. gas, water, electricity to

three houses without having any of the pipes cross?

K3,3

Utility graph

Page 25: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Node degree

Outdegree =0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 0 0 0 1

1 1 0 0 0

A =

n

jijA

1

example: outdegree for node 3 is 2, which we obtain by summing the number of non-zero entries in the 3rd row

Indegree =0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 0 0 0 1

1 1 0 0 0

A =

n

iijA

1

example: the indegree for node 3 is 1, which we obtain by summing the number of non-zero entries in the 3rd column

n

iiA

13

n

jjA

13

1

2

3

45

25

Page 26: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Degree sequence and Degree distribution

Degree sequence: An ordered list of the (in,out) degree of each node

In-degree sequence: [2, 2, 2, 1, 1, 1, 1, 0]

Out-degree sequence: [2, 2, 2, 2, 1, 1, 1, 0]

(undirected) degree sequence: [3, 3, 3, 2, 2, 1, 1, 1]

Degree distribution: A frequency count of the occurrence of each degree

In-degree distribution: [(2,3) (1,4) (0,1)]

Out-degree distribution: [(2,4) (1,3) (0,1)]

(undirected) distribution: [(3,3) (2,2) (1,3)]

0 1 20

1

2

3

4

5

indegree

fre

qu

en

cy

26

Page 27: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Structural Metrics: Degree distribution

27

What if it is directed ?

Page 28: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Graph density

28

Page 29: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

Characterizing networks:How dense are they?

Page 30: Lecture 4: Mathematics of Networks CS 790g: Complex Networks Slides are modified from Networks: Theory and Application by Lada Adamic

network metrics: graph density

Of the connections that may exist between n nodes directed graph

emax = n*(n-1)

undirected graphemax = n*(n-1)/2

What fraction are present? density = e/ emax

For example, out of 12 possible connections,

this graph has 7, giving it a density of 7/12 = 0.583

Would this measure be useful for comparing networks of different sizes (different numbers of nodes)?

30