Download presentation
Presentation is loading. Please wait.
Published byBernard Martin Modified over 9 years ago
1
Graph Theory
2
undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph
3
adjacency matrix:
4
directed graph ( digraph)
5
weighted graph weight matrix
6
path cycle
7
connectivity matrix C C jk = 1 if there is a path of length 0 or more from v j to v k 0otherwise C: reflexive and transitive closure of G.
8
How to compute the connectivity matrix? Matrix multiplication ﹡ → (AND) + → (OR) e. g. Z = X ‧ Y Zij= (xi1 y1j) (xi2 y2j) … (xin ynj)
9
the algorithm: matrix B b jk =a jk for j k b jj =1 that is, b jk =1 if there is a path of length 0 or 1 from v j to v k vj to vk 0otherwise B 2 represents paths of length 2 or less. B 4 … B n
10
complexity: O(logn) matrix multiplications
11
Connected components
12
Assign each vertex a component number which is the smallest vertex label in the same component. Step 1: Compute the connectivity matrix.
13
Step 2: In each row, find the smallest label. component 0: v0, v1, v5 component 2: v2, v3 component 4: v4
14
complexity: same as that for computing the connectivity matrix. e. g. on hypercubes time: O(log 2 n) processor: n 3
15
All pairs shortest path
16
a sequential method — dynamic programming for k=0 to n-1 do for i=0 to n-1 do for j=0 to n-1 do : the length of a shortest path from v i to v j going through no vertex of label greater than k.
17
←shortest paths time: O(n 3 )
18
a parallel method matrix multiplication an algorithm similar to that computes the connectivity matrix. in matrix multiplication: * → + + →min
19
We can compute D 1, D 2, D 4, D 8, …, D n. complexity: O(log n) matrix multiplications e.g. on hypercubes time: O(log 2 n) processor: n 3
20
Minimum spanning trees 1 3 6 2 9 16 9 1 2 9
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.