Вы находитесь на странице: 1из 20

LESSON 1

INTRODUCTION TO DISCRETE MATHEMATICS


Discrete mathematics is the part of mathematics devoted to the study of discrete objects. Here discrete means consisting of
distinct or unconnected elements.

WHY STUDY DISCRETE MATHEMATICS?


 Develop your mathematical maturity: that is, your ability to understand and create mathematical arguments.
 Discrete mathematics is the gateway to more advanced courses in all parts of the mathematical sciences. Discrete
mathematics provides the mathematical foundations for many computer science courses including data structures,
algorithms, database theory, automata theory, formal languages, compiler theory, computer security, and operating systems.
 Discrete mathematics contains the necessary mathematical background for solving problems in operations research
(including many discrete optimization techniques), chemistry, engineering, biology, and so on.

LOGIC AND PROOFS


Logic is the basis of all mathematical reasoning, and of all automated reasoning. The rules of logic give precise meaning to
mathematical statements. These rules are used to distinguish between valid and invalid mathematical arguments.
Besides the importance of logic in understanding mathematical reasoning, logic has numerous applications to computer science.
These rules are used in the design of computer circuits, the construction of computer programs, the verification of the correctness
of programs, and in many other ways. Furthermore, software systems have been developed for constructing some, but not all,
types of proofs automatically.

PROPOSITIONS
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both. We use
letters to denote propositional variables (or statement variables), that is, variables that represent propositions, just as letters are
used to denote numerical variables. The conventional letters used for propositional variables are p, q, r, s . . . The truth value of
a proposition is true, denoted by T, if it is a true proposition, and the truth value of a proposition is false, denoted by F, if it is a
false proposition.
The area of logic that deals with propositions is called the propositional calculus or propositional logic. It was first developed
systematically by the Greek philosopher Aristotle more than 2300 years ago.

COMPOUND PROPOSITION
We now turn our attention to methods for producing new propositions from those that we already have. These methods were
discussed by the English mathematician George Boole in 1854 in his book The Laws of Thought. Many mathematical statements
are constructed by combining one or more propositions. New propositions, called compound propositions, are formed from
existing propositions using logical operators.

DEFINITION 1
Let p be a proposition. The negation of p, denoted by ¬p (also denoted by p), is the statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the negation of p, is the opposite of the truth value of p.

DEFINITION 2
Let p and q be propositions. The conjunction of p and q, denoted by
p Λ q, is the proposition “p and q.” The conjunction p Λ q is true when both p and q are true and is false otherwise. (“p but q”)
Let p: Today is Monday
q: It is sunny today

DEFINITION 3
Let p and q be propositions. The disjunction of p and q, denoted by
p V q, is the proposition “p or q.” The disjunction p V q is false when both p and q are false and is true otherwise.
Let p: I will pass the exam.
q: I will fail.

DEFINITION 4
Let p and q be propositions. The exclusive or of p and q, denoted by
p  q, is the proposition that is true when exactly one of p and q is true and is false otherwise.

DEFINITION 5

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Let p and q be propositions. The conditional statement p → q is the proposition “if p, then q.” The conditional statement p → q
is false when p is true and q is false, and true otherwise.

The statement p → q is called a conditional statement because p → q asserts that q is true on the condition that p holds. A
conditional statement is also called an implication.
In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or
consequence).
TERMINOLOGY USED TO EXPRESS P → Q
“if p, then q” “p implies q”
“if p, q” “p only if q”
“p is sufficient for q” “a sufficient condition for q is p”
“q if p” “q whenever p”
“q when p” “q is necessary for p”
“q follows from p” “q unless ¬p”
“a necessary condition for p is q”

CONVERSE, CONTRAPOSITIVE, AND INVERSE


