14. Graphs 1 - basics

14. Graphs 1 - basics - Maggie Johnson Handout#14 CS103B...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Maggie Johnson Handout #14 CS103B Graph Theory: The Basics Key Topics * Introduction * Graph Lingo * Some Special Graphs * Applications of Special Graphs * Graph Isomorphism * Graph Traversals * Stable Marriage Problem _______________________________________________________________________________ A graph is a convenient representation that you may have encountered in 103A when you discussed relations. A graph is characterized by a many-to-many relationship between its elements. Some pictures of graphs: A simple graph G = (V,E) consists of V, a nonempty set of vertices or nodes (the dots); and E, a (possibly empty) set of unordered pairs of distinct elements of V called edges (the lines). Simple graphs are often used to represent network models (models with many-many links between elements) where the only required information is the location of the connections: A directed graph ( digraph ) G = (V,E) consists of V, a nonempty set of vertices or nodes; and E, a set of ordered pairs of distinct elements of V called edges. 1 2 3 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Directed graphs are also used to model networks where the direction of the connections is important. A multigraph G = (V,E) consists of V, a nonempty set of vertices; and E, a set of unordered pairs of distinct elements of V called edges. Multiple edges between two vertices are allowed in a multigraph. Multigraphs are used to model situations where there is more than one connection between two vertices. For example, a flight map may have several flights between two cities: A directed multigraph G = (V,E) consists of V, a nonempty set of vertices; and E, a set of ordered pairs of distinct elements of V called edges. Multiple edges between two vertices are allowed in a multigraph. Finally, a pseudograph is an undirected multigraph with loops: To summarize then, pseudographs are the most general type of graphs since they may contain loops and multiple edges. Multigraphs come next allowing multiple edges. Simple graphs allow neither. Graph Lingo
Background image of page 2
>>> Undirected Graphs: 1) Two vertices u and v in an undirected graph G are called adjacent (or neighbors) if {u,v} is an edge in G (note {} denotes unordered pair). If e is the edge connecting u and v, then e is said to be incident with vertices u and v, or e connects endpoints u and v. 2) The degree of a vertex in an undirected graph is the number of edges incident with it (a loop contributes twice to the degree of its vertex). The degree of vertex v is denoted deg(v). The degree of LAX in the multigraph above is 4; the degree of DEN is 6. 3) A vertex of degree 0 is called isolated . A vertex is pendant if it has degree 1. What do we get when we add the degrees of all the vertices of a graph? Each edge must contribute 2 to the total sum because each edge is incident with exactly two (possibly equal) vertices. This gives us the famous Handshaking Theorem: 4) Handshaking Theorem: The sum of the degrees of the vertices of any undirected graph is twice the number of edges. This theorem shows that the sum of the degrees of an undirected graph is always even.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

14. Graphs 1 - basics - Maggie Johnson Handout#14 CS103B...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online