Download presentation
Presentation is loading. Please wait.
Published byMarjory Allen Modified over 9 years ago
1
Graph Theory By: Maciej Kicinski Chiu Ming Luk
2
Extract Triple words
3
Extract Triple words
4
Extract Double words
5
Extract Double words
6
Adjacency-matrix Representation
7
Adjacency-matrix Representation
8
Adjacency-lists Representation
9
Depth-First Search
10
Depth-First Search
11
Breath-First Search
12
Breath-First Search
13
Strongly connected Component
14
Kosaraju's algorithm Let G be a directed graph and S be an empty stack. While S does not contain all vertices: –Choose an arbitrary vertex v not in S. Perform a depth-first search starting at v. Each time that depth-first search finishes expanding a vertex u, push u onto S. Reverse the directions of all arcs to obtain the transpose graph. While S is nonempty: –Pop the top vertex v from S. Perform a depth-first search starting at v. The set of visited vertices will give the strongly connected component containing v; record this and remove all these vertices from the graph G and the stack S.
15
Kosaraju's algorithm
16
Simplicial Complexes S0 – 0 1 2 3 4 5 6 7 S1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} S2 - {5,6,7}
17
Tarjan Algorithm For a directed graph: Checks every edge starting from a node For every node lead to by an edge, checks edges for nodes that have not been checked yet repeats until every node that can be checked from these nodes has been check All checked nodes are Strongly Connected. Any node that could not have been reached is not strongly connected to the nodes reached.
18
Tarjan Algorithm To find Strong Connected Components(SCC) Take simplicial complexes: Δ 0 – 0 1 2 3 4 5 6 7 Δ 1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} Δ 2 – {5,6,7} And make each one a node with edges connecting relation Δ 0 – 0 1 2 3 4 5 6 7 Δ 1 – 8 9 10 11 12 13 14 Δ 2 – 15
19
Graph Δ 0 – 0 1 2 3 4 5 6 7 Δ 1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} Δ 2 - {5,6,7}
20
Strongly Connected Components Connected nodes are consider strongly connected SCC 0 – 0 1 2 {0,1} {0,2} {1,2} SCC 1 – 3 4 {3,4} SCC 2 – 5 6 7 {5,6} {5,7} {6,7} {5,6,7}
21
Simplicial Complex and SCC Graph Can reduce # of nodes since we know the relation in simplicial complexes we then only need to find relation between the different complexes. SCC 0 – {0,1} {0,2} ({1,2}) SCC 1 – {3,4} SCC 2 – {5,6,7}
22
Run Time Tarjan Algorithm runs in O(e + n) time where e is edges and n is number of nodes Sort – O(n*log(n)) but only on singles Build Nodes – O(n*log(n)) orO(n) Build Edges – O(n) or O(n*log(n)) Tarjan Algorithm finished on ≈ 1 mil nodes in less than a second.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.