Presentation is loading. Please wait.

Presentation is loading. Please wait.

LOGO.  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton.

Similar presentations


Presentation on theme: "LOGO.  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton."— Presentation transcript:

1 LOGO

2  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton paths 2

3 LOGO 3

4 What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.

5 LOGO What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.  Technical meaning in discrete mathematics: A particular class of discrete structures (to be defined) that is useful for representing relations and has a convenient graphical representation.

6 LOGO 6 What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.  Technical meaning in discrete mathematics: A particular class of discrete structures (to be defined) that is useful for representing relations and has a convenient graphical representation. Not

7 LOGO 7 Applications of Graphs  (At least) anything that can be modelled using 1- or 2-place relations.  Apps in networking, scheduling, flow optimization, circuit design, path planning, search; genealogy, any kind of taxonomy, …  Challenge: name a topic that graphs cannot model

8 LOGO 8  We shall introduce a number of different types of graphs, starting with undirected graphs:  “simple” graphs  multigraphs  pseudographs

9 LOGO 9 Simple Graphs  Correspond to symmetric, irreflexive binary relations R.  A simple graph G=(V,E) consists of:  a set V of vertices or nodes (V corresponds to the universe of the relation R),  a set E of edges: unordered pairs of distinct elements u,v  V, such that uRv.

10 LOGO 10 Simple Graphs  Correspond to symmetric, irreflexive binary relations R.  A simple graph G=(V,E) consists of:  a set V of vertices or nodes (V corresponds to the universe of the relation R),  a set E of edges: unordered pairs of distinct elements u,v  V, such that uRv. Visual Representation of a Simple Graph

11 LOGO 11  Let V be the set of states in the far- southeastern U.S.:  I.e., V={FL, GA, AL, MS, LA, SC, TN, NC}  Let E={{u,v}|u adjoins v} ={{FL,GA},{FL,AL},{FL,MS}, {FL,LA},{GA,AL},{AL,MS}, {MS,LA},{GA,SC},{GA,TN}, {SC,NC},{NC,TN},{MS,TN}, {MS,AL}} Example of a Simple Graph TN AL MS LA SC GA FL NC

12 LOGO 12 Extensions  All the main types of graphs can be extended to make them more expressive

13 LOGO 13 Extensions  All the main types of graphs can be extended to make them more expressive  For example, edges may be labelled: Labelled graphs

14 LOGO 14 Extensions  All the main types of graphs can be extended to make them more expressive  For example, edges may be labelled: Labelled graphs  E.g., the edges in the previous example may be labelled with the type of border (e.g., patrolled/non-patrolled)

15 LOGO 15 Multigraphs  Like simple graphs, but there may be more than one edge connecting two given nodes.  A multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges (as primitive objects), and a function f:E  {{u,v}|u,v  V  u  v}.  E.g., nodes are cities, edges are segments of major highways. Parallel edges

16 LOGO 16 Multigraphs extended  Extension: edges may be labelled with numbers of miles. How about this example? 110 8020 90 BA C

17 LOGO 17 Multigraphs extended  Can go from A to B via C in less than 110. The distances in the graph are not minimal, or something is wrong. 110 8020 90 BA C

18 LOGO 18 Pseudographs  Like a multigraph, but edges connecting a node to itself are allowed. (R may even be reflexive.)  A pseudograph G=(V, E, f ) where f:E  {{u,v}|u,v  V}. Edge e  E is a loop if f(e)={u,u}={u}.  E.g., nodes are campsites in a state park, edges are hiking trails through the woods.

19 LOGO 19 Pseudographs  Like a multigraph, but edges connecting a node to itself are allowed. (R may even be reflexive.)  A pseudograph G=(V, E, f ) where f:E  {{u,v}|u,v  V}. Edge e  E is a loop if f(e)={u,u}={u}.  E.g., nodes are campsites in a state park, edges are hiking trails through the woods.

20 LOGO 20 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.

21 LOGO 21 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.  A di(rected) graph (V,E) consists of a set of vertices V and a binary relation E on V.  E.g.: V = set of People, E={(x,y) | x loves y}