The proposition q → p is called the converse of p → q. The contrapositive of p → q is the proposition ¬q →¬p. The
proposition ¬p →¬q is called the inverse of p → q.
Converse is q → p.
In words: If the sum of 1 and its square is equal to one,
then 1 is a positive integer.
Contrapositive is ¬q → ¬p.
In words: If the sum of 1 and its square is not equal to
one, then 1 is not a positive integer.
Inverse is ¬p → ¬q.
In words: If 1 is not a positive integer, then the
sum of 1 and its square is not equal to one.

DEFINITION 6
Let p and q be propositions. The biconditional statement p ↔ q is the proposition “p if and only if q.” The biconditional
statement p ↔ q is true when p and q have the same truth values, and is false otherwise. Biconditional statements are also called
bi-implications.
There are some other common ways to express p ↔ q:
“p is necessary and sufficient for q”
“if p then q, and conversely”
“p iff q.”

TRUTH TABLES
p q ¬p pΛq pVq p q p→q p↔q

T T F T T F T T

T F F F T T F F

F T T F T T T F

F F T F F F T T

PRECEDENCE OF LOGICAL OPERATORS


Operator Precedence

¬ 1

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Λ 2

V 3

→ 4

↔ 5

LOGIC AND BIT OPERATIONS


Computers represent information using bits. A bit is a symbol with two possible values, namely, 0 (zero) and 1 (one). This
meaning of the word bit comes from binary digit, because zeros and ones are the digits used in binary representations of numbers.
The well-known statistician John Tukey introduced this terminology in 1946. A bit can be used to represent a truth value,
because there are two truth values, namely, true and false. As is customarily done, we will use a 1 bit to represent true and a 0 bit
to represent false. That is, 1 represents T (true), 0 represents F (false). A variable is called a Boolean variable if its value is either
true or false. Consequently, a Boolean variable can be represented using a bit.
A bit string is a sequence of zero or more bits. The length of this string is the number of bits in the string. Information is often
represented using bit strings, which are lists of zeros and ones. When this is done, operations on the bit strings can be used to
manipulate this information.
x y xVy xΛy xy

1 1 1 1 0

1 0 1 0 1

0 1 1 0 1

0 0 0 0 0

We can extend bit operations to bit strings. We define the bitwise OR, bitwise AND, and bitwise XOR of two strings of the same
length to be the strings that have as their bits the OR, AND, and XOR of the corresponding bits in the two strings, respectively.
We use the symbols V, Λ, and to represent the bitwise OR, bitwise AND, and bitwise XOR operations, respectively.

LESSON 2
PROPOSITIONAL EQUIVALENCES

DEFINITION 1:
CLASSIFICATION OF COMPOUND PROPOSITIONS
A compound proposition that is always true, no matter what the truth values of the propositional variables that occur in it, is
called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither
a tautology nor a contradiction is called a contingency.

Determine whether the following are tautology, contradiction or contingent.


1. [p Λ (p → q)] → q
2. p V [(p Λ ¬q)  r]
3. ¬[A  (¬A  B)]
4. p  (p V q)
5. (p V q) → [(p Λ q)  ¬r]
A compound proposition p is a contradiction if and only if ¬p is a contradiction.

LOGICAL EQUIVALENCES
Compound propositions that have the same truth values in all possible cases are called logically equivalent.
DEFINITION 2:
The compound propositions p and q are called logically equivalent if p ↔ q is a tautology. The notation p ≡ q denotes that p and
q are logically equivalent.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Equivalence Name

pΛT≡p Identity laws

pVF≡p

pVT≡T Domination laws

pΛF≡F

pVp≡p Idempotent laws

pΛp≡p

¬(¬p) ≡ p Double negation law

pVq≡qVp Commutative laws

pΛq≡qΛp

(p V q) V r ≡ p V (q V r) Associative laws

(p Λ q) Λ r ≡ p Λ (q Λ r)

p V (q Λ r) ≡ (p V q) Λ (p V r) Distributive laws

p Λ (q V r) ≡ (p Λ q) V (p Λ r)

