12 vues

Transféré par Tanupriya Chaubey

Finite State Automata

- Chap10 Slides
- Binding Number of Some Special Classes of Trees
- The Locating-chromatic Number of Binary Trees
- EEM 303 D.S. QB
- Technology Mapping
- bit_syl
- Prim
- MATH2400-CourseOutline
- Design and Analysis of Algorithms Unit 2
- graphAutomata-SeminarSlides-JanLeike.pdf
- 100411
- Dror Bar-Natan and Zsuzsanna Dancso- Homomorphic Expansions for Knotted Trivalent Graphs- Fixing an Anomoly
- Comparison of Clustering Algorithms Report
- 040 Lexical Analysis
- Parola A do Z
- Archived
- 1829.pdf
- TheoryOfComputation_
- 1-s2.0-S1568494614002592-main
- MCS-021

Vous êtes sur la page 1sur 14

DISCRETE MATHEMATICS

RECIA ASSIGNMENT

Name:Tanupriya Chaubey

Class:SYBScIT

UIDNo:121213

Roll No:049

A finite-state automaton is a device that can be in one of a finite number of states . In certain

conditions, it can switch to another state. This is called atransition . When the automaton

starts working (when it is switched on), it can be in one of its initial states. There is also

another important subset of states of the automaton: the final states. If the automaton is in a

final state when it stops working, it is said to accept its input. The input is a sequence of

symbols. The interpretation of the symbols depends on the application

It is convenient to present automata as directed graphs. The vertices denote states.

They are portrayed as small circles. The transitions form the edges - arcs with arrows

pointing from the source state (the state where the transition originates) to the target state.

They are labeled with symbols. Unless it is clear from the context, the initial states have short

arrows that point to them from ``nowhere''. The final states are represented as two concentric

circles.

The example automaton (fig. 2.1) contains 6 states labeled A, B, C, D, E and F. The state

labeled A is initial. The states A, C, and D are final. The automaton contains no cycles, as it is

impossible to leave a state, follow some transitions, and return in this way to the same

original state.

Finite State Automata (Finite State Machines)

Finite State Automata are graphs in which the vertices represent the states of an

object (or system).

one state is designated the start state.

zero or more states are designated final states.

each edge is directed from one state to another.

each edge may be labeled:

Typically with an event/reaction pair.

Sometimes in other ways.

Here

There are no final states

Only events appear (not reactions)

The delta event represents the passage of some

amount of time

The above is an asynchronous system

Events may happen at variable intervals.

A serial adder

Formalizing Finite State Automata

Directed Graphs

Defn: A directed graph, D = (V, E, ), consists of

A set of vertices V

A set of edges E

A function : E (V V )

Example: V = {0, 1, 2} E = {a, b, c} and (a) = (0, 1),

(b) = (1, 2), (c) = (2, 0)

edges (v0, e1, v1, e2, ..., en, vn) where (ei) = (vi1, vi), for i {1, 2, ..., n}.

Defn: A finite state automaton (FSA), A = (V, E, , s, F, , , ) consists of

(V, E, ) is a finite directed graph

s V is a start state

F V is a set of final states

is a set of input symbols (events)

is a set of output symbols (reactions)

: E ( ) is a labelling function

Each walk (v0, e1, v1, e2, ..., en, vn) in the graph D = (V, E, ) where v0 = s gives rise to a

behaviour in the automaton (1/1, 2/2, ..., n/n) where (ei) = (i, i), for each i {1,

2, ..., n}.

DFA Minimization

DFA is (Q,_, , I, F)

Q Finite set of states.

is the finite alphabet.

q0 Q the initial states.

F Q set of final states.

: Q _ Q, transition function (total).

Notation: We use q q to denote (q, a) = q.

A run of DFA A on u = a0, a1, . . . , an1 is a sequence of states q0, q1, . . . , qn s.t.

qi ai qi+1 for 0 i < n.

For a given word w the DFA has a unique run.

A run accepting if last state qn F.

Language accepted by AL(A) = {u _ | A has an accepting run on u}.A langauge

accepted by a DFA is called a regular language.

Construct finite automata which accepts the languages defined by the following regular

expressions.

(i)

abaab

Regular Expression

Regular expressions define formal languages as sets of strings over a finite alphabet. Let

denote a selected alphabet. Then is a regular expression that denotes the empty set and is a

regular expression that denotes the set containing the empty string as its only element.

If

, then is a regular expression that denotes the set whose only element is string . If

and are regular expressions denoting sets

and

, then

1.

, where

2.

is a regular expression denoting the set of all concatenations of

where

and

.

3.

is a regular expression denoting closure of

concatenations of strings from

and ,

The sets defined by regular expressions are called regular sets, and a set is regular iff it is

defined by a right linear grammar.

A regular expression is ambiguous when there exists a string which can be constructed in two

different ways from the regular expression.

