# Discrete Mathematics Dr.-Ing. Erwin Sitompul

## Presentation on theme: "Discrete Mathematics Dr.-Ing. Erwin Sitompul"— Presentation transcript:

Discrete Mathematics Dr.-Ing. Erwin Sitompul
Lecture 9 6. GRAPHS Discrete Mathematics Dr.-Ing. Erwin Sitompul

Homework 8 A chairperson and a treasurer of PUMA IE should be chosen out of 50 eligible association members. In how many ways can a chairperson and a treasurer can be elected, if: (a) There is no limitation. (b) Amir wants to serve only if elected as a chairperson. (c) Budi and Cora want to be elected together or not at all. (d) Dudi and Encep do not want to work together. The position of chairperson and treasurer are different. The sequence of election must be considered. The problem in this homework is a permutation problem.

Solution of Homework 8 (a) There is no limitation.
(b) Amir wants to serve only if elected as a chairperson. Amir is not elected as chairperson an thus does not want to serve; the 2 positions will now be filled by the remaining 49 members Amir is elected as chairperson, with 49 ways to fill the treasurer position

Solution of Homework 8 (c) Budi and Cora want to be elected together or not at all. The wish of Budi and Cora does not come true; and from the remaining 48 members, 2 people will be elected to fill the positions Budi and Cora are elected together

Solution of Homework 8 (d) Dudi and Encep do not want to work together. Dudi and Encep are not elected, whether as chairperson or treasure Dudi elected as treasurer, Encep not elected as chairperson Encep elected as treasurer, Dudi not elected as chairperson Encep elected as chairperson, Dudi not elected as treasurer Dudi elected as chairperson, Encep not elected as treasurer Events where Dudi and Encep work together All possible ways to elect

Definition of Graph A graph is an abstract representation of a set of discrete objects where some pairs of the objects are connected by links. The figure below shows a graph that represents a map of road network that connects a number of cities in Central Java.

Bridges of Königsberg (Euler, 1736)
Can someone pass every bridge exactly once and come back the his/her original position? A graph can be used to represent the Königsberg bridge: Vertex  represents a dry land Arc or edge  represents a bridge

Graph Representation Graph G = (V,E) where:
V = Set of vertices, may not be a null set = {v1,v2,...,vn} E = Set of edges, each connecting a pair of vertices = {e1,e2,...,en}

Graph Representation G1 G1 is a graph with V = {1,2,3,4}
Simple graph

Graph Representation G2 G2 is a graph with V = {1,2,3,4}
= {e1,e2,e3,e4,e5,e6,e7} G2 Multigraph

Graph Representation G3 G3 is a graph with V = {1,2,3,4}
= {e1,e2,e3,e4,e5,e6,e7,e8} G3 Pseudograph

Graph Classification Based on the existence of loop or multiple edges, a graph can be classified into: 1. Simple graph, if the graph does not have any loop or double edge. 2. Unsimple graph, if the graph has any loop or double edge.

Graph Classification Based on the orientation of the edges, a graph can be classified into 2 types: 1. Undirected graph, if the edges are directed. 2. Directed graph or digraph, if all the edges are directed.

Graph Applications Program Analysis t:=0; read(x);
while x <> 1945 do begin if x < 0 then writeln(‘Year may not be negative.’); else t:=t+1; end; writeln(‘Guessed after’,t,’attempts.’); 1 : t:=0 2 : read(x) 3 : x <> 1945 4 : x < 0 5 : writeln(‘Year...’) 6 : t:=t+1 7 : read(x) 8 : writeln(‘Guessed...)

The price of 1 bottle drink is 45 cent
Graph Applications Automata Theory in a Vending Machine D : Dime (10 cent) Q : Quarter (25 cent) The price of 1 bottle drink is 45 cent

Two vertices are said to be adjacent if they are directly connected through an edge. Observe graph G1: Vertex 1 is adjacent with vertex 2 and 3. Vertex 1 is not adjacent to vertex 4. G1

Graph Terminology 2. Incidence G1
For any edge e = (vj,vk), it is said that e is incident to vertex vj , and e is incident to vertex vk . Observe graph G1: Edge (2,3) is incident to vertex 2 and vertex 3. Edge (2,4) is incident to vertex 2 and vertex 4. Edge (1,2) is not incident with vertex 4. G1

Graph Terminology 3. Isolated Vertex G4
A vertex is called isolated vertex if it does not have any edge incident to it. Observe graph G4: Vertex 5 is an isolated vertex. G4

Graph Terminology 4. Empty Graph (Null Graph) G5
An empty graph is a graph whose set of edges is a null set. Observe graph G5: It is an empty graph (null graph). G5

Graph Terminology 5. Degree of Vertex G1
The degree of a vertex is the number of edges incident to the vertex itself. Notation: d(v). Observe graph G1: d(1) = d(4) = 2. d(2) = d(3) = 3. G1

Graph Terminology G4 G6 Observe graph G4: d(5) = 0  isolated vertex
d(4) = 1  pendant vertex Observe graph G6: d(1) = 3  incident to double edges d(3) = 4  incident to a loop G4 G6