¬(p Λ q) ≡ ¬p V ¬q De Morgan’s laws

¬(p V q) ≡ ¬p Λ ¬q

p V (p Λ q) ≡ p Absorption laws

p Λ (p V q) ≡ p

p V ¬p ≡ T Complement laws

p Λ ¬p ≡ F

p → q ≡ ¬p V q Implication

p  q ≡ (¬p Λ q) V (p Λ ¬q) XOR

p  q ≡ (¬p Λ ¬ q) V (p Λ q) Biconditional

The symbol ≡ is not a logical connective, and p ≡ q is not a compound proposition but rather is the statement that p ↔ q is a
tautology. The symbol  is sometimes used instead of ≡ to denote logical equivalence.

Example:
1. Show that ¬ [p V (¬p Λ q)] and ¬p Λ ¬q are logically equivalent by developing a series of logical equivalences.

2. Show that [p Λ (p → q)] → q is a tautology.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


3. Simplify P  (P V Q)

4. Show that (p Λ q)  (p V q) is a tautology.


Solution:
 ¬ [p V (¬p Λ q)] ≡ ¬p Λ ¬q

PROOF REASON

¬ [(p V ¬p) Λ( p V q)]

¬ [T Λ ( p V q)]

Identity

¬p Λ ¬q

Solution using Identities and truth table

 [p Λ (p → q)] → q
PROOF REASON

[p Λ (¬p V q)] → q

Distributive

[F V ( p Λ q)] → q

( p Λ q) → q

Implication

(¬ p V ¬q) V q

¬ p V (¬q V q)

¬pVT

p Q (p → q) Λ →q

T T T T T

T F F F T

F T T F T

F F T F T

Solution using Identities and truth table


 P  (P V Q)
PROOF REASON

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


[¬P Λ (P V Q)] V [P Λ ¬(P V Q)] XOR

[¬P Λ (P V Q)] V [P Λ ¬P Λ ¬Q)]

[¬P Λ (P V Q)] V [F Λ ¬Q)]

[¬P Λ (P V Q)] V F

[¬P Λ (P V Q)]

(¬P Λ P) V (¬P Λ Q)

F V (¬P Λ Q)

¬P Λ Q

P Q PVQ 

T T T F

T F T F

F T T T

F F F F

Seatwork:
1. Simplify the following:
a. ¬[A  (¬A  B)]
b. ¬[A V (¬A Λ B)]
c. [(S V M) Λ (S V ¬M)] V S
d. (A Λ B) V (¬A Λ B) V (A Λ ¬B)
e. (A  B) V (A Λ B)
f. (A  B) V (A Λ ¬B)

LESSON 3
SET THEORY
SET, Defined:
 is a collection of well-defined distinct objects
 unordered collection of objects, called elements or members of the set

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


e.g.: computer set = {mouse, printer, keyboard, CPU, monitor}

NAMING A SET
 A set can be named using any capital letter in the English alphabet except from U.
 Each object in a set is called “elements”.
e.g.: C = { mouse, printer, keyboard, CPU, monitor}
V = {a, e, i, o, u}
A = {1, 2, 3, 4, 5}

WAYS IN DESCRIBING A SET


1.) Tabular/Roster method – each elements are listed, separated by commas and enclosed in a curly braces.
e.g.: C = {mouse, printer, keyboard, CPU, monitor}
V = {0, 1, 4, 9, 16, 25, 36}
A = {1, 1/2, 1/3, 1/4…}

2.) Rule method (set builder notation) – it makes use of the description {x | x is an element of…}, which read
as “x such that x is an element of…”
e.g.: C = {x | x is an even integer between 0 and 8}
V ={ x|x is an element of computer hardware}
A = {x/5 | x is a whole number less than 5}

