51
Tree Function Graph Discrete Mathematics

Tree, function and graph

Embed Size (px)

Citation preview

Page 1: Tree, function and graph

TreeFunctionGraph

Discrete Mathematics

Page 2: Tree, function and graph

Function Requirements

There are rules for functions to be well defined, or correct.• No element of the domain must be left unmapped.• No element of the domain may map to more than one element of the co-domain.

Page 3: Tree, function and graph
Page 4: Tree, function and graph

Definition 1

• Let A and B be nonempty sets. A function f from A to B is an assignment of exactly one

element of B to each element of A.

Page 5: Tree, function and graph

Functions are specified as assignments as in Figure 1.

Page 6: Tree, function and graph

DEFINITION 2

If f is a function from A to B, we say that A is the domain of f and B is the co-domain of f.

Page 7: Tree, function and graph

Figure 2 represents a function f from A to B.

Page 8: Tree, function and graph

Is it a function? If not state the reasons.

Page 9: Tree, function and graph

One-to-Oneone-to-one or an injunction function never

assign the same value to two different domain elements.

Page 10: Tree, function and graph

Explain why?

Page 11: Tree, function and graph

When every member of the codomain is the image of some element of the domain then functions are called onto functions or a surjection.

Onto Functions.

Page 12: Tree, function and graph

Explain Why?

Page 13: Tree, function and graph

Check these!

Page 14: Tree, function and graph

Bijective(both one-to-one and onto)

• If the function is both one-to-one and onto that function is bijective.

Page 15: Tree, function and graph

L23 15

Trees

A very important type of graph in CS is called a tree:

Real Tree transformation

Page 16: Tree, function and graph

L23 16

Trees

A very important type of graph in CS is called a tree:

Real Abstract

Tree Treetransformation

Page 17: Tree, function and graph

Tree!A tree is a connected undirected graph with no simple circuits.Find which of them are not trees and why!

Page 18: Tree, function and graph

A tree with n vertices has n − 1 edges.

Page 19: Tree, function and graph
Page 20: Tree, function and graph

Spanning Trees

• Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree containing every vertex of G.• A simple graph with a spanning tree

must be connected, because there is a path in the spanning tree between any two vertices.

Page 21: Tree, function and graph

Producing Spanning Tree

Page 22: Tree, function and graph

Other 4 Spanning trees of G

Page 23: Tree, function and graph

Minimum Spanning Trees

A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible sum of weights of its edges.

Page 24: Tree, function and graph

Find Minimum Spanning Tree

Page 25: Tree, function and graph

We will discuss two algorithms for constructing minimum spanning trees.

Page 26: Tree, function and graph

Prim’s Algorithm

Page 27: Tree, function and graph

Solution

Page 28: Tree, function and graph

Try this

Page 29: Tree, function and graph

Kruskal’s Algorithm

Page 30: Tree, function and graph
Page 31: Tree, function and graph

Reviews from previous classes

Page 32: Tree, function and graph

The diameter of a graph is the length of the shortest path between the most distanced nodes. The highest value of the topological distance of this matrix is the diameter of

the graph (d=4).

Diameter of a Graph

Page 33: Tree, function and graph

Find out the diameter of the following graph

If P, A1, A2, A5, A3, A6, Q are the nodes then D=?

Page 34: Tree, function and graph

Isolated vertex

• A vertex of degree zero is called isolated. It follows that an isolated vertex is not adjacent to any vertex.

Page 35: Tree, function and graph

Adjacent edge

• When two vertices of a graph are connected by an edge, these vertices are adjacent vertices.• When two edges meet at the

same vertex, those two edges are said to be adjacent.

Page 36: Tree, function and graph

Write the adjacent edges of vertex a.

Page 37: Tree, function and graph

An Unconnected, undirected graph

• Clearly, the graph is not connected.However, the figure actually represents the undirected graph G8=(v , e) , given by

Page 38: Tree, function and graph

Write the degree of the entire graph.

Page 39: Tree, function and graph

L23 39

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 40: Tree, function and graph

L23 40

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 41: Tree, function and graph

L23 41

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 42: Tree, function and graph

L23 42

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 43: Tree, function and graph

L23 43

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 44: Tree, function and graph

L23 44

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 45: Tree, function and graph

L23 45

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 46: Tree, function and graph

L23 46

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 47: Tree, function and graph

L23 47

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 48: Tree, function and graph

L23 48

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Page 49: Tree, function and graph

L23 49

Bipartite Graphs

EG: C4 is a bichromatic:

And so is bipartite, if we redraw it:

Q: For which n is Cn bipartite?

Page 50: Tree, function and graph

Check whether bipartite or not!

Page 51: Tree, function and graph

Best wishes!