[Hernandez 1213A] Cs30 day17

Page 1

An Introduction Terminology

CS 30 : Discrete Mathematics for Computer Science First Semester, AY 2012-2013

https://sites.google.com/a/dcs.upd.edu.ph/nhsh_classes/cs 30

sablay-logo

Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman nshernandez@dcs.upd.edu.ph updilseal

Day 17

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph Theory

1

An Introduction

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph Theory

1

An Introduction

2

Terminology Undirected Graphs Directed Graphs Special Types of Graph

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Imagine an organization that wants to set up teams of three to work on some projects. In order to maximize the number of people on each team who had previous experience working together successfully, the director asked the members to provide names of their past partners. This information is displayed below.

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Imagine an organization that wants to set up teams of three to work on some projects. In order to maximize the number of people on each team who had previous experience working together successfully, the director asked the members to provide names of their past partners. This information is displayed below.

Name Ana Bev Cai Dan Ed Flo Gia Hal Ira

sablay-logo

PastPartners Dan, Flo Cai , Flo , Hal Bev , Flo Ana, Ed Dan, Hal Cai , Bev , Ana Hal Gia, Ed , Bev , Ira Hal

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Imagine an organization that wants to set up teams of three to work on some projects. In order to maximize the number of people on each team who had previous experience working together successfully, the director asked the members to provide names of their past partners. This information is displayed below.

Name Ana Bev Cai Dan Ed Flo Gia Hal Ira

sablay-logo

PastPartners Dan, Flo Cai , Flo , Hal Bev , Flo Ana, Ed Dan, Hal Cai , Bev , Ana Hal Gia, Ed , Bev , Ira Hal

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

De nition A graph G consists of two nite sets: a nonempty set V (G ) of vertices and a set E (G ) of edges , where each edge is associated with a set consisting of either one or two vertices called its endpoints .

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

De nition A graph G consists of two nite sets: a nonempty set V (G ) of vertices and a set E (G ) of edges , where each edge is associated with a set consisting of either one or two vertices called its endpoints . An edge with just one endpoint is called a loop , and two or more distinct edges with the same set of endpoints are said to be parallel . updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

De nition A graph G consists of two nite sets: a nonempty set V (G ) of vertices and a set E (G ) of edges , where each edge is associated with a set consisting of either one or two vertices called its endpoints . An edge with just one endpoint is called a loop , and two or more distinct edges with the same set of endpoints are said to be parallel . An edge is said to connect its endpoints; two vertices that are connected by an edge are called adjacent ; and a vertex that is an endpoint of a loop is said to be adjacent to itself.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

De nition A graph G consists of two nite sets: a nonempty set V (G ) of vertices and a set E (G ) of edges , where each edge is associated with a set consisting of either one or two vertices called its endpoints . An edge with just one endpoint is called a loop , and two or more distinct edges with the same set of endpoints are said to be parallel . An edge is said to connect its endpoints; two vertices that are connected by an edge are called adjacent ; and a vertex that is an endpoint of a loop is said to be adjacent to itself. An edge is said to be incident on each of its endpoints, and two edges incident on the same endpoint are called adjacent . A vertex on which no edges are incident is called isolated . Discrete Mathematics for Computer Science

CS 30

updilseal

dcs-logo

acl-logo


An Introduction Terminology

Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

sablay-logo

Graphs G (V , E ) and G (V ∗ , E ∗ ) are said to be isomorphic if there exists a one-to-one correspondence f : V → V ∗ such that {u , v } is an edge of G if and only if {f (u ), f (v )} is an edge of G ∗ .

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Which of these graphs are isomorphic?

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

directed graph, or digraph, consists of two nite sets: a nonempty set V (G ) of vertices and a set D (G ) of directed edges, where each is associated with an ordered pair of vertices called its endpoints . If edge e is associated with the pair (v , w ) of vertices, then e is said to be the (directed ) edge from v to w .

A

sablay-logo

Note that each directed graph has an associated undirected graph, which is obtained by ignoring the directions of the edges.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph to Represent a Network Telephone, electric power, gas pipeline, and air transport systems can all be represented by graphs, as can computer networks - - - from small local area networks to the global Internet system that connects millions of computers worldwide. Questions that arise in the design of such systems involve choosing connecting edges to minimize cost, optimize a certain type of service, and so forth. A typical network, called a hub and spoke model, is shown below.

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph to Represent the WWW

The World Wide Web, is a system of interlinked documents, or webpages, contained on the Internet. Users employing Web browsers, such as Internet Explorer, Google Chrome, Apple Safari, and Opera, can move quickly from one webpage to another by clicking on hyperlinks, which use versions of software called hypertext transfer protocols (HTTPs). Individuals and individual companies create the pages, which they transmit to servers that contain software capable of delivering them to those who request them through a Web browser. Because the amount of information currently on the Web is so vast, search engines, such as Google, Yahoo, and Bing, have algorithms for nding information very e ciently.

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph to Represent the WWW The picture below shows a minute fraction of the hyperlink connections on the Internet that radiate in and out from the Wikipedia main page.

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Graph to Represent Knowledge In many applications of arti cal intelligence, a knowledge base of information is collected and represented inside a computer. The directed graph shown below is a pictorial representation for a simpli ed knowledge base about periodical publications.

sablay-logo

updilseal

dcs-logo

According to this knowledge base, what paper nish does the New York Times use? Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Niche Overlap Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Niche Overlap Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

