Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Theory and Algorithm 02

Similar presentations


Presentation on theme: "Graph Theory and Algorithm 02"— Presentation transcript:

1 Graph Theory and Algorithm 02
COP 6726: New Directions in Database Systems Graph Theory and Algorithm 02

2 A* algorithm

3 A* algorithm f(n) = g(n) + h(n)
g(n) = “cost from the starting node to reach n” h(n) = “estimate of the cost of the cheapest path from n to the goal node” A* generates an optimal solution if h(n) is an admissible heuristic and the search space is a tree: h(n) is admissible if it never overestimates the cost to reach the destination node A heuristic is admissible if it is too optimistic, estimating the cost to be smaller than it actually is. Example: h(n) = “Euclidean distance to destination”

4 A* algorithm f(n) = g(n) + h(n)

5 Clustering Graph

6 Markov Chains 0.6 0.4 0.8 = A B 0.2 = A B .6 .2 .4 .8 = =

7 Clustering on Graphs A B C D E F G A 0, 1, 1, 1, 0, 0, 0 B
0, 1, 1, 1, 0, 0, 0 1, 0, 1, 1, 1, 0, 0 1, 1, 0, 1, 0, 0, 0 1, 1, 1, 0, 0, 0, 0 0, 1, 0, 0, 0, 1, 1 0, 0, 0, 0, 1, 0, 1 0, 0, 0, 0, 1, 1, 0 A B E G C D F

8 Random Walk A B C D E F G

9 Random Walk A B C D E F G A B C D E F G A B C D E F G

10 Random Walk A B C D E F G A B C D E F G A B C D E F G

11 Random Walk A B C D E F G A B C D E F G A B C D E F G

12 Random Walk A B C D E F G A B C D E F G A B C D E F G

13 Random Walk A B C D E F G A B C D E F G A B C D E F G

14 Random Walk A B C D E F G A B C D E F G A B C D E F G

15 Random Walk A B C D E F G A B C D E F G A B C D E F G

16 Random Walk A B C D E F G A B C D E F G Node B has the highest value.
Node A, C, D, E has the second highest value.

17 Markov Cluster Algorithm (MCL)
Normalization Inflation: the inflation operation is responsible for both strengthening and weakening of current status. square normalization 1/2 1/6 1/3 1/4 1/36 1/9 9/14 1/14 4/14

18 Random Walk A B C D A B C D 1

19 MCL A B C D A B C D 1

20 MCL A B C D E F G A B C D E F G 0, 1, 1, 1, 0, 0, 0 1, 0, 1, 1, 1, 0, 0 1, 1, 0, 1, 0, 0, 0 1, 1, 1, 0, 0, 0, 0 0, 1, 0, 0, 0, 1, 1 0, 0, 0, 0, 1, 0, 1 0, 0, 0, 0, 1, 1, 0 A B E G C D F

21 MCL A B E G C D F

22 Graph Partitioning

23 Graph Partitioning

24 Local Search

25 Suffix Tree

26 Suffix Tree Suffix trees can be used to solve the exact matching problem in linear time. The Exact matching problem: Given a pattern P of length n, and a text T of length m, find all occurrences of P in T in O(n + m) time. {aeef, ad, bbfe, bbfg, c, aeef}

27 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} a e e f

28 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} a e d e f

29 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} a b e b d e f f e

30 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} a b e b d e f f e g

31 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} c a b e b d e f f e g

32 Suffix Tree {aeef, ad, bbfe, bbfg, c, aeef} c a b e b d e f f e g

33 Max Flow

34 Max Flow capacity A B B 4 5 Source Sink A 3 C 2 1 D

35 Max Flow capacity A B B 4 5 Source Sink A 3 C 2 1 D

36 Max Flow capacity A B B 4 1 Source 4 Sink A 3 C 2 1 D

37 Max Flow capacity A B B 4 1 Source 4 Sink A 3 C 2 1 D

38 Max Flow capacity A B B 4 1 Source 4 Sink A 3 C 2 1 D

39 Max Flow capacity A B B 4 5 Source Sink A 2 1 C 1 1 1 D

40 Max Flow capacity A B B 4 5 Source Sink A 2 1 C 1 1 1 D

41 Max Flow capacity A B B 4 5 Source Sink A 2 1 C 2 1 D

42 Max Flow-Min Cut

43 Max Flow / Min Cut Question: Maximum Flow Source Sink B 10 8 A 1 C 6 7
D

44 Max Flow / Min Cut An (S,T)-cut in a flow network G = (V,E) is a partition of vertices V into two disjoint subsets S and T such that s  S, t  T The capacity of a cut (S,T) is CAP(S,T) = uS vT c(u,v) B 9/10 8/8 Source Sink A 1/1 C 6/6 7/10 D

45 Bipartite matching

46 Bipartite Matching b1 a1 b2 a2 b3 a3 b4 a4 b5

47 Bipartite Matching b1 a1 b2 a2 s b3 t a3 b4 a4 b5

48 Bipartite Matching b1 a1 b2 a2 s b3 t a3 b4 a4 b5

49 Bipartite Matching b1 a1 b2 a2 b3 a3 b4 a4 b5

50 Shortest path Algorithm

51 Shortest Path Algorithm
Factory: A, E, K Warehouse: H, I 1 2 3 1 A B C D E 1 1 1 1 1 1 1 1 1 F G H I J 3 1 3 1 2 3 1 2 1 K L M N O

52 Open Pit Mining

53 Open fit Mining Closed Set Not a closed Set

54 Open fit Mining Maximize the profit -2 1 2 -2 1

55 Open fit Mining Maximize the profit -2 1 2 -2 1

56 Open fit Mining Construct a flow graph where the minimum cut identifies a feasible set that maximizes profit. s 2 2 -2 1 2 -2 1 2 1 1 t Each edge in E has infinite capacity Add nodes s, t Each node is attached to s and t with finite capacity edges.

57 Open fit Mining Minimum cut gives optimal solution. s 2 2 ∞ ∞ ∞ ∞ -2 1

58 Open fit Mining 8 -9 -1 7

59 Open fit Mining t -9 8 -9 -1 -1 -8 7 -7 s

60 Open fit Mining t -9 8 -9 -1 -1 -8 7 -7 s

61 NP hard problems

62 NP-hard problem Class of problems which are at least as hard as the hardest problems in NP. Problems that are NP-hard do not have to be elements of NP; indeed, they may not even be decidable. A decision problem is NP-complete when it is both in NP and NP-hard. A decision problem C is NP-complete if: C is in NP, and Every problem in NP is reducible to C in polynomial time. C can be shown to be in NP by demonstrating that a candidate solution to C can be verified in polynomial time.

63 NP-complete examples Boolean satisfiability problem (SAT)
Subgraph isomorphism problem Independent set problem Knapsack problem Subset sum problem Dominating set problem Hamiltonian path problem Clique problem Graph coloring problem Travelling salesman problem Vertex cover problem

64 Take Home Message Graph Algorithms


Download ppt "Graph Theory and Algorithm 02"

Similar presentations


Ads by Google