You are on page 1of 9

Question 1: (a) Using Karnaugh map, simplify X': A'BC'D'+ ABC'D'+ A'BCD'+ ABCD' (8 Marks) ANS : X : ABCD + ABCD

+ ABCD + ABCD The above expression can be expressed karnaugh map as: CD CD 1 1! 1 CD 1 CD AB AB CD 1 1 CD 1 1

AB AB AB AB

Now, X: ABCD + ABCD) + (ABCD + ABCD) = ABD(C+C) + ABD(C+C) = ABD+ ABD (C+C=1) = BD (A+A) = BD (A+A) = BD (A+A = 1)

(b) If R is an equivalence relation on set A, prove that is also an equivalence relation. (4 Marks) ANS : Let R be an equivalence relation, on set A. R is reflexive, symmetric and transitive. Since R is reflexive. (a,b) R, a A (a,a) . is reflexive. ..............................(1) Since R is symmetric. (a,b) R (b,a) R , a, b Whenever (a,b) R. (b,a) Whenever (b,a) R. (a,b) A and

R (a,b) is symmetric. ..............................(2) Since R is transitive. (b,a) (a,b),(b,c) Now, (a,b) (b,a) R (a,c) R , a, b,c R (b,a) and A

R (c,d)

Thus, (c,b),(b,a) (c,a) . is transitive. ..............................(3) By (1) ,(2) & (3), is an equivalence relation. (c) Describe Konigsbergs 7 bridges problem and Euler's solution to it (8 Marks) ANS: Konigsbergs problem : Konigsberg, a city in Prussia had 7 bridges that crossed the pregel river. These bridges connected the two islands in the river with each other & with the opposite banks. The classic statement of the problem, given above, uses unidentified nodesthat is, they are all alike except for the way in which they are connected. There is a variation in which the nodes are identifiedeach node is given a unique name or color.

The northern bank of the river is occupied by the Schlo, or castle, of the Blue Prince; the southern by that of the Red Prince. The east bank is home to the Bishop's Kirche, or church; and on the small island in the center is a Gasthaus, or inn.

It is understood that the problems to follow should be taken in order, and begin with a statement of the original problem: It being customary among the townsmen, after some hours in the Gasthaus, to attempt to walk the bridges, many have returned for more refreshment claiming success. However, none have been able to repeat the feat by the light of day. 8: The Blue Prince, having analyzed the town's bridge system by means of graph theory, concludes that the bridges cannot be walked. He contrives a stealthy plan to build an eighth bridge so that he can begin in the evening at his Schlo, walk the bridges, and end at the Gasthaus to brag of his victory. Of course, he wants the Red Prince to be unable to duplicate the feat from the Red Castle. Where does the Blue Prince build the eighth bridge? 9: The Red Prince, infuriated by his brother's Gordian solution to the problem, wants to build a ninth bridge, enabling him to begin at his Schlo, walk the bridges, and end at the Gasthaus to rub dirt in his brother's face. As an extra bit of revenge, his brother should then no longer be able to walk the bridges starting and ending at his Schloss as before. Where does the Red Prince build the ninth bridge? 10: The Bishop has watched this furious bridge-building with dismay. It upsets the town's Weltanschauung and, worse, contributes to excessive drunkenness. He wants to build a tenth bridge that allows all the inhabitants to walk the bridges and return to their own beds. Where does the Bishop build the tenth bridge? Solutions :

The colored graph

Reduce the city, as before, to a graph. Color each node. As in the classic problem, no Euler walk is possible; coloring does not affect this. All four nodes have an odd number of edges.

The 8th edge 8: Euler walks are possible if exactly zero or two nodes have an odd number of edges. If we have 2 nodes with an odd number of edges, the walk must begin at one such node and end at the other. Since there are only 4 nodes in the puzzle, the solution is simple. The walk desired must begin at the blue node and end at the orange node. Thus, a new edge is drawn between the other two nodes. Since they each formerly had an odd number of edges, they must now have an even number of edges, fulfilling all conditions. This is a change in parity from an odd to even degree.

The 9th edge

The 10th edge 9: The 9th bridge is easy once the 8th is solved. The desire is to enable the red castle and forbid the blue castle as a starting point; the orange node remains the end of the walk and the white node is unaffected. To change the parity of both red and blue nodes, draw a new edge between them. 10: The 10th bridge takes us in a slightly different direction. The Bishop wishes every citizen to return to his starting point. This is an Euler cycle and requires that all nodes be of even degree. After the solution of the 9th bridge, the red and the orange nodes have odd degree, so their parity must be changed by adding a new edge between them.

Question 2: (a) Show that the sum of the degrees of all vertices of a graph is twice the number of edges in the graph. (4 Marks) ANS : A graph consists of a set of vertices and a set of edges. A vertex is usually denoted by a small circle while an edge is just a line drawn between two vertices. The diagram Graph #1 is a graph consisting of four vertices and three edges. This graph is called an undirected graph as all the edges have no direction(undirected edges). Graphs where undirected edges join the same the vertex are called Multi-edge graphs. This discussion will be confined to only simple graphs. In graph #1, we can denote all the vertices by the set V1= {

