Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Graphs Intro Notes Definition: A graph is an object consisting of two sets, called its vertex set and its edge set. The vertex set is a finite nonempty set. The edge set is made up of two-element subsets of the vertex set. Example: The graph G with vertex set P, Q, R, S, T, U and edge set P, Q, Q, R, P, R, S, U. We can visualize the graph as either of the pictures below. Example: The graph H has vertex set a, b, c, d, e and edge set ∅. Picture: Example Graph J has vertex set 1, 2, 3, 4, 5 and edge set 1, 2, 1, 3, 1, 4, 1, 5, 2, 3, 2, 4, 2, 5, 3, 4, 3, 5, 4, 5. The two pictures below show different representations of J. or We call the elements of the edge set EDGES and the elements of the vertex set VERTICES (singular, vertex). For a graph G, we will let v the number of vertices in G and e the number of edges in G. 1 2 Definitions: We say that the edge X, Y connects the vertices X and Y. We say two vertices X and Y are adjacent if there is an edge X, Y connecting them. We say an edge X, Y is incident to X and incident to Y. When two edges share a common vertex, we say the two edges are adjacent. A vertex that has no edges incident to it is called isolated. The degree of a vertex is the number of edges incident to it. Examples: In the graph G, T is an isolated vertex. P and Q are adjacent because there is an edge connecting them. P and S are not adjacent. S, U is incident to S and to U. Since P, Q and Q, R are both incident to Q, we say P, Q and Q, R are adjacent. P, Q, and R each have degree of 2. S and U are both of degree 1. T has degree 0. The graph H is made up entirely of isolated vertices. They all have degree 0. In the graph J, every vertex is adjacent because there is an edge connecting every pair of vertices. Note this is an example of a COMPLETE GRAPH, a graph that has every possible edge in it. The degree of every vertex is 4. Note: For now, we will not consider any graphs with multiple edges between vertices. Later we will come back to these. According to our book, a graph with multiple edges between vertices is called a MULTIGRAPH. We should also note that when two edges cross each other, they don’t have to cross at a vertex. Every graph can be re-imagined in three dimensions so that no edges cross. Example: Let us consider the graph with vertex set A, B, C, D and edge set A, B, B, C, B, D, C, D. Draw a diagram to represent the graph. Then list the degree of each vertex. Solution: Degree of A1 Degree of B3 Degree of C2 Degree of D2. 3 Creating graphs from real world examples: There are four girls and four boys in a group, Meg, Ginger, Betty, Veronica, Reggie, Moose, Jughead, and Archie. Recently, Meg has dated Moose, Ginger has dated Moose and Jughead, Betty has dated Reggie, Moose and Jughead, and Veronica has been dating Archie. Create a graph with each of the teenagers as a vertex and an edge between any two vertices that have dated. Vertex set Meg, Ginger, Betty, Veronica, Reggie, Moose, Jughead, Archie. Edge set {{Meg, Moose}, {Ginger, Moose},{Ginger, Jughead},{Betty, Reggie}, {Betty, Moose}, {Betty, Jughead}, {Veronica, Archie}}. Diagram: What is the significance of the degree of a vertex? Tells you how many people that person has dated. Another Example: The schedule for the DCPA for a weekend features a symphony concert on Friday and Saturday nights, a Shakespeare play on Thursday and Friday night and Sunday afternoon, a comedy on Friday, Saturday, and Sunday nights, and a musical on Saturday night, Sunday afternoon, and Sunday night. Create a graph that can describe which events are on which nights. Can you propose a schedule of which events to attend which night so you can see all 4 events once? 4