Graph Terminology In a directed graph: din(v) = in-degree
= number of arcs arriving to a vertex dout(v) = out-degree = number of arcs departing from a vertex d(v) = din(v) + dout(v)

Graph Terminology G7 Observe graph G7: din(1) = 2 dout(1) = 1

Graph Terminology Handshake Lemma G1
The sum of the degree of all vertices in a graph is an even number; that is, twice the number of edges in the graph. In other words, if G = (V, E), then Observe graph G1: d(1) + d(2) + d(3) + d(4) = = 2  number of edges = 2  5 G1

Graph Terminology G4 G6 Observe graph G4:
d(1) + d(2) + d(3) + d(4) + d(5) = = 2  number of edges = 2  4 Observe graph G6: d(1) + d(2) + d(3) = = 2  number of edges = 2  5 G4 G6

Graph Terminology Example: Solution:
A graph has five vertices. Can you draw the graph if the degree of the vertices are: (a) 2, 3, 1, 1, and 2? (b) 2, 3, 3, 4, and 4? Solution: (a) No, because = 9, is an odd number. (b) Yes, because = 16, is an even number.

Graph Terminology 6. Path G1
A path with length n from vertex of origin v0 to vertex of destination vn in a graph G is the alternating sequence of vertices and edges in the form of v0, e1, v1, e2, v2, ..., vn –1, en, vn such that e1 = (v0, v1), e2 = (v1, v2), ..., en = (vn–1, vn) are the edges of graph G. The length of a path is determined by the number of edges in that path. Observe graph G1: Path 1, 2, 4, 3 is a path with edge sequence of (1,2), (2,4), and (4,3). The length of path 1, 2, 4, 3 is 3. G1

Graph Terminology 7. Circuit G1
A path that starts and finishes at the same vertex is called a circuit. Observe graph G1: Path 1, 2, 3, 1 is a circuit. The length of the circuit 1, 2, 3, 1 is 3. G1

Graph Terminology 8. Connectivity
Two vertices v1 and v2 is said to be connected if there exists at least one path from v1 to v2. A graph G is said to be a connected graph if for every pair of vertices vi and vj of set V there exists at least one path from vi to vj. If not, then G is said to be disconnected graph. Example of a disconnected graph:

Graph Terminology A directed graph G is said to be connected if its non-directed graph is connected (Note: the non-directed graph of a directed graph G is obtained by omitting all arrow heads). Two vertices, u and v, in a directed graph G are said as strongly connected vertices if there exists a directed path from u to v and also from v to u. If u and v are not strongly connected vertices but the non-directed graph of G is a connected one, then u and v are said as weakly connected vertices.

Weakly connected graph Strongly connected graph
Graph Terminology Directed graph G is said as strongly connected graph if every possible pair of vertices u and v in G is strongly connected. If not, then G is said to be a weakly connected graph. Weakly connected graph Strongly connected graph

Complement of the subgraph
Graph Terminology 9. Subgraph and Subgraph Complement Suppose G = (V,E) is a graph, then G1 = (V1,E1) is a subgraph of G if V1  V and E1  E. Complement of subgraph G1 in regard to graph G is the graph G2 = (V2,E2) such that E2 = E – E1 and V2 is the set of all vertices incident to members of E2. Complement of the subgraph G8 A subgraph of G8

A spanning subgraph of G9 Not a spanning subgraph of G9
Graph Terminology 10. Spanning Subgraph Subgraph G1 = (V1,E1) of G = (V,E) is said to be a spanning subgraph if V1 = V; that is if G1 contains all vertices of G. G9 A spanning subgraph of G9 Not a spanning subgraph of G9

G10 without the cut set, becomes a disconnected graph
Graph Terminology 11. Cut Set Cut set of a connected graph G is a set of edges of G that can decides whether G is connected or not. If these edges are omitted, then G will be disconnected. For the graph G10 below, {(1,2),(1,5),(3,5),(3,4)} belong to the cut set. G10 G10 without the cut set, becomes a disconnected graph

G10 without the cut set, becomes a disconnected graph
Graph Terminology The number of cut sets of a connected graph can be more than one. For instance, the sets {(1,2),(2,5)}, {(1,3),(1,5),(1,2)} and {(2,6)} are also the cut set of G10. {(1,2),(2,5),(4,5)} is not a cut set because its subset, {(1,2),(2,5)} is already a cut set. G10 G10 without the cut set, becomes a disconnected graph

Graph Terminology 12. Weighted Graph
A weighted graph is a graph whose edges are given weighting numbers.

Homework 9 Graph G Graph G is given by the figure below.
(a) List all possible paths from A to C. (b) List all possible circuits. (c) Write down at least 4 cut sets of the graph. (d) Draw the subgraph G1 = {B,C,X,Y}. (e) Draw the complement of subgraph G1. Graph G

Homework 9 New Graph H Graph H1 Observe graph H below.
(a) List all possible paths from b to c. (b) List all possible circuits. (c) Write down at least 4 cut sets of the graph. (d) Draw the complement of subgraph H1 with regard to H. (e) Draw a spanning subgraph of H. Graph H Graph H1