These sets each denoted using a boldface letter, play an important role in discrete mathematics:
W = {1, 2, 3 . . .}, the set of whole numbers
Z = {. . . , −2, −1, 0, 1, 2 . . .}, the set of integers
Z+ = {1, 2, 3 . . .}, the set of positive integers / natural numbers
Q = {p/q | p ∈ Z, q ∈ Z, and q ≠ 0}, the set of rational numbers
R = the set of real numbers
R+ = the set of positive real numbers
C = the set of complex numbers

KINDS OF SET
1.) Equal set – are sets containing exactly the same elements.
e.g.: A = {1, 2, 3, 4, 5}
B = {2, 4, 1, 3, 5}
Therefore, A = B

2.) Equivalent set – are sets with the same number of elements.
e.g.: A = {1, 2, 3, 4, 5}
B = {a, e, i, o, u}
Therefore, A ~ B
3.) Finite set – contains countable number of elements.
e.g.: A = {a, e, i, o, u}
B = { x|x is an element of months in a year}
4.) Infinite set – contains uncountable number of elements.
e.g.: Z = {…, -3, -2, -1, 0, 1, 2, 3 …}
B = {x | x is an element of grains of rice}

5.) Joint set – are sets with elements in common.


e.g.: A = {1, 2, 3, 4, 5}
B = {2, 4, 6, 8, 10}
A and B are joint set for it contains element in common, 2 and 4.

6.) Disjoint set – are sets with no elements in common.


e.g.: A = {x | x is an element of even numbers}
B = {x | x is an element of odd numbers}
A and B are disjoint set for it contains no element in common.

7.) Universal set – is the totality of elements under consideration denoted as U.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


8.) Null  or Empty {} set – a set containing no elements.

9.) Subset – is a part of a given set.

10.) Power set – set of all the subset of set (2n)


e.g.: A = {1, 2, 3}
{1}  A {2}  A {3}  A
{1, 2}  A {1, 3}  A {2, 3}  A
{1, 2, 3}  A {}

Cardinality comes from the common usage of the term cardinal number as the size of a finite set.
VENN DIAGRAM
 Is a picture representation of sets, developed by John Venn in 1880 which makes use of rectangle as the
universal set and circles as its subsets

A B

OPERATIONS ON SET
1.) Union () – is the combination of elements in two or more sets without repetition.
e.g.: A = {1, 2, 3, 4, 5}
B = {2, 4, 6, 8, 10} U
AB = {1, 2, 3, 4, 5, 6, 8, 10}
A B
*some reference uses () “or” symbol
to denote Union.

2.) Intersection () – are the element common in the given sets.
e.g.: A = {1, 2, 3, 4, 5}
B = {2, 4, 6, 8, 10} U
AB = {2, 4}
A B
*some reference uses () “and” symbol
to denote Intersection.

3.) Complement (‘) – these are elements found in the universal set but not on the given set.
e.g.: U = {0, 1, 2, 3, 4, 5}
A = {2, 3, 4} U
A’ = {0, 1, 5}
A

4.) Difference ( – ) – these are elements found in a given set but not on the other set.
e.g.: A = {1, 2, 3, 4, 5}
B = {2, 4, 6, 8, 10} U
A – B = {1, 3, 5}
B – A = {6, 8, 10}
A B

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


5.) Cartesian Product
Let A and B be sets. The Cartesian product of A and B, denoted by A × B, is the set of all ordered
pairs (a, b), where a ∈ A and b ∈ B.
A × B = {(a, b) | a ∈ A ∧ b ∈ B}
pp 124

GENERAL RULES OF SET


1.) Union
AU=U A=A AA=A

2.) Intersection
AU=A A= AA=A

3.) Complement
A’  U = U A’  A = U A’  A = 

4.) Difference
A – B = B’  A B – A = A’  B

SET IDENTITIES
1.) Commutative Law
AB=BA AB=BA
2.) Associative Law
A  (B  C) = (A  B)  C A  (B  C) = (A  B)  C
3.) Distributive Law
A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C)
4.) Identity Law
A=A AU=A
5.) Inverse Law
A’  A = U A’  A = 
6.) Domination Law
AU=U A=
7.) Idempotent Law
AA=A AA=A
8.) Complementation
(A’)’ = A
9.) De Morgan’s Law
(A  B)’ = A’  B’ (A  B)’ = A’  B’

