interesting applications of graph theory

31
INTERESTING APPLICATIONS OF GRAPHS 06/06/2022 1

Upload: techmx

Post on 14-Nov-2014

9.744 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

  • 1. INTERESTING APPLICATIONS OFGRAPHS03/09/20121

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 edgesE, of certain entities called vertices V. Edges are also called asarcs 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 representa state or a condition while the edge may represent a relationbetween two vertices.03/09/2012 3 4. Directed Graph Directed Graphs or DIGRAPHS make reference to edges which aredirected (i.e.) edges which are ordered pairs of vertices. Undirected Graph A graph whose definition makes reference to unordered pairs ofvertices as edges is known as an undirected graph Path A simple path is a path in which all the vertices except possibly thefirst and last vertices are distinct03/09/20124 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 orpolygon. Eulerian Graph A walk starting at any vertex going through each edge exactly onceand terminating at the start vertex is called an Eulerian walk or line. A Hamiltonian path in a graph is a path that visits each vertexin the graph exactly once. A Hamiltonian cycle is a cycle that visits each vertex in thegraph exactly once and returns to the starting vertex.03/09/2012 5 6. Let G = (V, E) be an undirected connected graph. A subgraphT = (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 graphwhere each edge involves a cost, the extraction of a spanningtree extends itself to the extraction of a minimum costspanning tree. A minimum cost spanning tree is a spanning tree which has aminimum total cost.03/09/20126 7. 2 24 3 23 44 112399 6 18 6 665 4 54 161111 85 8 577 10 14 7218 78G = (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/20128 9. The algorithm then finds, at each stage, a new vertex to addto 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 vis not. Algorithm would build the minimum spanning tree, startingfrom 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/20129 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 doLet (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;endwhileend PRIM03/09/201210 11. V2 3 V312 3V6 V114 14V4 V503/09/2012 11 12. V21 V1V1 Algorithm startsAfter the 1stiteration03/09/201212 13. V3V23 V2V3 313 1 1 3VV11 After the 2ndV5 iterationAfter the 3rditeration03/09/2012 13 14. V3 V23 V23 V3 1 1211 V1 V1 1V6 1 V4V5V4V5 After the 4th After the 5th iteration iteration03/09/2012 14 15. The Travelling Salesman Problem (TSP) is an NP-hard problemstudied in OR(Operational Research) and theoreticalcomputer 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/201215 16. The TSP is easy to state, takes no math background tounderstand, and no great talent to find feasible solutions. Itsfun, and invites recreational problem solvers. It inturn has many practical applications. Many hard problems, such as job shop scheduling, can beconverted 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. Christofides Algorithm.Etc.,03/09/2012 17 18. It works only on undirected graphs. Step 1, minimum spanning tree: we construct a minimum costspanning tree T for graph G Step 2, Creating a Cycle:Now that we have our MST M , wecan create a cycle W from it. In order to do this, we walkalong the nodes in a depth first search, revisiting vertices asascend. Graphically, this means outlining the tree.03/09/201218 19. Step 3, Removing Redundant Visits: In order to create aplausible solution for the TSP, we must visit vertices exactlyonce.Since we used an MST, we know that each vertex is visited atleast once, so we need only remove duplicates in such a waythat does not increase the weight. Algorithm complexity is O(n3).03/09/2012 19 20. Example: G(V,E):6BelmontArlington74 38Fantsila 4 Cambridge58 Everett 76 Denmolt 03/09/201220 21. Minimum Hamiltonian Cycle6 BA7 438F 4C58E 76Cost = 34D 03/09/2012 21 22. Step 1:6 BA43FC5E6D 03/09/2012 22 23. Step 2: 6 B A 4 3 F C 5 E 6Cycle: ABCBFEDEFBA Cost : 48 D03/09/201223 24. Step 3:6 BA43FC5E6Shortcut: FBA FA Saving : 2D03/09/2012 24 25. Step 3:6 BA438FC5E6Shortcut: EFA EA Saving : 4D03/09/2012 25 26. Step 3:6 BA438FC8E6Shortcut: FED FD Saving : 3D03/09/2012 26 27. Step 3:6 BA484FC8E6Shortcut: CBF CF Saving : 3D03/09/2012 27 28. End:6 BA484FC8E6Cycle : ABCFDEACost: 36D03/09/201228 29. Knights Path: 03/09/201229 30. Applying graph theory to a system means using a graph-theoretic representation Representing a problem as a graph can provide a differentpoint of view. Representing a problem as a graph can make a problem muchsimpler. More accurately, it can provide the appropriate tools for solving theproblem.03/09/201230 31. 03/09/2012 31