22 LOGO 22 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.  A di(rected) graph (V,E) consists of a set of vertices V and a binary relation E on V.  E.g.: V = set of People, E={(x,y) | x loves y}

23 LOGO 23 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.

24 LOGO 24 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.

25 LOGO 25 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.  E.g., V=web pages, E=hyperlinks. The WWW as a directed multigraph...

26 LOGO 26 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.  E.g., V=web pages, E=hyperlinks. The WWW as a directed multigraph...

27 LOGO 27 Types of Graphs: Summary  Summary of the book’s definitions.  This terminology is not fully standardized across different authors

28 LOGO 28

29 LOGO 29 Graph Terminology Introducing the following terms:  Adjacent, connects, endpoints, degree, initial, terminal, in-degree, out-degree, complete, cycles, wheels, n-cubes, bipartite, subgraph, union.

30 LOGO 30 Adjacency Let G be an undirected graph with edge set E. Let e  E be (or map to) the pair {u,v}. Then we say:  u, v are adjacent / connected.  Edge e is incident with vertices u and v.  Edge e connects u and v.  Vertices u and v are endpoints of edge e.

31 LOGO 31 Degree of a Vertex  Let G be an undirected graph, v  V a vertex.  The degree of v, deg(v), is its number of incident edges. (Except that any self-loops are counted twice.)  A vertex with degree 0 is called isolated.  A vertex of degree 1 is called pendant.

32 LOGO 32 Degree of a Vertex  The degree of v, deg(v), is its number of incident edges. (Except that any self-loops are counted twice.)  Exercise: construct a pseudograph with three vertices, all of which have different degrees.

33 LOGO 33 Handshaking Theorem  Let G be an undirected (simple, multi-, or pseudo-) graph with vertex set V and edge set E. Then  Proof: every edge causes degree:= degree +2

34 LOGO 34 Handshaking Theorem  Let G be an undirected (simple, multi-, or pseudo-) graph with vertex set V and edge set E. Then  Corollary: Any undirected graph has an even number of vertices of odd degree.

35 LOGO 35 `Sociological’ example  (Like previous exercise, this is from Jonathan L.Gross’ coursenotes to Rosen) Suppose the students in this class are represented as vertices. An edge between a and b means that a and b were acquainted before the course began. [This is a simple graph.]  How many students knew an odd number of other students? Could there be 3?

36 LOGO 36 `Sociological’ example  (Like previous exercise, this is from Jonathan L.Gross’ coursenotes to Rosen) Suppose the students in this class are represented as vertices. An edge between a and b means that a and b were acquainted before the course began. [This is a simple graph.]  [By corollary to handshaking theorem:] The number of students who knew an odd number of other students is even.

37 LOGO 37 Directed Adjacency  Let G be a directed (possibly multi-) graph, and let e be an edge of G that is (or maps to) (u,v). Then we say:  u is adjacent to v, v is adjacent from u  e comes from u, e goes to v.  e connects u to v, e goes from u to v  the initial vertex of e is u  the terminal vertex of e is v

38 LOGO 38 Directed Degree  Let G be a directed graph, v a vertex of G.  The in-degree of v, deg  (v), is the number of edges going to v.  The out-degree of v, deg  (v), is the number of edges coming from v.  The degree of v, deg(v):  deg  (v)+deg  (v), is the sum of v’s in-degree and out-degree.

39 LOGO 39 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:

40 LOGO 40 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:

41 LOGO 41 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:  Note that the degree of a node is unchanged by whether we consider its edges to be directed or undirected.

42 LOGO 42 Special Graph Structures Special cases of undirected graph structures:  Complete graphs K n  Cycles C n  Wheels W n  n-Cubes Q n  Bipartite graphs  Complete bipartite graphs K m,n

43 LOGO 43 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E.

44 LOGO 44 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E. K1K1 K2K2 K3K3 K4K4 K5K5 K6K6