MEMBERSHIP TABLES
Set Notation can be proven using Membership Tables. We consider each combination of sets that an element can
belong to and verify that elements in the same combinations of sets belong to both sets in the identity. To indicate
that an element is in a set, a 1 is used; to indicate that an element is not in a set, a 0 is used.

Prove that (A  B)’ = A’  B’


A B AB (A  B)’ A’ B’ A’  B’
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


1 1 1 0 0 0 0

APPLICATION OF SET THEORY


Sample Problem:
In an excursion at Enchanted Kingdom, 80 students brought Sandwich, Drinks and Chips as follows:

50 students brought Sandwich (S)


30 students brought Drinks (D)
30 students brought Chips (C)
18 students brought Chips and Drinks
15 students brought Sandwich and Chips
8 students brought Sandwich and Drinks
5 students brought all the said stuffs.

S D

Construct a Venn diagram and answer the following questions:


How many students brought:
1.) Sandwich only? Drinks only? Chips only?
2.) Nothing?
3.) Sandwich and chips but not drinks?
4.) Chips or drinks but not sandwich?
5.) Exactly one of the stuffs?
6.) At most two of the stuffs?
7.) At least two of the stuffs?
COMPUTER REPRESENTATION OF SETS
There are various ways to represents sets using a computer. One method is to store the elements of the set in an
unordered fashion. However, if this is done, the operations of computing the union, intersection, or difference of two
sets would be time consuming, since each of these operations would require a large amount of searching for
elements. Storing elements using an arbitrary ordering of the elements of the universal set makes computing
combinations of sets much easier.
Assume that the Universal set U is finite. First, specify an arbitrary ordering of elements of U, for instance a 1, a2… an.
Represent a subset of U with the string of length n, where the ith bit in this string is 1 if a1 belongs to A and is 0 if a1,
does not belong to A.
Example:
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
(In bit string U = 1111111111, where the ordering of elements is in increasing order)
1. What bit strings represent the subset of all odd integers in U?
2. What bit strings represent the subset of all even integers in U?
3. What bit strings represent the subset of integers not exceeding 5 in U?

EXERCISE 1: SETS

Part 1: Operations on sets


Given the following sets:
Set A = {0, 2, 4, 6, 8, 10} Set B = {x | x is an odd integer between 0 to 10}
Set C = {0, 2, 3, 5, 8} Set D = {1, 4, 6, 7, 9}

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Determine the following:
1. Universal set 4. [B ∩ C] U D
2. [A ∩ C] U D 5. B’ U [C – D] U [B ∩ D]
3. [A ∩ D] U [B ∩ C]

Part 2: Prove using Membership Table that:


1. (A  B)’ = A’  B’
2. A  (B  C) = (A  B)  (A  C)
3. [A  (B  C)]’ = (C’  B’)  A’

Part 3: Application on Set Theory


In a certain school, 90 students went to the zoo with hamburger, milk and cake with breakdown as follows:
3 had hamburger
5 had hamburger and milk
10 had cake and milk
8 had hamburger and cake
24 had hamburger
38 had cake
20 had milk
Create a Venn diagram showing the breakdown of students and answer the following questions: How many students
had:
1. Nothing?
2. Cake only? Hamburger only? Milk only?
3. Hamburger and cake but not milk?
4. Milk or cake?
5. At most two items?
6. At least one item?
7. Cake or milk but not hamburger?

Part 4: Computer Representation of sets


Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Set A = {2, 4, 6, 8, 10} Set B = {x | x is an odd integer between 0 to 10}
Set C = {1, 2, 3, 4, 5}
1. Determine the bit string complement of Set A, Set B and Set C.
2. Use bit string to find the union, intersection of:
a. Set A and B
b. Set A and C
c. Set B and C
3. Find the bit string difference of
a. A – C
b. B – C