An Acquaintanceship Graph

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

An Acquaintanceship Graph

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

In uence Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

In uence Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Round-Robin Tournaments

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Round-Robin Tournaments

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Call Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Call Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Precedence Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Precedence Graphs

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Graph

sablay-logo

A graph G consists of two nite sets: a nonempty set V (G ) of vertices and a set E (G ) of edges , where each edge is associated with a set consisting of either one or two vertices called its endpoints .

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Order and Size

sablay-logo

The number of vertices in a graph number of edges is its size .

G (V , E ) is called its order , and the

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Adjacent Vertices

sablay-logo

Two vertices vi and vj are said to be {vi , vj } in the graph G (V , E ).

adjacent if there exists an edge

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Adjacent Edges

sablay-logo

Two edges incident on the same vertex are said to be

adjacent .

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Parallel Edges

sablay-logo

If there is more than one edge between the same pair of vertices, then the edges are termed as parallel edges .

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Loop

sablay-logo

An edge whose starting and ending vertex are the same is known as a loop.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Simple Graph

sablay-logo

A graph G (V , E ) that has no loops or parallel edges is called a simple graph.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Multigraph

sablay-logo

A graph

G (V , E ) is known as a multigraph if it contains parallel edges.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Pseudograph

sablay-logo

A graph G (V , E ) is known as a edges and loops.

pseudograph if we allow both parallel

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Degree of a Vertex

sablay-logo

The number of edges incident on the vertex vertex v , deg (v ).

v is known as the degree of

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Isolated Vertex

sablay-logo

A vertex is said to be an isolated vertex if there is no edge connected from any other vertex to the vertex, that is, its degree is zero.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Pendant Vertex

sablay-logo

A vertex

v in a graph G is said to be a pendant vertex if deg (v ) = 1.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph?

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

The total degree of a graph is even. updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

The total degree of a graph is even. In any graph there are an even number of vertices of odd degree. updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

The total degree of a graph is even. In any graph there are an even number of vertices of odd degree. Does a graph with four vertices of degree 1,1,2, and 3 exist?

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

The total degree of a graph is even. In any graph there are an even number of vertices of odd degree. Does a graph with four vertices of degree 1,1,2, and 3 exist? Does a graph with four vertices of degree 1,1,3, and 3 exist?

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of an undirected graph? If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. That is, if G (V , E ) is an undirected graph with e edges then 2e =

X

v ∈V

sablay-logo

deg (v )

The total degree of a graph is even. In any graph there are an even number of vertices of odd degree. Does a graph with four vertices of degree 1,1,2, and 3 exist? Does a graph with four vertices of degree 1,1,3, and 3 exist? Does a simple graph with four vertices of degree 1,1,3, and 3 exist?

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Digraph

directed graph, or digraph, consists of two nite sets: a nonempty set V (G ) of vertices and a set D (G ) of directed edges, where each is associated with an ordered pair of vertices called its endpoints . If (vi , vj ) is an edge, then there is an edge from the vertex vi to the vertex vj .

A

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Degree of a Vertex

The in − degree of a vertex v , denoted by deg − (v ), is the number of edges with v as their terminal vertex. The out − degree of a vertex v , denoted by deg + (v ), is the number of edges with v as their initial vertex. (Note that a loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex.)

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Isolated and Pendant Vertices

v in a digraph G is said to be an isolated vertex if deg − (v ) = 0 = deg + (v ). A vertex v in a digraph G is said to be a pendant vertex if deg − (v ) = 1 and deg + (v ) = 0 A vertex

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of a directed graph?

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

What do we get when we add the degrees of all the vertices of a directed graph?

Let

G (V , E ) be a directed graph. Then X

v ∈V

deg − (v ) =

X

v ∈V

sablay-logo

deg + (v ) = |E |

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Complete Graphs A graph is said to be complete if each vertex vertex v in G.

u is adjacent to every other

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Complete Graphs A graph is said to be complete if each vertex vertex v in G.

u is adjacent to every other

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Complete Graphs A graph is said to be complete if each vertex vertex v in G.

u is adjacent to every other

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Cycles

The cycle Cn : V = {1, 2, . . . , n}, E = {{i , i + 1} : i = 1, 2, . . . , n − 1} ∪ {{1, n}}

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Wheels

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

The path Pn :

V

Undirected Graphs Directed Graphs Special Types of Graph

= {0, 1, 2, . . . , n}, E = {{i − 1, i } : i = 1, 2, . . . , n − 1}

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Complete Bipartite Graphs The complete bipartite graph Kn,m : V = {u1 , . . . , un } âˆŞ {v1 , . . . , vm }, E = {{ui , vj } : i = 1, 2, . . . , n, j = 1, 2, . . . , m}

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Complete Bipartite Graphs The complete bipartite graph Kn,m : V = {u1 , . . . , un } âˆŞ {v1 , . . . , vm }, E = {{ui , vj } : i = 1, 2, . . . , n, j = 1, 2, . . . , m}

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Hypercubes

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Regular Graph

A graph is said to be regular if the degree of every vertex are equal.

sablay-logo

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Undirected Graphs Directed Graphs Special Types of Graph

Acyclic Graph

sablay-logo

A graph which does not have any cycle is known as an acyclic graph.

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


An Introduction Terminology

Questions?

sablay-logo

See you next meeting!

updilseal

dcs-logo

Discrete Mathematics for Computer Science

CS 30

acl-logo


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.