Tree, function and graph
-
Upload
computer-science-engineering -
Category
Education
-
view
63 -
download
3
Transcript of Tree, function and graph
TreeFunctionGraph
Discrete Mathematics
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.
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.
Functions are specified as assignments as in Figure 1.
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.
Figure 2 represents a function f from A to B.
Is it a function? If not state the reasons.
One-to-Oneone-to-one or an injunction function never
assign the same value to two different domain elements.
Explain why?
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.
Explain Why?
Check these!
Bijective(both one-to-one and onto)
• If the function is both one-to-one and onto that function is bijective.
L23 15
Trees
A very important type of graph in CS is called a tree:
Real Tree transformation
L23 16
Trees
A very important type of graph in CS is called a tree:
Real Abstract
Tree Treetransformation
Tree!A tree is a connected undirected graph with no simple circuits.Find which of them are not trees and why!
A tree with n vertices has n − 1 edges.
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.
Producing Spanning Tree
Other 4 Spanning trees of G
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.
Find Minimum Spanning Tree
We will discuss two algorithms for constructing minimum spanning trees.
Prim’s Algorithm
Solution
Try this
Kruskal’s Algorithm
Reviews from previous classes
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
Find out the diameter of the following graph
If P, A1, A2, A5, A3, A6, Q are the nodes then D=?
Isolated vertex
• A vertex of degree zero is called isolated. It follows that an isolated vertex is not adjacent to any vertex.
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.
Write the adjacent edges of vertex a.
An Unconnected, undirected graph
• Clearly, the graph is not connected.However, the figure actually represents the undirected graph G8=(v , e) , given by
Write the degree of the entire graph.
L23 39
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 40
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 41
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 42
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 43
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 44
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 45
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 46
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 47
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 48
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
L23 49
Bipartite Graphs
EG: C4 is a bichromatic:
And so is bipartite, if we redraw it:
Q: For which n is Cn bipartite?
Check whether bipartite or not!
Best wishes!