lect21-more-graphs

# Lect21-more-graphs - Lecture Notes CMSC 251 Observe that directed graphs and undirected graphs are different(but similar objects mathematically

This preview shows pages 1–2. Sign up to view the full content.

Lecture Notes CMSC 251 Observe that directed graphs and undirected graphs are different (but similar) objects mathematically. Certain notions (such as path) are deﬁned for both, but other notions (such as connectivity) are only deﬁned for one. In a digraph, the number of edges coming out of a vertex is called the out-degree of that vertex, and the number of edges coming in is called the in-degree . In an undirected graph we just talk about the degree 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 the out-degree of each vertex, and thus we have Observation: For a digraph G =( V,E ) , X v V in-deg ( v )= X v V out-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 we have Observation: For an undirected graph G =( V,E ) , X v V deg ( 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 deﬁned vertices, edges, and the notion of degrees of vertices. Today we continue this discussion. Recall that graphs and digraphs both consist of two objects, a set of vertices and a set of edges. For graphs edges are 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 a sequence of vertices h v 0 ,v 1 ,...,v k i such that ( v i - 1 ,v i ) is an edge for i =1 , 2 ,...,k . The length of the 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 all vertices (except possibly the ﬁrst and last) are distinct. A cycle in a digraph is a path containing at least one edge and for which v 0 = v k . A cycle is simple if, in addition, v 1 ,...,v k are distinct. (Note: A self-loop counts as a simple cycle of length 1). In undirected graphs we deﬁne path and cycle exactly the same, but for a simple cycle we add the requirement that the cycle visit at least three distinct vertices. This is to rule out the degenerate cycle h u, w, u i , which simply jumps back and forth along a single edge. There are two interesting classes cycles. A

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

### Page1 / 4

Lect21-more-graphs - Lecture Notes CMSC 251 Observe that directed graphs and undirected graphs are different(but similar objects mathematically

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

View Full Document
Ask a homework question - tutors are online