v spanning trees spanning trees v minimum spanning trees minimum spanning trees v kruskal’s...

Click here to load reader

Post on 04-Jan-2016

215 views

Category:

Documents

2 download

Embed Size (px)

TRANSCRIPT

  • Main Menu (Click on the topics below)Spanning TreesMinimum Spanning TreesKruskals AlgorithmExamplePlanar GraphsEulers Formula

    Click here to continueSanjay Jain, Lecturer, School of Computing

  • Spanning Trees and Planar Graphs Sanjay Jain, Lecturer, School of Computing

  • Spanning TreesDefinition: A spanning tree for a graph G is a subgraph of G that a) contains every vertex of G andb) is a tree.

  • Spanning TreesDefinition: A spanning tree for a graph G is a subgraph of G that a) contains every vertex of G andb) is a tree.......

  • END OF SEGMENT

  • Propositiona) Every connected finite graph G has a spanning tree.b) Any two spanning trees for a graph have the same number of edges (If G has n vertices, then spanning tree of G has n-1 edges).Proof: (of a)G is connected. Let G=G1. If G is a tree then we are done.2. Otherwise, delete an edge from a circuit of G and go to 1.

    At the end of the above algorithm, G will be a spanning tree of G.

  • END OF SEGMENT

  • Minimal Spanning Trees.

  • Minimal Spanning TreesWeighted Graph.Each edge has a weight associated with it.Minimal spanning tree, is a spanning tree with the minimum weight.

  • Minimal Spanning TreesMay not be uniqueMinimal spanning tree can be formed by taking any three edges in the above graph.

  • END OF SEGMENT

  • Kruskals AlgorithmInput: Graph G, V(G), E(G), weights of edges.Output: Minimal spanning tree of G.Algorithm:1. Initialize T to contain all vertices of G and no edges. Let E=E(G). n= number of vertices in V(G) m=02. While m < n-1 do2a. Find an edge in E with least weight.2b. Delete e from E2c. If adding e to T does not introduce a non-trivial circuit, then add e to the edge set of Tm=m+1EndifEndwhile

  • END OF SEGMENT

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • Example....SingaporeKLJakartaLondonNew York897623883410299.

  • END OF SEGMENT

  • Planar GraphsDefinition: A graph G is planar iff it can be drawn on a plane in such a way that edges never cross (I.e. edges meet only at the endpoints).

  • Plane Graph A drawing of planar graph G on a plane, without any crossing, is called the plane graph representation of G

  • END OF SEGMENT

  • Eulers FormulaTheorem: Suppose G is a connected simple planar graph with n3 vertices and m edges. Then, m 3n-6.

    Note that the above theorem is applicable only for connected simple graphs.

  • END OF SEGMENT

  • Eulers Formula ExamplesK5 number of vertices: 5 number of edges : 10 m 3n-6 does not hold.10 3*5-6 =9So K5 is not planar.

  • Eulers Formula ExamplesK4 number of vertices: 4 number of edges : 6 m 3n-6 holds.6 3*4-6 =6So K4 may be planar (it is actually planar as we have already seen).

  • Eulers Formula ExamplesK3,3 number of vertices: 6 number of edges : 9 m 3n-6 holds.9 3*6-6 =12So K3,3 may be planar (however K3,3 is not planar).

  • END OF SEGMENT

  • Planar GraphsA graph is planar iff it does not have K5 or K3,3 as a portion of it.

    There is a linear time algorithm to determine whether a given graph is planar or not. If the graph is planar, then the algorithm also gives a plane graph drawing of it.

  • END OF SEGMENT

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1)

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1).........

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1).........

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1).........

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1).........

  • Proof of Eulers FormulaFaces: The portion enclosed by edges. The outside is also a face.Let m be number of edges,n be number of vertices,and f be number of faces.Then:f = m-n+2 ----------- (1).........3f/2 m ----------- (2)By substituting (1) in (2) we get3m - 3n + 6 2mor m 3n - 6

  • END OF SEGMENT