Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Theory CSRU1400, Fall 2007 Ellen Zhang.

Similar presentations


Presentation on theme: "Graph Theory CSRU1400, Fall 2007 Ellen Zhang."— Presentation transcript:

1 Graph Theory CSRU1400, Fall 2007 Ellen Zhang

2 Outline Introduction to graph Is there a Eulerian trail, curcuit?
Isomorphism and planarity Shortest path problem

3 Graph G=(V,E), V is the set of vertices (nodes), E is the set of edges
Connected graph: where there is a path between any pair of distinct nodes A graph H is a subgraph of a G if all nodes and edges in H are also nodes and edges in G, i.e. H=(V’,E’) where A connected component of a graph G is a connected subgraph H of G such that no other connected subgraph of G containing H exists. Simple graph: no loop or parallel edges c a d b e f V={a, b, c, d, e, f} E={(a,b), (a,c), (a,d),(c,d), (b,d), (e,f)}

4 Walks in graph use every node edge
nontrivial & only repeated node is first/last closed walk trail path circuit Eulerian trail Eulerian circuit cycle no repeated edge no repeated vertices Hamiltonian

5 Does a graph have an Eulerian trail ?
C A Walk that go through all edges exactly once Proposition: in any graph, if a vertex x has an odd degree, then x cannot be an interior vertex (i.e., a vertex other than the starting or stopping point) in an Eulerian trail. For interior vertex: vs…e1xe2 … e3xe4 … ve A D B

6 What kind of graph has Eulerian circuit ?
Graph G is called Eulerian if G has an Eulerian circuit (a closed walk that used every edge once and only once) Let G be a connected graph. G is Eulerian if and only if every node in G has even degree. 1 2 3 4 5 6 7 8 10 9

7 Construct Eulerian circuit
Find any circuit C in graph G starting at a certain node, walking along unused edges until getting back to original node. Form a graph G’ by removing from G all edges in C and all vertices that have no edges left. G’ might not be connected G’ consists of graphs where every node has even degree; Use same process 1 to determine Eulerian circuits for G’ or its components. Piece together circuit C, and Eulerian curcuits found for G’, and get an Eulerian curcuit for G. 1 2 3 4 5 6 7 8 10 9

8 Eulerian Trail A connected graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. Moveover, the trail must begin and end at these two nodes If G has exactly two nodes of odd degree, after adding an edge connecting these two nodes, G has Eulerian circuit (by previous theorem). By removing added edge from circuit, we get a trail starting/ending at the two nodes. If G has an Eulerian trail, it’s easy to see that the starting/ending nodes have odd degree, all other nodes have even degree.

9 Example 1 Does this graph as Eulerian circuit or Eulerian trail ?
Find the Eulerian circuit or trail.. 2 5 6 3 4

10 Outline Introduction to graph Is there a Eulerian trail, curcuit?
Isomorphism and planarity Shortest path problem

11 Isomorphic Graphs Formal Def. Graph G and H are called isomorphic if there is a one-to-one correspondence f, between the vertices in G to vertices in H, so that (u,v) is edge in G if and only if (f(u),f(v)) is edge in H. One can rearrange G to get H z 3 4 y x u 1 v 2 5 6 w

12 Are these two graphs isomorphic ?
ƒ(b) = 6 ƒ(c) = 8 ƒ(d) = 3 ƒ(g) = 5 ƒ(h) = 2 ƒ(i) = 4 ƒ(j) = 7

13 Checking isomorphism Two graphs that are isomorphic to one another must have Same number of nodes Same number of edges Same number of nodes of any given degree Same number of cycles Same number of cycles of any given size A pair of graphs satisfying above conditions are not necessarily isomorphic

14 Examples

15 Planar Graph Often we want to draw graphs as clean as possible, as few crossings as possible Can we connect three factories to three utilities without one service crossing over the other ? Three utilities Three factories

16 Definitions A graph is called planar if it can be drawn on a plane so that no edges cross. Such a drawing is called an embedding. Bipartite graph: the set of nodes can be partitioned into two sets so that every edge has one endpoint in one set, one endpoint in another set. Complete bipartite graph, Km,n, is a bipartite graph with nodes S1={a1,…,am} and S2={b1,…,bn}, and every nodes in S1 is connecting to every node in S2. Complete graph, Kn

17 Are these graphs planar?
K4 K3,2 Kn,2

18 Are these graphs planar?
K5 K3,3

19 Kuratowski’s Theorem A graph G is planar if and only if contains no “copies” of K3,3 or K5 as subgraphs A subdivision of a graph results from inserting vertices into edges More strictly speaking, a graph is planar if and only if it does not contain a subgraph that is a subdivision of K5 or K3,3.

20 Practice Problem Are the following graphs planar ?

21 Euler’s Formula for planar graph
Def: for a planar graph G embedded in the plane, a face of the graph is a region of the plane created by the drawing. Note that we have one unbounded region. K4 a d b b

22 Euler’s Formula for Planar Graph
Basic facts: Given an embedding of a graph, Removing any edge from a cycle decrease by 1 the num. of faces Every edge on a cycle borders exactly two faces For acyclic graph, # of faces is 1 Euler’s Formula: for any connected planar graph G embedded in the plane with V vertices, E edges and F faces, we have V+F=E+2. Can be proved (see the book) by induction.

23 Eular’s Formula Also holds for polyhedrons E=12,V=8,F=6 E=6 V=4 F=4

24 Polyhedra represented as Planar Graph
Pick one face and stretch it out…

25 Now why K3,3 is not planar ? Prove by contradiction.
If K3,3 is planar, then Since V=6, E=9, by Euler’s formula, V+F=E+2, F=5 But by another theorem, we have E>=2*F, i.e, F<=4.5. (See book P for the detail). They cannot be both true, so our assumption (K3,3 is planar) is not true. So K3,3 is not planar

26 Outline Introduction to graph Is there a Eulerian trail, curcuit?
Isomorphism and planarity Shortest path problem

27 Shortest Path Problem Given a weighted graph and two vertices, u and v, find a path with minimum total weights between u and v Applications: driving direction, flight reservation etc

28 Dijkstra’s Algorithm Find the shortest paths from a single source to all other nodes, for weighted graph where all weights are non-negative Ideas: Maintain a set S of vertices whose final shortest-path weights from source have been decided Select from V-S, a vertex with minimum shortest-path estimate, x, insert into S Do we get better paths now by going through x ? If so, updating shortest-path estimates for nodes in V-S Repeat until S=V, i.e., shortest path to all nodes have been determined

29 Idea of Dijkstra’s algorithm
9 6 2 7 b c 2 11 2 8 3 f 1 a 1 5 6 4 e d 3 5 5 S: nodes colored with red Label of vertex: the estimated or determined shortest-path weight Highlighted edges: used in the shortest paths

30 Practice Problem Find shortest path from f to all other nodes 7 b c 2
3 f 1 a 1 5 6 4 e d


Download ppt "Graph Theory CSRU1400, Fall 2007 Ellen Zhang."

Similar presentations


Ads by Google