Professional Documents
Culture Documents
{ }
2. Generate the language L (G) = a n b n c n n ≥ 1 by the following grammar.
3. Prove that the sum of the degrees of the vertices of a graph G is twice the number of edges
10 marks
4. Obtain a DFA to accept strings of a’s and b’s starting with the string ab.
10 marks
10 marks
10 marks
{
L = ai b j i , j ≥ 1, i≠j } 10 marks
6. Find a Turing machine to accept the language containing string’s of 0’s and 1’s ending with
011 10 marks
Graph theory is the study of graphs, mathematical structures used to model pairwise relations between objects
from a certain collection. A "graph" in this context refers to a collection of vertices or 'nodes' and a collection of
edges that connect pairs of vertices. A graph may be undirected, meaning that there is no distinction between the
two vertices associated with each edge, or its edges may be directed from one vertex to another; see graph
(mathematics) for more detailed definitions and for other variations in the types of graphs that are commonly
considered. The graphs studied in graph theory should not be confused with graphs of functions or other kinds of
graphs.
Graphs are one of the prime objects of study in Discrete Mathematics. Refer to Glossary of graph theory for basic
definitions in graph theory.
A finite graph is a graph G = (V, E) such that V and E are finite sets. An infinite graph is one with an infinite set of
vertices or edges or both.
Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is
usually specifically stated.
In graph theory, the degree (or valency) of a vertex of a graph is the number of edges incident to the vertex, with
loops counted twice. The degree of a vertex v is denoted deg(v). The maximum degree of a graph G, denoted by
Δ(G), and the minimum degree of a graph, denoted by δ(G), are the maximum and minimum degree of its vertices.
In the graph on the right, the maximum degree is 3 and the minimum degree is 0. In a regular graph, all degrees
are the same, and so we can speak of the degree of the graph.
In one more generalized notion,E is a set together with a relation of incidence that associates with each edge two
vertices.
An isolated vertex is a vertex with degree zero; that is, a vertex that is not an endpoint of any edge.
A leaf vertex (also pendant vertex) is a vertex with degree one. In a directed graph, one can distinguish the
outdegree (number of outgoing edges) from the indegree (number of incoming edges).
In the mathematical field of graph theory, the null graph or the empty graph is either the graph with no vertices
and (hence) no edges, or any graph with no edges.
We generate the language for n = 2. That is, we derive the string a2b2c2.
S ⇒ aSBC
⇒ aaBCBC
⇒ aaBBCC
⇒ aabBCC
⇒ aabbCC
⇒ aabbcC
⇒ aabbcc
It is clear that the string should start with ab and so, the minimum string that can be accepted by the machine is ab.
To accept the string ab, we need three states and the machine can be written as
where q2 is the final or accepting state. In state q0, if the input symbol is b, the machine should reject b (note that
the string should start with a). So, in state q0, on input b, we enter into the rejecting state q3. The machine for this
can be of the form
Whenever the string is not starting with ab, the machine will be in state q3 which is the rejecting state. So, in state
q3, if the input string consists of a’s and b’s of any length, the entire string can be rejected and can stay in state q3
only.
The resulting machine can be of the form
The machine will be in state q2, if the input string starts with ab. After the string ab, the string containing any
combination of a’s and b’s, can be accepted and so remain in state q2 only. The complete machine to accept the
strings of a’s and b’s starting with the string ab is shown in figure.
The state q3 is called trap state or rejecting state.
We decompose where
A → aA
A → aB
B → aBb
B → ab
A is a starting symbol.
Grammar for L2 :
Productions: C → Cb
C → Db
D → aDb
D → ab
Now by adding the two sets of productions, S → A, S → C with S as the starting symbol, we get the grammar
General Method: Since n number of a s should be followed by n number of b’s, let us push all the symbols on to
the stack as long as the scanned input symbol is ‘a’. Once we encounter b’s, we should see that for each ‘b’ in the
From this we conclude that there is a limit length of the string that is generated from the start symbol S. this
contradicts our assumption that the language is finite.
Therefore, the assumption that one or more variable are non recursive is incorrect.
This means that this means that one or more variable are non recursive and hence the proof.
Case 2: The string z L implies that after applying some / all production some number of times, we get finally
string of terminal and the derivation stops.
Let z L is sufficiently long string and so the derivation must have involved recursive use of some non terminal A
and the derivation must have the form:
*
Note that any derivation should start from the start symbol S.