0% found this document useful (0 votes)
15 views

hpc_graph

Uploaded by

Rajul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

hpc_graph

Uploaded by

Rajul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Graph theory

Victor Eijkhout

Fall 2022
Justification

Graph theory has many applications in computational math. Here we


focus on the equivalence with sparse matrices.

2
1 Graph algorithms

• Traditional: search, shortest path, connected components


• New: centrality

3
2 Traditional use of graph algorithms

4
3 1990s use of graph algorithms

5
4 2010 use of graph algorithms

6
5 2010 use of graph algorithms

7
6 Shortest distance algorithm
Given node s:
d : v 7→ d (s, v )

Input : A graph, and a starting node s


Output: A function d (v ) that measures the distance from s
to v
Let s be given, and set d (s) = 0
Initialize the finished set as U = {s}
Set c = 1
while not finished do
Let V the neighbours of U that are not themselves in U
if V = 0/ then
We’re done
else
Set d (v ) = c + 1 for all v ∈ V .
U ← U ∪V
Increase c ← c + 1
8
7 Level sets

The steps in the algorithm are ‘level sets’:

9
8 Computational characteristics

• Uses a queue: central storage


• Parallelism not self-evident
• Flexible assignment of work to processors, so no locality

10
9 Example

11
10 Level 1

12
11 Level 2

13
12 Level 3

14
13 Matrix view

15
14 Level 1

16
15 Level 2

17
16 summing up

18
17 All-pairs shortest path


∆k +1 (u , v ) = min ∆k (u , v ), ∆k (u , k ) + ∆k (k , v ) . (1)

Algebraically:

for k from zero to |V | do 


D ← D .min D (:, k ) min ·+ D (k , :)

Similarity to Gaussian elimination

19
18 Pagerank
T stochastic: all rowsums are 1.

Prove x t e = 1 ⇒ x t T = 1

Pagerank is essentially a power method: x t , x t T , x t T 2 , . . . modeling


page transitions.

Prevent getting stuck with random jump:

x t ← sx t T + (1 − s)et

Solution of linear system:

x t (I − sT ) = (1 − s)et

Observe
(I − sT )−1 = I + sT + s2 T 2 + · · ·

20
19 ‘Real world’ graphs

• Graphs imply sparse matrix vector product


• . . . but the graphs are unlike PDE graphs
• differences:
– low diameter
– high degree
– power law
• treat as random sparse: use dense techniques
• 2D matrix partitioning: each block non-null, but sparse

21
20 Parallel treatment

• Intuitive approach: partitioning of nodes


• equivalent to 1D matrix distribution
• not scalable ⇒ 2D distribution
• equivalent to distribution of edges
• unlike with PDE graphs, random placement may actually be good

22

You might also like