DOC PREVIEW
UMD CMSC 351 - Lecture 19: Second Midterm Exam

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture Notes CMSC 251Lecture 19: Second Midterm Exam(Tuesday, April 7, 1998)Second midterm exam today. No lecture.Lecture 20: Introduction to Graphs(Thursday, April 9, 1998)Read: Sections 5.4, 5.5.Graph Algorithms: For the next few weeks, we will be discussing a number of various topics. One involvesalgorithms on graphs. Intuitively, a graph is a collection of vertices or nodes, connected by a collectionof edges. Graphs are very important discrete structures because they are a very flexible mathematicalmodel for many application problems. Basically, any time you have a set of objects, and there is some“connection” or “relationship” or “interaction” between pairs of objects, a graph is a good way to modelthis. Examples of graphs in application include communication and transportation networks, VLSI andother sorts of logic circuits, surface meshes used for shape description in computer-aided design andgeographic information systems, precedence constraints in scheduling systems. The list of applicationis almost too long to even consider enumerating it.Most of the problems in computational graph theory that we will consider arise because they are ofimportance to one or more of these application areas. Furthermore, many of these problems form thebasic building blocks from which more complex algorithms are then built.Graphs and Digraphs: A directed graph (or digraph) G =(V,E) consists of a finite set of vertices V (alsocalled nodes) and E is a binary relation on V (i.e. a set of ordered pairs from V ) called the edges.For example, the figure below (left) shows a directed graph. Observe that self-loops are allowed bythis definition. Some definitions of graphs disallow this. Multiple edges are not permitted (althoughthe edges (v, w) and (w, v) are distinct). This shows the graph G =(V,E) where V = {1, 2, 3} andE = {(1, 1), (1, 2), (2, 3), (3, 2), (1, 3)}.GraphDigraph2432131Figure 18: Digraph and graph example.In an undirected graph (or just graph) G =(V,E) the edge set consists of unordered pairs of distinctvertices (thus self-loops are not allowed). The figure above (right) shows the graph G =(V,E), whereV = {1, 2, 3, 4} and the edge set is E = {{1, 2}, {1, 3}, {1, 4}, {2, 4}, {3, 4}}.We say that vertex w is adjacent to vertex v if there is an edge from v to w. In an undirected graph, wesay that an edge is incident on a vertex if the vertex is an endpoint of the edge. In a directed graph wewill often say that an edge either leaves or enters a vertex.A digraph or undirected graph is said to be weighted if its edges are labelled with numeric weights. Themeaning of the weight is dependent on the application, e.g. distance between vertices or flow capacitythrough the edge.60Lecture Notes CMSC 251Observe that directed graphs and undirected graphs are different (but similar) objects mathematically.Certain notions (such as path) are defined for both, but other notions (such as connectivity) are onlydefined for one.In a digraph, the number of edges coming out of a vertex is called the out-degree of that vertex, andthe number of edges coming in is called the in-degree. In an undirected graph we just talk about thedegree of a vertex, as the number of edges which are incident on this vertex. By the degree of a graph,we usually mean the maximum degree of its vertices.In a directed graph, each edge contributes 1 to the in-degree of a vertex and contributes one to theout-degree of each vertex, and thus we haveObservation: For a digraph G =(V,E),Xv∈Vin-deg(v)=Xv∈Vout-deg(v)=|E|.(|E|means the cardinality of the set E, i.e. the number of edges).In an undirected graph each edge contributes once to the outdegree of two different edges and thus wehaveObservation: For an undirected graph G =(V,E),Xv∈Vdeg(v)=2|E|.Lecture 21: More on Graphs(Tuesday, April 14, 1998)Read: Sections 5.4, 5.5.Graphs: Last time we introduced the notion of a graph (undirected) and a digraph (directed). We definedvertices, edges, and the notion of degrees of vertices. Today we continue this discussion. Recall thatgraphs and digraphs both consist of two objects, a set of vertices and a set of edges. For graphs edgesare undirected and for graphs they are directed.Paths and Cycles: Let’s concentrate on directed graphs for the moment. A path in a directed graph is asequence of vertices hv0,v1,...,vkisuch that (vi−1,vi)is an edge for i =1,2,...,k. The length ofthe path is the number of edges, k. We say that w is reachable from u if there is a path from u to w.Note that every vertex is reachable from itself by a path that uses zero edges. A path is simple if allvertices (except possibly the first and last) are distinct.A cycle in a digraph is a path containing at least one edge and for which v0= vk. A cycle is simple if,in addition, v1,...,vkare distinct. (Note: A self-loop counts as a simple cycle of length 1).In undirected graphs we define path and cycle exactly the same, but for a simple cycle we add therequirement that the cycle visit at least three distinct vertices. This is to rule out the degenerate cyclehu, w, ui, which simply jumps back and forth along a single edge.There are two interesting classes cycles. A Hamiltonian cycle is a cycle that visits every vertex in agraph exactly once. A Eulerian cycle is a cycle (not necessarily simple) that visits every edge of agraph exactly once. (By the way, this is pronounced “Oiler-ian” and not “Yooler-ian”.) There are also“path” versions in which you need not return to the starting


View Full Document

UMD CMSC 351 - Lecture 19: Second Midterm Exam

Download Lecture 19: Second Midterm Exam
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 19: Second Midterm Exam and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 19: Second Midterm Exam 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?