LESSON 5
GRAPH THEORY
 GRAPH THEORY
 The 7 Bridges of Konigsberg
 Konigsberg (now called Kaliningrad) is a city on the Baltic Sea wedged between Poland and Lithuania.
 A river runs through the city which contains a small island.
 There are 7 bridges which connect the various land masses of the city.
 The City of Konigsberg
 The problem was solved by Leonhard Euler (1707-1783)
 TERMS

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Graph theory is the study of graphs.
Graph are set vertices and edges that are symbolic of structures such as networks or relationships.
Graphs have a finite number of vertices and a finite number of edges.
Graphs can be used to represent things such as computer networks, roads that connect cities, family trees, and or the structure
used to access data in your computers random access memory.
Graphs allow us to create visual representations of things that may not normally be seen or well understood otherwise.
 A vertex (nodes) is a terminal at which edges may connect. The word vertices is the plural of vertex. We will
symbolize a vertex as a black dot.
 An edge (arc) is a pair of vertices that expresses a relationship between the vertices. This will be symbolized as a line
between the vertices.
 A Label gives a name or value to a vertex. Some graphs have uniquely labeled vertices, which gives uniquely
identifiable edges.
 TYPES OF GRAPHS (1)
 Connected Graphs
Some graphs are connected by edges and some are not.
 Directed Graphs
Some edges have an implied direction. You may go from one vertex to another but you can not go back using the same
edge. An arrow is used to symbolize the direction of the edge.
 Labeled Graphs
A labeled graph is a graph the gives the vertices a name or value.
 Vertices With Multiple Edges
Some graphs may have multiple edges between the same pair of vertices.
 Loops
A loop is an edge that connects a vertex to itself.
 Cost / Weighted
Some graphs have a cost associated with edges. To go from one vertex to another the cost of the edges between the will be
incurred.
 TYPES OF GRAPHS (2)
 Simple Graphs
A simple graph is an undirected graph that does not have multiple edges between the same pairs of vertices or loops.
 Multigraph
A multigraph is an undirected graph that can have more than one edge connecting the same pair vertices, but loops are not
allowed.
 Pseudograph
A pseudograph is an undirected graph that can have more than one edge connecting the same pair vertices, and loops
are allowed.
 Directed Graph
A directed graph is a graph that has edges with a single direction and can only be followed in the specified direction (much like a
one way street).
 Directed Multigraph
A directed multigraph is a graph that is directed, allows for more than one edge between a pair of vertices and allows for loops.
 Summary
 GRAPH MODELS

- a graph becomes a model when a graph is used to represent either a physical entity, or a conceptual entity
 1. Niche overlap graphs
Graphs used involving the interaction of different species of animals, it shows the competition between species in an
ecosystem.
 2. Acquaintance Graph
Representation whether two persons know each other, that is, whether they are acquainted.
 3. Influence Graph
In studies of group behavior it is observed that certain people can influence the thinking of others.
Who influences Brian?
Who can influence Deborah?

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Who can influence Linda?
 4. Hollywood Graph
Represents actors by vertices and connects two vertices when the actors represented by these vertices have worked
together on a movie.
 Round Robin Tournament
A tournament where each team plays each other team exactly once.
Questions:
Who wins most of the games?
What team didn't win any games?
BSIT beat what teams?
BSCS lose to what teams?
How many wins does ACT have?
 Precedence Graph and Concurrent Processing
 A precedence graph is a directed graph showing which tasks must occur before other tasks.
 A way of representing the order constraints among a collection of statements. The nodes of the graph represent the
statements. There is a directed edge from node A to node B if statement A must be executed before statement B.

