Download presentation
Presentation is loading. Please wait.
Published byBeatrice Wade Modified over 8 years ago
1
CSE 311 Foundations of Computing I Lecture 20 Relations, Graphs, Finite State Machines Autumn 2011 CSE 3111 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A AA
2
Announcements Reading assignments – 7 th Edition, Sections 9.3 and 13.3 – 6 th Edition, Section 8.3 and 12.3 – 5 th Edition, Section 7.3 and 11.3 Autumn 2011CSE 3112
3
Lecture highlights Autumn 2011CSE 3113 Let A and B be sets, A binary relation from A to B is a subset of A B S R = {(a, c) | b such that (a,b) R and (b,c) S} R 1 = R; R n+1 = R n R
4
n-ary relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 A 2 ... A n.
5
Relational databases Student_NameID_NumberMajorGPA Knuth328012098CS4.00 Von Neuman481080220CS3.78 Von Neuman481080220Mathematics3.78 Russell238082388Philosophy3.85 Einstein238001920Physics2.11 Newton1727017Mathematics3.61 Karp348882811CS3.98 Newton1727017Physics3.61 Bernoulli2921938Mathematics3.21 Bernoulli2921939Mathematics3.54
6
Alternate Approach Student_IDNameGPA 328012098Knuth4.00 481080220Von Neuman3.78 238082388Russell3.85 238001920Einstein2.11 1727017Newton3.61 348882811Karp3.98 2921938Bernoulli3.21 2921939Bernoulli3.54 Student_IDMajor 328012098CS 481080220CS 481080220Mathematics 238082388Philosophy 238001920Physics 1727017Mathematics 348882811CS 1727017Physics 2921938Mathematics 2921939Mathematics
7
Database Operations Projection Join Select
8
Matrix representation Relation R on A={a 1, … a p } {(1, 1), (1, 2), (1, 4), (2,1), (2,3), (3,2), (3, 3) (4,2) (4,3)}
9
Directed graphs Autumn 2011CSE 3119 Path: v 1, v 2, …, v k, with (v i, v i+1 ) in E Simple Path Cycle Simple Cycle G = (V, E) V – vertices E – edges, order pairs of vertices
10
Representation of relations Directed Graph Representation (Digraph) {(a, b), (a, a), (b, a), (c, a), (c, d), (c, e) (d, e) } ad e bc
11
Paths in relations Autumn 2011CSE 31111 Let R be a relation on a set A. There is a path of length n from a to b if and only if (a,b) R n
12
Connectivity relation Autumn 2011CSE 31112 Let R be a relation on a set A. The connectivity relation R* consists of the pairs (a,b) such that there is a path from a to b in R.
13
Properties of Relations Let R be a relation on A R is reflexive iff (a,a) R for every a A R is symmetric iff (a,b) R implies (b, a) R R is transitive iff (a,b) R and (b, c) R implies (a, c) R /
14
Transitive-Reflexive Closure Autumn 2011CSE 31114 Add the minimum possible number of edges to make the relation transitive and reflexive The transitive-reflexive closure of a relation R is the connectivity relation R*
15
Finite state machines States Transitions on inputs Start state and finals states The language recognized by a machine is the set of strings that reach a final state Autumn 2011 CSE 311 15 s0s0 s2s2 s3s3 s1s1 111 1 0,1 0 0 0 State01 s0s0 s0s0 s1s1 s1s1 s0s0 s2s2 s2s2 s0s0 s3s3 s3s3 s3s3 s3s3
16
What language does this machine recognize? Autumn 2011CSE 31116 s0s0 s2s2 s3s3 s1s1 1 1 1 1 0 0 0 0
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.