45 LOGO 45 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E. K1K1 K2K2 K3K3 K4K4 K5K5 K6K6 Note that K n has edges.

46 LOGO 46  Consider a complete graph G=(V,E). Can E contain any edges connecting a node in V to itself?

47 LOGO 47  Consider a complete graph G=(V,E). Can E contain any edges connecting a node in V to itself?  No: this would mean {u,v}  E, where u=v hence  u,v  V: u  v  {u,v}  E.

48 LOGO 48  Can you think of a natural example where complete graphs might model the facts?

49 LOGO 49  Can you think of a natural example where complete graphs might model the facts?  E.g., Graphs that model, for groups of n people, which people are seen by each member of the group

50 LOGO 50 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}.

51 LOGO 51 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8

52 LOGO 52 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8 How many edges are there in C n ?

53 LOGO 53 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8 How many edges are there in C n ? n

54 LOGO 54  Can you think of a natural example where cycles might model the facts?  E.g., Graphs that model, for groups of n people, which people are sitting next to each other (on a round table)

55 LOGO 55  Can a cycle be a complete graph?

56 LOGO 56  Can a cycle be a complete graph?  Yes: every cycle with exactly 3 elements is a complete graph.  No other cycle can be a complete graph.

57 LOGO 57  Can a cycle be a complete graph?  Yes: every cycle with exactly 3 elements is a complete graph.  No other cycle can be a complete graph. Can be proven by proving with induction that: |Edges(C_n)| 2.

58 LOGO 58 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8

59 LOGO 59 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8 How many edges are there in W n ?

60 LOGO 60 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8 How many edges are there in W n ? 2n

61 LOGO 61  Definition: A graph is regular iff every vertex has the same degree.

62 LOGO 62  Which of these are regular? (What degree?)  Complete graphs?  Cycle graphs?  Wheel graphs?

63 LOGO 63  Which of these are regular? (What degree?)  Complete graphs? Yes: degree n-1 (for n nodes)  Cycle graphs? Yes: degree 2  Wheel graphs? No, except when they have 3 nodes

64 LOGO 64 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node.

65 LOGO 65 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Q0Q0 Q1Q1 Q2Q2 Q3Q3 ? What do you think about Q 4 ?

66 LOGO 66 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Q0Q0 Q1Q1 Q2Q2 Q3Q3 Q4Q4

67 LOGO 67 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Number of vertices: 2 n. Number of edges:Exercise to try! Q0Q0 Q1Q1 Q2Q2 Q3Q3 Q4Q4

68 LOGO 68 n-cubes (hypercubes)  For any n  N, the hypercube Q n can be defined recursively as follows:  Q 0 ={{v 0 },  } (one node and no edges)  For any n  N, if Q n =(V,E), where V={v 1,…,v a } and E={e 1,…,e b }, then Q n+1 = …

69 LOGO 69 n-cubes (hypercubes)  For any n  N, the hypercube Q n can be defined recursively as follows:  Q 0 ={{v 0 },  } (one node and no edges)  For any n  N, if Q n =(V,E), where V={v 1,…,v a } and E={e 1,…,e b }, then Q n+1 = (V  {v 1 ´,…,v a ´}, E  {e 1 ´,…,e b ´}  {{v 1,v 1 ´},{v 2,v 2 ´},…, {v a,v a ´}}) where v 1 ´,…,v a ´ are new vertices, and where if e i ={v j,v k } then e i ´={v j ´,v k ´}.

70 LOGO 70  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }. Bipartite Graphs

71 LOGO 71  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }.  In Human Mode(!): The graph can be divided into two parts in such a way that all edges go between the two parts. Bipartite Graphs V1V1 V2V2 Can represent with zero-one matrices.

72 LOGO 72  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }.  In Human Mode(!): The graph can be divided into two parts in such a way that all edges go between the two parts. Bipartite Graphs V1V1 V2V2 This definition can easily be adapted for the case of multigraphs and directed graphs as well. Can represent with zero-one matrices.

