Lecture 8 -Graphs - Graphs(Computer Science Notes Graphs A...

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

View Full Document Right Arrow Icon
Graphs (Computer Science Notes) Graphs A graph consists of a set of nodes V (also called vertices) and a set of edges E We’ll sometimes refer to the graph as a pair of sets (V,E). Each edge in E joins two nodes in V Two nodes connected by an edge are called neighbors or adjacent Example involving cities and the edge of roads connecting them (1): A graph edge can be traversed in both directions, as in this street example, i.e. the edges are undirected When there is only one edge connecting two vertices x and y, we can name the edge using the pair of vertices A graph is called a simple graph if it has neither multiple edges nor loop edges Degrees The degree of a vertex v, written deg(v) is the number of edges which have v as an endpoint. Self-loops, if you are allowing them, count twice For example, in the following graph, a has degree 2, b has degree 6, d has degree 0, and so forth
Background image of page 1

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

View Full DocumentRight Arrow Icon
Complete Graphs First, the complete graph on n vertices (shorthand name Kn), is a graph with n vertices in which every vertex is connected to every other vertex. K5 is shown below To calculate the number of edges in Kn, think about the situation from the perspective of the first vertex Cycles and Wheels Suppose that we have n vertices named v1, . . . , vn, where n >= 3. Then the cycle Cn is the graph with these vertices and edges connecting vi to vi+1, plus an additional edge from vn to v1 Cn has n vertices and also n edges. Cycle graphs often occur in networking applications. They could also be used to model games like “telephone” where people sit in a circle and
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/16/2011 for the course CS 173 taught by Professor Erickson during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 5

Lecture 8 -Graphs - Graphs(Computer Science Notes Graphs A...

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

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