A,B,C,D}. The set of all edges can be denoted by E1={m,n,p}. This graph can then be denoted by G1. To be more explicit and to emphasize that the graph is composed of a vertex and edge sets, G1 can be writen as G1( V1, E1). The G1( V1, E1) can also be written more explicitely as G1( {A,B,C,D}, {m,n,p}).In an undirected graph, the degree of a node in a graph is the total number of edges that are incident on the node. For instance, in the G1 graph , the degree of node A is 2, while the degree of node D is zero. The total sum of all degrees of an undirected graph is equal to twice the number of edges. This is sometimes refered to as the Hand shaking Lemma. The proof is simply that every edge joins two nodes and increases the degree of each node by one. So, each edge increases the graphs total degree sum by two. It is called the Hand Shaking Lemma as it can be used to to solve the following problem. A group of people meet for the first time at a party. During the party, they mingle and meet others. Whenever one person meets another for the first time, they give each other a hand shake. At the end of the party, every person is asked the total number of handshakes he(or she) has given. The problem is to find find the total unique first time meetings. By using the the Hand Shaking Lemma, we can see that the total unique meetings is just the total number of handshakes divided by two. For Example, in G1 , if the vertices represents different people and each edge represents a hand shake, the total number of unique meetings is three, while the total count of all the handshakes that each person has given is six. A subgraph of a graph is a new graph that contains a subset of the vertices and edges from the original graph. Every edge must still join nodes of the new graph. There is no such thing as a half edge. For instance the graph ({ A,B,D},{n} ) is a subgraph of G1. A subgraph can be the empty graph ( { }, { } ). A sequences of edges and vertices that can be traveresed to go from one vertex to that of another is called a path. For instance, the path to go from vertex B to vertex C can be denoted by the sequence (B,n,A,m,C). Another path could be (B,n,A,n,B,p,C). Notice that this new path does a wasted trip to A and then back to B. To remove these wasted type paths, a Simple Path is a path such that no vertex or edge is found in the path sequence twice. Hence, in graph G1, the only two simple paths from B to C are (B,p,C) and (B,n,A,m,C). If a graph contains two nodes such that there are two distinct simple paths between one node and another, then the graph is said to contain a cycle. For instance, the graph G1 contains a cycle. If a graph does not contain a cycle, than it is called an acyclic graph. The length of a path is the total number of edges in a path sequence. For instance, the path sequence (A,m,C,p,B,n,A) has a path length of 3. Since the it starts and ends at the same vertex, the path is a cycle. A circuit is a path where the start vertex and destination vertex are the same.

A path in a graph is called an Euler Path, if the path contains every edge of the original graph. A path is called an Euler Circuit, if the path is an Euler Path that is a circuit. A Hamiltonian path is a path that in a graph that has all of the vertices of the graph. A Hamiltonian Circuit is an Hamiltonian path which is a circuit. A connected graph is one in which every vertex can be reached using some path from every other vertex. A graph that is not connected is called a disconnected graph. As we cannot reach vertex D from any other vertex in graph G1, the graph is not connected. It is a disconnected graph. An acyclic connected graph is called a free tree. If a subgraph of a connected graph is a tree that still connects all the vertices of the original graph, then the tree is called a spanning tree. A directed graph is one in which all the edges are directed. The graph #2 is a directed graph. Unlike undirected graphs, a directed graph may contain edges which start and end at the same vertex. The edge p is an example of such an edge(a self loop). But no two edges can be drawn with the same source and destination vertices. Symbolically, a directed graph is represented the same way as an undirected graph. For example, Graph #2 can be represented symbolically as G2=G2( { A,B,C,D } , { p,q,r,s,t,u } ). Unlike an undirected graph where only a single vertex degree is defined, in a directed graph, every vertex has an out degree and an in degree. The out-degree is defined as total count of all outward drawn edges from that vertex. The indegree is defined as the total count of all edges going towards a vertex. For instance, the out-degree of node A is one. While, the in-degree of node A is two. The Hand-shaking Lemma for directed graphs states that the sum of all in and out degrees for a graph is equal to two times the total number of edges. For example in Graph #2, the sum of all in and out degrees is equal to twelve(2*6 edges). A Vertex that only has out bound edges with out any in bound edges is called a source. While, a vertex that only has in bound edges with out any out bound edges is called a sink. Graph #2 does not contain any sources. It does contain a single sink vertex C. Whether directed or undirected, graphs can be stored as either an adjacency matrix

(b) Let G be a non directed graph with L2 edges. If G has 6 vertices each of degree 3 and the rest have degree less than 3, what is the minimum number of vertices G can have? (4 Marks)

ANS : By handshaking theorem, 2 no. Of edges = Sum of degrees of all the vertices. Let there be p vertices. p 6 have degree less then 3. 24 ( 6 3) + (p - 6) 3 24 18 + 3p 18 24 3p 8 p Thus, G can have minimum 8 vertices. (c) Determine the truth value for each of the following statements: (4 Marks) (i) 4 + 3 = 6 AND 3 + 3 = 6 ANS : Let p: 4+3=6 q: 3+3=6 Then the given statement is of the form p q. P q is true when atleast any one of p or q is true. Here, the truth values of p and q have truth value T and F respectively. The truth value of p i.e. it is false. q is F.

(ii) 5 + 3 = 8 OR 3 + 1 = 5 ANS : Let p: 5+3=8 q: 3+1=5 Then the given statement is of the form p v q. P v q is true when atleast any one of p or q is true. Here p and q have truth value T and F respectively. The truth value of p v q is T. i.e. it is true.

(d) Let f(n)= 5 f(n/ 2) + 3 and f(1) = 7. Find f(2k) where k is a positive integer. Also estimate f(n) if f is an increasing function. (4 Marks) ANS : f(n) = 5. f ( ) + 3 f(1) = 7 f = 5. F ( = 5.f( )+3 )+3