73 LOGO 73 Bipartite graphs  … are extremely common, for example when you’re modelling a domain that consists of two different kinds of entities  Animals in a zoo, linked with their keepers  Words, linked with numbers of letters in them  Logical formulas, linked with English sentences that express their meaning

74 LOGO 74 Some questions  Can you think of a graph with two vertices that is not bipartite?  Can you think of a simple graph with two vertices that is not bipartite?  Can you think of a simple graph with three vertices and a nonempty set of edges that is bipartite?

75 LOGO 75 Some questions  Can you think of a graph with two vertices that is not bipartite? Yes: if there are self-loops  Can you think of a simple graph with two vertices that is not bipartite? No: must be bipartite  Can you think of a simple graph with three vertices and a nonempty set of edges that is bipartite? Yes: as long as it’s not complete

76 LOGO 76  Given a (bipartite) graph, can there be more than 1 way of partitioning V into V 1 and V 2 ?

77 LOGO 77  Given a (bipartite) graph, can there be more than 1 way of partitioning V into V 1 and V 2 ?  Yes: isolated vertices can be put in either part: Bipartite Graphs V1V1 V2V2

78 LOGO 78 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has _____ nodes and _____ edges.

79 LOGO 79 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has m+n nodes and n*m edges.

80 LOGO 80 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has m+n nodes and n*m edges. Note: not every CBG is complete! (So “CBG” is a strange name)

81 LOGO 81 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E.

82 LOGO 82 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E. G

83 LOGO 83 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E. G H

84 LOGO 84  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E.  Note: since H is a graph, F can only involve nodes that are elements of W.

85 LOGO 85

86 LOGO 86 Graph Representations & Isomorphism  Graph representations:  Adjacency lists.  Adjacency matrices. [Not covered this course]  Incidence matrices. [Not covered this course]

87 LOGO 87 Adjacency Lists  A table with 1 row per vertex, listing its adjacent vertices. a b d c f e

88 LOGO 88 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar

89 LOGO 89 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.

90 LOGO 90 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.  But even (V,E) and (V’,E’) (where V<>V’ and E<>E’) may in some sense be equivalent:

91 LOGO 91 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.  But even (V,E) and (V’,E’) (where V<>V’ and E<>E’) may in some sense be equivalent:  Graph isomorphism (informal):  Two graphs are isomorphic iff they are identical except for their node names.

92 LOGO 92  Graphs that are isomorphic share all their `important’ properties, e.g.,  The number of nodes and edges  The degrees of all their nodes  Whether they are bipartite or not, etc.

93 LOGO 93  Graphs that are isomorphic share all their `important’ properties, e.g.,  The number of nodes and edges  The degrees of all their nodes  Whether they are bipartite or not, etc.  How would you define graph isomorphism formally?  For simplicity: focus on simple graphs  Hint: use the notion of a bijection

94 LOGO 94 Graph Isomorphism  Formal definition:  Simple graphs G 1 =(V 1, E 1 ) and G 2 =(V 2, E 2 ) are isomorphic iff  a bijection f:V 1  V 2 such that  a,b  V 1, a and b are adjacent in G 1 iff f(a) and f(b) are adjacent in G 2.  f is the “renaming” function between the two node sets that makes the two graphs identical.  This definition can be extended to other types of graphs.

95 LOGO 95 Graph Isomorphism  How can we tell whether two graphs are isomorphic?  The best algorithms that are known to solve this problem have exponential worst-case time complexity. (Faster solutions may be possible.)  In practice, a few tests go a long way …

96 LOGO 96 Graph Invariants under Isomorphism Necessary but not sufficient conditions for G 1 =(V 1, E 1 ) to be isomorphic to G 2 =(V 2, E 2 ):  |V1|=|V2| and |E1|=|E2|.  The number of vertices with degree n is the same in both graphs.  For every proper subgraph g of one graph, there is a proper subgraph of the other graph that is isomorphic to g.

97 LOGO 97 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f

98 LOGO 98 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f d

99 LOGO 99 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f d f

100 LOGO 100 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d f

101 LOGO 101 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a f