Eg:a((ab)cd a(ababcb)a is Ambiguous. For instance, the string a can be

constructed by using a*((ab)cd or a(ababcb)a.

Q.Construct regular expressions representing languages, over the alphabet {a, b, c}, in which

for every string w it holds that:

(i)

The number of as in w is even.

(bUc)*((a(bUc))2)*

(ii)

There are 4i+ 1 bs in w. (i 0)

(a c)b(a c) )*((b(aUc))4)*

(iii)

|w| = 3i. (i 0)

(3)

Q. Consider the regular expression(a(cd)b)*

Find a string over {a, b, c, d}4 which matches the expression.

abab matches.

Q. Find a regular expression for the language L over = {a, b} consisting of strings which

contain

exactly two or exactly three bs.

1. aba is the set of strings with exactly one b.

2. ababa is the set of strings with exactly two bs.

3. abababa is the set of strings with exactly three bs.

4. The language L is then ababa abababa.

Minimum spanning trees

A tree is an undirected graph T = (V, E) satisfying all of the following conditions:

(a) T is connected,

(b) T is acyclic,

(c) |E| = |V | 1.

However, any two conditions imply the third.

A spanning tree of an undirected graph G = (V, E) is a subgraph which is a tree and which

connects all the vertices. (If G is not connected, G has no spanning trees.)

A minimum spanning tree is a spanning tree whose total sum of edge costs is minimum.

Compute a minimum spanning tree of the following graph:

Prim's algorithm.

X is a tree, and we repeatedly set S to be the edges between the vertices

of X and the vertices not in X, adding edges until X spans the graph. Thus we are always

adding the closest" vertex to the tree. The implementation of this is almost identical to that of

Dijkstra's algorithm.

Let G = (V,E) be a weighted, connected graph. Let T be the edge set that is grown in Prim's

algorithm. The proof is by mathematical induction on the number of edges in T and using the

MST Lemma.

Basis: The empty set is promising since a connected, weighted graph always has at least

one MST.

Induction Step: Assume that T is promising just before the algorithm adds a new edge e =

(u,v). Let U be the set of nodes grown in Prim's algorithm. Then all three conditions in the

MST Lemma are satisfied and therefore T U e is also promising.

When the algorithm stops, U includes all vertices of the graph and hence T is a

spanning tree. Since T is also promising, it will be a MST.

Grow a Tree

Start by picking any vertex to be the root of the

tree.

While the tree does not contain all vertices in the graph find shortest edge leaving the tree

and add it to the tree .

Step 0: Choose any element r; set S={r} and A=. (Take r as the root of our spanning tree.)

Step 1: Find a lightest edge such that one endpoint is in S and the other is in V\S. Add this

edge to A and its (other) endpoint to S.

Step 2: If V\S= , then stop & output (minimum) spanning tree(S,A). Otherwise go to Step 1.

The idea: expand the current tree by adding the lightest (shortest) edge leaving it and its

endpoint.

Implementation of Prim's Algorithm

Use two arrays, closest and lowcost.

For i V - U, closest[i] gives the vertex in U that is closest to i

For i V - U, lowcost[i] gives the cost of the edge (i, closest(i))

Illustration of Prim's algorithm

Step 1:

U = {1} V-U={2,4,5,6}

closest

lowcost

V-U

Step 2:

U = {1, 3}

V - U = {2, 4, 5, 6}

closest

lowcost

V-U

Step 3:

U = {1, 3, 6}

V - U = {2, 4, 5, 6}

closest

lowcost

V-U

Kruskal's Algorithm

This minimum spanning tree algorithm was first described by Kruskal in 1956 in the

same paper where he rediscovered Jarnik's algorithm. This algorithm was also

rediscovered in 1957 by Loberman and Weinberger, but somehow avoided being renamed

after them. The basic idea of the Kruskal's algorithms is as follows: scan all edges in

increasing weight order; if an edge is safe, keep it (i.e. add it to the set A).

algorithm Sort the edges. Repeatedly add the lightest edge that doesn't create a

cycle, until a spanning tree is found.

Notice that in Prim's we explicitly set S based on X, whereas here we implicitly choose" the

cut S after we find the lightest edge that doesn't create a cycle. In other words, we don't

actually find a cut corresponding to the edge e to be added, but we know that one must exist

if not, adding e would create a cycle.

Overall Strategy

Kruskal's Algorithm, as described in CLRS, is directly based on the generic MST

algorithm. It builds the MST in forest. Initially, each vertex is in its own tree in forest. Then,

algorithm consider each edge in turn, order by increasing weight. If an edge (u, v) connects

two different trees, then (u, v) is added to the set of edges of the MST, and two trees

connected by an edge (u, v) are merged into a single tree on the other hand, if an edge (u, v)

connects two vertices in the same tree, then edge (u, v) is discarded.

A little more formally, given a connected, undirected, weighted graph with a

function w : E R.

Repeatedly merges two components into one by choosing the light edge that connects

them (i.e., the light edge crossing the cut between them).

different components.

Step 1. In the graph, the Edge(g, h) is shortest. Either vertex g or vertex h could be

representative. Lets choose vertex g arbitrarily.

Step 2. The edge (c, i) creates the second tree. Choose vertex c as representative for

second tree.

Step 3. Edge (g, g) is the next shortest edge. Add this edge and choose vertex g as

representative.

Step 5. Add edge (c, f) and merge two trees. Vertex c is chosen as the representative.

Step 6. Edge (g, i) is the next next cheapest, but if we add this edge a cycle would be

created. Vertex c is the representative of both.

Step 10. Again, if we add edge (b, c), it would create a cycle. Add edge (d, e) instead to

complete the spanning tree. In this spanning tree all trees joined and vertex c is a sole

representative.

- Chap10 SlidesTransféré parPrajeeth Nair
- Binding Number of Some Special Classes of TreesTransféré parMia Amalia
- The Locating-chromatic Number of Binary TreesTransféré parVy'n Iipsychz Athrylith
- EEM 303 D.S. QBTransféré parshivam Gautam
- Technology MappingTransféré parshri1527
- bit_sylTransféré parprithviraj_tarafdar
- PrimTransféré paremailofashish
- MATH2400-CourseOutlineTransféré pardd122213
- Design and Analysis of Algorithms Unit 2Transféré pargoyalsb2682
- graphAutomata-SeminarSlides-JanLeike.pdfTransféré parbounken
- 100411Transféré parvol2no4
- Dror Bar-Natan and Zsuzsanna Dancso- Homomorphic Expansions for Knotted Trivalent Graphs- Fixing an AnomolyTransféré parGmonicon
- Comparison of Clustering Algorithms ReportTransféré parsan343
- 040 Lexical AnalysisTransféré parRaJu SinGh
- Parola A do ZTransféré parjovicarad
- ArchivedTransféré parAndrew Hu
- 1829.pdfTransféré parsrinjoy chakravorty
- TheoryOfComputation_Transféré parphyzics
- 1-s2.0-S1568494614002592-mainTransféré parKhatrine Hyvasciella
- MCS-021Transféré parkktamang09
- General Formulation and Case StudyTransféré parTito Fraga
- dsTransféré parshubham47g
- L02-4upTransféré parPopa Flavius
- CAP632Transféré parAbhinav Kumar
- Ph.D Syllabus for Entrance Test, InterviewTransféré parRanabir Chakroborty
- Towards a Library of Parallel Graph Algorithms in JavaTransféré parAli Khan

- 403 Hw4Transféré parapg5070
- cesTransféré parLovely Cat
- Cam Clay ParametersTransféré paranalysethat
- chpt3Transféré partjdandin1
- MDP.pdfTransféré parHrishikesh Khandeparkar
- Pages From Fe Civil Practice ProblemTransféré parShafiullah Khan
- KMeansPP SodaTransféré paralanpicard2303
- Smith J - Mathematics of the Discrete Fourier TransformTransféré parJayashree Ravindranath
- CEU Probability1 Solutions05 2013fallTransféré parRoberto Antonio Rojas Esteban
- ConvolutionTransféré parRifqiAndi
- (_partial)_(_partial y)(ln(2x^3+3y^2)) - Partial Derivative Calculator - SymbolabTransféré parafjkjchhghgfbf
- CFD Solution methodsTransféré parMani Kandan
- Problems SheetTransféré parRanu Games
- Elementary Mathematics 4017 SyllabusTransféré parAlex Lim
- Floating Point NumbersTransféré parSanchita Kadambari
- STLF Using Predictive Modular NNTransféré pargsaibaba
- cidipuTransféré parHicham Elyassami
- Giải bài toán động học ngược robot dư dẫn động bằng phương pháp chiếu tọa độ và chiếu vận tốcTransféré parpvdai
- Lec7 Data RepresentationTransféré parDeep An
- Unit-III Combinational Logic CircuitsTransféré parvec praveen
- Inclusion ExclusionTransféré parFantastiqueFesses
- Week5 HomeworkTransféré paryashar2500
- 10th MathsTransféré parYou Are Not Wasting TIME Here
- GCSE Topics - Solving Simultaneous Equations Graphically - QuestionsTransféré parJoel Gray
- Richard Dawkins Interviews Satish Kumar (Enemies of Reason Uncut Interviews) - YouTubeTransféré parkarthik_77
- [Jingqiao Zhang, Arthur C. Sanderson] Adaptive DifTransféré parfbpahjr
- Curve Fitting Made EasyTransféré parnasser270382
- Permutation Combinations Solved QuestionsTransféré parSankar Ranjan
- IPTransféré parAnonymous GH1ydID
- Trigonometry Reduction FormulaTransféré parSeah JiaChin