0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Interesting applications of graph theory

13,564

Published on

Published in: Technology, Education
4 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
13,564
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
346
0
Likes
4
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. INTERESTING APPLICATIONS OF GRAPHS03/09/2012 1
• 2.  Graph. Vertex. Edge. Undirected Graph. Directed Graph. Path. Cycle. Eulerian Cycle and Hamiltonian Cycle.03/09/2012 2
• 3.  A graph G consists of a finite set of ordered pairs, called edges E, of certain entities called vertices V. Edges are also called as arcs or links. Vertices are also called as nodes or points. G=(V,E) A graph is a set of vertices and edges. A vertex may represent a state or a condition while the edge may represent a relation between two vertices.03/09/2012 3
• 4.  Directed Graph  Directed Graphs or DIGRAPHS make reference to edges which are directed (i.e.) edges which are ordered pairs of vertices. Undirected Graph  A graph whose definition makes reference to unordered pairs of vertices as edges is known as an undirected graph Path  A simple path is a path in which all the vertices except possibly the first and last vertices are distinct03/09/2012 4
• 5.  Cycle  A cycle is a simple path in which the first and last vertices are the same . A cycle is also known as a circuit, elementary cycle, circular path or polygon. Eulerian Graph  A walk starting at any vertex going through each edge exactly once and terminating at the start vertex is called an Eulerian walk or line. A Hamiltonian path in a graph is a path that visits each vertex in the graph exactly once. A Hamiltonian cycle is a cycle that visits each vertex in the graph exactly once and returns to the starting vertex.03/09/2012 5
• 6.  Let G = (V, E) be an undirected connected graph. A subgraph T = (V, E’) of G is a spanning tree of G iff T is a tree Given G = (V, E) to be a connected, weighted undirected graph where each edge involves a cost, the extraction of a spanning tree extends itself to the extraction of a minimum cost spanning tree. A minimum cost spanning tree is a spanning tree which has a minimum total cost.03/09/2012 6
• 7. 2 24 3 2 3 4 4 1 1 23 9 9 6 18 6 6 6 5 4 5 4 16 11 11 8 5 8 5 7 7 10 14 7 21 8 7 8 G = (V, E) T = (V, F) w(T) = 5003/09/2012 7
• 8.  Select an arbitrary node as the initial tree (T) Augment T in an iterative fashion by adding the outgoing edge (u,v), (i.e., u  T and v  G-T ) with minimum cost (i.e., weight) The algorithm stops after |V | - 1 iterations Computational complexity = O (|V|2)03/09/2012 8
• 9.  The algorithm then finds, at each stage, a new vertex to add to the tree by choosing the edge (u, v) such that the cost of (u, v) is the smallest among all edges where u is in the tree and v is not. Algorithm would build the minimum spanning tree, starting from v1. Initially, v1 is in the tree as a root with no edges. Each step adds one edge and one vertex to the tree.03/09/2012 9
• 10. procedure PRIM(G) E’ = ; /* Initialize E’ to a null set */ Select a minimum cost edge (u,v) from E; V’ = {u}  Include u in V’  while V’ not equal to V do Let (u, v) be the lowest cost edge such that u is in V’ and v is in V – V’; Add edge (u,v) to set E’; Add v to set V’; endwhile end PRIM03/09/2012 10
• 11. V2 3 V3 1 2 3 V6 V1 1 4 1 4 V4 V503/09/2012 11
• 12. V2 1 V1 V1 Algorithm starts After the 1st iteration03/09/2012 12
• 13. V3 V2 3 V2 V3 3 1 3 1 1 3 V V1 1 After the 2nd V5 iteration After the 3rd iteration03/09/2012 13
• 14. V3 V2 3 V2 3 V3 1 1 2 1 1 V1 V1 1 V6 1 V4 V5 V4 V5 After the 4th After the 5th iteration iteration03/09/2012 14
• 15.  The Travelling Salesman Problem (TSP) is an NP-hard problem studied in OR(Operational Research) and theoretical computer science. You are given a set of n cities You are given the distances between the cities. You start and terminate your tour at your home city. You must visit each other city exactly once. Your mission is to determine the shortest tour.03/09/2012 15
• 16.  The TSP is easy to state, takes no math background to understand, and no great talent to find feasible solutions. It’s fun, and invites recreational problem solvers. It inturn has many practical applications. Many hard problems, such as job shop scheduling, can be converted algebraically to and from the TSP. A good TSP algorithm will be good for other hard problems.03/09/2012 16
• 17.  Nearest Neighbour Algorithm. Lower Bound Algorithm. Tour Improvement Algorithm. Christofide’s Algorithm. Etc.,03/09/2012 17
• 18.  It works only on undirected graphs. Step 1, minimum spanning tree: we construct a minimum cost spanning tree T for graph G Step 2, Creating a Cycle:Now that we have our MST M , we can create a cycle W from it. In order to do this, we walk along the nodes in a depth first search, revisiting vertices as ascend. Graphically, this means outlining the tree.03/09/2012 18
• 19.  Step 3, Removing Redundant Visits: In order to create a plausible solution for the TSP, we must visit vertices exactly once. Since we used an MST, we know that each vertex is visited at least once, so we need only remove duplicates in such a way that does not increase the weight. Algorithm complexity is O(n3).03/09/2012 19
• 20. Example: G(V,E): 6 Belmont Arlington 7 4 3 8 Fantsila 4 Cambridge 5 8 Everett 7 6 Denmolt 03/09/2012 20
• 21. Minimum Hamiltonian Cycle 6 B A 7 4 3 8 F 4 C 5 8 E 7 6Cost = 34 D 03/09/2012 21
• 22. Step 1: 6 B A 4 3 F C 5 E 6 D 03/09/2012 22
• 23. Step 2: 6 B A 4 3 F C 5 E 6Cycle: ABCBFEDEFBA Cost : 48 D 03/09/2012 23
• 24. Step 3: 6 B A 4 3 F C 5 E 6Shortcut: FBA FA Saving : 2 D 03/09/2012 24
• 25. Step 3: 6 B A 4 3 8 F C 5 E 6Shortcut: EFA EA Saving : 4 D 03/09/2012 25
• 26. Step 3: 6 B A 4 3 8 F C 8 E 6Shortcut: FED FD Saving : 3 D 03/09/2012 26
• 27. Step 3: 6 B A 4 8 4 F C 8 E 6Shortcut: CBF CF Saving : 3 D 03/09/2012 27
• 28. End: 6 B A 4 8 4 F C 8 E 6Cycle : ABCFDEACost : 36 D 03/09/2012 28
• 29. Knight’s Path: 03/09/2012 29
• 30.  Applying graph theory to a system means using a graph- theoretic representation Representing a problem as a graph can provide a different point of view. Representing a problem as a graph can make a problem much simpler.  More accurately, it can provide the appropriate tools for solving the problem.03/09/2012 30
• 31. 03/09/2012 31