102 LOGO 102 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a e f

103 LOGO 103 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a e f c

104 LOGO 104 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e

105 LOGO 105 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices

106 LOGO 106 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges

107 LOGO 107 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

108 LOGO 108 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

109 LOGO 109 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

110 LOGO 110 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

111 LOGO 111 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

112 LOGO 112  We now jump to the area that gave raise to the invention of (a formal theory of) graphs  Questions like  “Can I travel from a to b?”  “Can I go travel a to b without going anywhere twice?”  “What’s the quickest route from a to b?”

113 LOGO 113

114 LOGO 114 Connectivity  In an undirected graph, a path of length n from u to v is a sequence of adjacent edges going from vertex u to vertex v.  A path is a circuit if u=v.  A path traverses the vertices along it.  A path is simple if it contains no edge more than once.

115 LOGO 115 Connectedness  An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph.

116 LOGO 116 Connectedness  An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph.  Theorem: There is a simple path between any pair of vertices in a connected undirected graph.

117 LOGO 117 Directed Connectedness  A directed graph is strongly connected iff there is a directed path from a to b for any two verts a and b.

118 LOGO 118 Directed Connectedness  A directed graph is strongly connected iff there is a directed path from a to b for any two verts a and b.  It is weakly connected iff the underlying undirected graph (i.e., with edge directions removed) is connected.

119 LOGO 119 Paths & Isomorphism  Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism.

120 LOGO 120

121 LOGO 121 Euler & Hamilton Paths  We’ll show you the problem that prompted Euler to invent the theory of graphs: the bridges of Koenigsberg (town later called Kaliningrad)

122 LOGO 122 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start?

123 LOGO 123 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start? Can you model the situation using a graph? A B C D The original problem

124 LOGO 124 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start? A B C D The original problem Equivalent multigraph

125 LOGO 125 Euler & Hamilton Paths Terminology:  An Euler circuit in a graph G is a simple circuit containing every edge of G.  An Euler path in G is a simple path containing every edge of G.

126 LOGO 126 Bridges of Koenigsberg  Bridges are edges. So the answer to the problem is YES iff its graph contains an Euler circuit.  In fact, it does not …

127 LOGO 127 Euler Path Theorems  Theorem: A finite connected multigraph has an Euler circuit iff each vertex has even degree.  Proof: (→) The circuit contributes 2 to degree of each node. (←) By construction using algorithm on p. 580-581  Theorem: A connected multigraph has an Euler path iff it has exactly 2 vertices of odd degree.  One is the start, the other is the end.

128 LOGO 128 Not all edges have even degree … so there is no Euler circuit. A B C D The original problem Equivalent multigraph

129 LOGO 129 Euler Circuit theorem  Sketch of proof that even degree implies existence of Euler circuit:  Start with any arbitrary node. Construct simple path from it till you get back to start. (Graph is connected; every node has even degree, so you can leave any node that you have entered)  Repeat for each remaining subgraph, splicing results back into original cycle. Finiteness of graph implies that this process must end.  Note that the complete version of this proof provides an algorithm: it’s a constructive proof of an existential proposition

130 LOGO 130 Hamilton Paths  An Euler circuit in a graph G is a simple circuit containing every edge of G.  An Euler path in G is a simple path containing every edge of G.  A Hamilton circuit is a circuit that traverses each vertex in G exactly once.  A Hamilton path is a path that traverses each vertex in G exactly once.

131 LOGO 131 Hamiltonian Path Theorems  Dirac’s theorem: If (but not only if) G is connected, simple, has n  3 vertices, and  v deg(v)  n/2, then G has a Hamilton circuit.  Ore’s corollary: If G is connected, simple, has n≥3 nodes, and deg(u)+deg(v)≥n for every pair u,v of non-adjacent nodes, then G has a Hamilton circuit.

132 LOGO  You will learn about the following topics in graphs later in other courses:  shortest-path problem  Graph coloring 132

133 LOGO Good Luck


Download ppt "LOGO.  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton."

Similar presentations


Ads by Google