Exercise 1
1. Construct a precedence graph for the following program
S1 : x : = 0
S2 : x : = x + 1
S3 : y : = 2
S4 : z : = y
S5 : x : = x + 2
S6 : y : = x + 2
S7 : z : = 4
2. Construct a niche overlap graph for six species of birds, where the hermit thrush competes with the robin and with the blue jay,
the robin also competes with the mockingbird, the mockingbird also competes with the blue jay, and the nuthatch competes with
the hairy woodpecker.
6. Draw a precedence graph that shows the precedence relationship between the following tasks that Joey must complete before
going to bed.
Tasks include: Climbing into bed, brushing teeth, putting on PJs, taking a bath, eating a snack, and turning the night light on at
the far corner of his room.
Reading from the graph, can you determine a possible order for Joey to accomplish his goal of getting to bed? How many
different ways can he order the tasks and get to bed, without violating any of the precedence constraints?
BASIC TERMINOLOGIES
Given two vertices u and v connected by an edge e
 Adjacent (neighbors) – two vertices are adjacent if they are connected by an edge. (u and v = adjacent)
 Incident – an edge is incident to the vertices it connects. (e is incident with the vertices u and v)
 Endpoints – vertices u and v are called endpoints of the edge e.
 Size – of a graph is the number of vertices that the graph has.
 Path – the route traveled along edges and through vertices.
Given a directed graph
 Initial vertex – outgoing transition of an edge. (Source)
 Terminal/end vertex – destination of the transition of the edge
Note: the initial vertex and the terminal vertex of a loop are the same
 Degree of a Vertex
Theorem 1: Handshaking Theorem
G=(V,E) an undirected graph with e edges.
Note: This applies even if multiple edges and loops are present
Sample:
a. How many edges are there in an undirected graph with the degree sum of 14?
b. Given a graph with 5 vertices whose degree are 4, 6, 1, 5, 6 respectively, determine the number of edges and draw the graph if
it exists.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


c. How many edges are there in a graph with ten vertices each of the degree six?
 Some Special Simple Graphs
Complete Graph - simple graph that contains one edge between each pair of vertices. Models connections in fully-connected
communication or multi-processor computer systems.
Graphs Kn for 1 ≤ n ≤6
Formula for the number of edges for a complete graph
2e = v(v-1)
Where e = no. of edges and v = no. of vertices
Sample:
a. Determine the no. of edges of a complete graph with 10 vertices.
 Cycles
 Special simple graphs that contain cycles are the basic geometric figures. In determining if a graph has a cycle, there
must be no edges on the inner part of the figure. Models some local area network topologies (e.g. Token-Ring, Fiber
Distributed Data Interface or FDDI).
No. of edges = No. of Vertices
Sample:
Determine the no. of edges of a cycle graph with 2 vertices and draw the figure.
 Wheels
 Special simple graphs that contain wheels are graphs that have a single point in the middle of the figure and there are
edges going from each outer vertex to the single inner vertex. Models some multi-processor computer systems having
central and neighbor connections. No more than two hops away from any other processor.
No. of edges = 2 (v -1)
Sample:
Determine the no. of edges of a wheel graph with 6 and 21 vertices.
 N-Cubes
 Graphs representing 2n bit strings of length n.
 Q3 graph represents 23 bit strings of length 3.
 Each adjacent vertex changes by only a single bit.
 A 4-bit representation would be a 4-dimensional n-Cube.
 Only one bit changes between neighbors.
 Models algorithm search-space, changing only one parameter at a time in the search, can be applied to genetic
algorithms.
 Bipartite Graphs
Bipartite is a simple graph in which the vertices can be partitioned into disjoint sets V1 and V2 .
 Edges connect vertices of V1 and V2
 No edges connect vertices of:
V1 with other vertices of V1 or V2 with other vertices of V2
Theorem 4
A simple graph is bipartite if it is possible to assign one of two different colors to each vertex of the graph so that no two adjacent
vertices are assigned the same color.
 Sample: Bipartite graph
 Some applications of Graph Theory
 Models for communications and electrical networks
 Models for computer architectures
 Network optimization models for operations analysis, including scheduling and job assignment
 Analysis of Finite State Machines
 Parsing and code optimization in compilers
 Graphs ↔ Networks
Exercise 2
1. For each letter , given the degree of the vertices, determine:
 The number of edges
 Draw the graph. (If there exists a graph)
a. 0, 1, 2, 3, 4, 5
b. 1, 2, 3, 4, 5, 5

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


c. 1, 1, 1, 1, 1, 1
d. 3, 2, 2, 2, 2, 3
e. 0, 1, 1, 1, 1, 0
2. Determine the number of edges for the following graphs
a. Complete graph with 15 vertices
b. Cycle graph with 18 vertices
c. Wheel graph with 18 vertices

Graph Representation

Adjacency lists specify the vertices adjacent to another

Adjacency Matrices - A matrix representing a graph using the adjacency of vertices

Adjacency Matrices: Directed graph

Pseudograph with multiple undirected edges.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Incidence Matrices - A matrix representing a graph using the incidence of edges and vertices

Isomorphisms of Graphs

Iso – equal Morphic – form

Isomorphic - being of identical or similar form, shape, or structure

Isomorphic graphs have same form, there is a one-to-one correspondence between vertices that preserves edges

Euler Paths and Circuits


 Euler path: A graph is said to be containing an Euler path if it can be traced in 1 sweep without lifting the
pencil from the paper and without tracing the same edge more than once. Vertices may be passed through
more than once. The starting and ending points need not be the same.
 Euler circuit: An Euler circuit is similar to an Euler path, except that the starting and ending points must be the
same.
 Theorem 1 Euler circuit in multigraph if each vertex has even degree.
 Theorem 2 Euler path but not Euler circuit if multigraph has exactly two vertices of odd degree.

Hamilton Paths and Circuits


Hamilton Path: a path that touches every vertex at most once.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Hamilton Circuit: a path that touches every vertex at most once and returns to the starting vertex.
No Hamilton circuit when
in a graph having a vertex of degree one.
All edges of vertices of degree two must be in the circuit.

Shortest-Path Problems

Many problems can be modeled using graphs with weights assigned to their edges. Problems involving distances
can be modeled by assigning distances between cities to the edges. Problems involving flight time can be modeled
by assigning flight times to edges. Problems involving fares can be modeled by assigning fares to the edges.

Length of a path in a weighted graph is the sum of the weights of the edges of this path

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


EDSGER WYBE DIJKSTRA (1930–2002) born in the Netherlands, began programming computers in the early 1950s
while studying theoretical physics at the University of Leiden. In 1952, realizing that he was more interested in
programming than in physics, he quickly completed the requirements for his physics degree and began his career
as a programmer, even though programming was not a recognized profession. (In 1957, the authorities in
Amsterdam refused to accept “programming” as his profession on his marriage license. However, they did accept
“theoretical physicist” when he changed his entry to this.) Dijkstra was one of the most forceful proponents of
programming as a scientific discipline. He has made fundamental contributions to the areas of operating systems,
including deadlock avoidance; programming languages, including the notion of structured programming; and
algorithms. In 1972 Dijkstra received the Turing Award from the Association for Computing Machinery, one of the
most prestigious awards in computer science. Dijkstra became a Burroughs Research Fellow in 1973, and in 1984
he was appointed to a chair in Computer Science at the University of Texas, Austin.

A Shortest-Path Algorithm

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


Theorem 1
Dijkstra’s algorithm finds the length of a shortest path between
two vertices in a connected simple undirected weighted graph.

Theorem 2
Dijkstra’s algorithm uses O(n2) operations (additions and
comparisons) to find the length of a shortest path between two
vertices in a connected simple undirected weighted graph with
n vertices.

DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE


DCIT 23- DISCRETE MATHEMATICS MS. SOPHIA LORENZ N.POBLETE

Вам также может понравиться