0% found this document useful (0 votes)
5 views

dms notes

The document discusses various concepts in discrete mathematics, focusing on graph theory, including isomorphism graphs, Euler's trails and circuits, and shortest path algorithms. It provides examples and conditions for determining graph isomorphism, explains Euler paths, and outlines Dijkstra's algorithm for finding shortest paths in graphs. Additionally, it covers binary trees, full and complete binary trees, and weighted trees, including definitions and examples for each type.

Uploaded by

M Tejaswini
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

dms notes

The document discusses various concepts in discrete mathematics, focusing on graph theory, including isomorphism graphs, Euler's trails and circuits, and shortest path algorithms. It provides examples and conditions for determining graph isomorphism, explains Euler paths, and outlines Dijkstra's algorithm for finding shortest paths in graphs. Additionally, it covers binary trees, full and complete binary trees, and weighted trees, including definitions and examples for each type.

Uploaded by

M Tejaswini
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

21AM37 – DISCRETE MATHEMATICAL STRUCTURE

2022 – 23 Odd Semester

AAT

Submitted by

2022 – 23

The Graph of Isomorphism.


The isomorphism graph can be described as a graph in which a single graph can have more than
one form. That means two different graphs can have the same number of edges, vertices, and
same edges connectivity. These types of graphs are known as isomorphism graphs. The example
of an isomorphism graph is described as follows:

Example 1:
In this example, we have shown whether the following graphs are isomorphism.

Solution: For this, we will check all the four conditions of graph isomorphism, which are
described as follows:
Condition 1:
● In graph 1, there is a total 4 number of vertices, i.e., G1 = 4.
● In graph 2, there is a total 4 number of vertices, i.e., G2 = 4.
Here, There are an equal number of vertices in both graphs G1 and G2. So these graphs satisfy
condition 1. Now we will check the second condition.
Condition 2:
● In graph 1, there is a total 5 number of edges, i.e., G1 = 5.
● In graph 2, there is a total 6 number of edges, i.e., G2 = 6.
Here, There does not have an equal number of edges in both graphs G1 and G2. So these graphs
do not satisfy condition 2. Now we cannot check all the remaining conditions. Since, these
graphs violate condition 2. So these graphs are not an isomorphism. Graph G1 and graph G2
are not isomorphism graphs.

Example 2:
In this example, we have shown whether the following graphs are isomorphism.

Solution: For this, we will check all the four conditions of graph isomorphism, which are
described as follows:

Condition 1:
● In graph 1, there are a total 8 vertices, i.e., G1 = 8.
● In graph 2, there are a total 8 vertices, i.e., G2 = 8.
Here, There are an equal number of vertices in both graphs G1 and G2. So these graphs satisfy
condition 1. Now we will check the second condition.
Condition 2:
● In graph 1, the total number of edges is 10, i.e., G1 = 10.
● In graph 2, the total number of edges is 10, i.e., G2 = 10.
Here, There are an equal number of edges in both graphs G1 and G2. So these graphs satisfy
condition 2. Now we will check the third condition.
Condition 3:
● In graph 1, the degree of sequence s is {2, 2, 2, 2, 3, 3, 3, 3}, i.e., G1 = {2, 2, 2, 2, 3, 3,
3, 3}.
● In graph 2, the degree of sequence s is {2, 2, 2, 2, 3, 3, 3, 3}, i.e., G2 = {2, 2, 2, 2, 3, 3,
3, 3}.
Here, There are an equal number of degree sequences in both graphs G1 and G2. So these
graphs satisfy condition 3. Now we will check the fourth condition.
Condition 4:
● Graph G1 forms a cycle of length 4 with the help of degree 3 vertices.
● Graph G2 is not forming a cycle of length 4 with the help of vertices because vertices
are not adjacent.
Here, Both the graphs G1 and G2 do not form the same cycle with the same length. So these
graphs violate condition 4.
Graphs G1 and G2 violate condition 4. So because of the violation of condition 4, these graphs
will not be an isomorphism.
Graphs G1 and G2 are not an isomorphism.

Euler’s Trails and Circuits


If all the vertices of any connected graph have an even degree, then this type of graph will be
known as the Euler graph. In other words, we can say that an Euler graph is a type of connected
graph which has the Euler circuit.

Example 1:
In the following image, we have a graph with 6 nodes. Now we have to determine whether this
graph contains an Euler path.

Solution:
The above graph will contain the Euler path if each edge of this graph must be visited exactly
once, and the vertex of this can be repeated. So if we begin our path from vertex B and then go
to vertices C, D, F, B, E, D, A, and B, then in this process, each and every edge is visited
exactly once, and it also contains repeated vertices. So the above graph contains an Euler path,
which is described as follows:
Euler path = BCDFBEDAB
Example 2:
In the following image, we have a graph with 4 nodes. Now we have to determine whether this
graph contains an Euler path.

Solution:
The above graph will contain the Euler path if each edge of this graph must be visited exactly
once, and the vertex of this can be repeated. So if we begin our path from vertex B and then go
to vertices C, D, B, A, and D, then in this process, each and every edge is visited exactly once,
and it also contains repeated vertices. So the above graph contains an Euler path, which is
described as follows:
Euler path = BCDBAD
Shortest path
This algorithm maintains a set of vertices whose shortest paths from source are already known.
The graph is represented by its cost adjacency matrix, where cost is the weight of the edge. In
the cost adjacency matrix of the graph, all the diagonal values are zero. If there is no path from
source vertex Vs to any other vertex Vi then it is represented by +∞.In this algorithm, we have
assumed all weights are positive.

1. Initially, there is no vertex in sets.

2. Include the source vertex Vs in S.Determine all the paths from V s to all other vertices
without going through any other vertex.

3. Now, include that vertex in S which is nearest to V s and find the shortest paths to all the
vertices through this vertex and update the values.

4. Repeat the step until n-1 vertices are not included in S if there are n vertices in the
graph.
After completion of the process, we got the shortest paths to all the vertices from the source
vertex.

Example:
Find the shortest paths between K and L in the graph shown in fig using Dijkstra's Algorithm.

Step1: Include the vertex K is S and determine all the direct paths from K to all other vertices
without going through any other vertex.

Distance to all other vertices


S K a b c d L

K 0 4(K) ∞ 2(K) ∞ 20(K)

Step2: Include the vertex in S which is nearest to K and determine shortest paths to all vertices
through this vertex and update the values. The closest vertex is c.

Distance to all other vertices


S K a b c d L

K 0 3(K, c) 7(K, c) 2(K) 8(K, c) 18(K, c)

Step3: The vertex which is 3rd nearest to K is b, included in S.

Distance to all other vertices


S K a b c d L

K 0 3(K, c) 7(K, c) 2(K) 7(K, c, a) 8(K, c, b)

Step4: The vertex which is next nearest to K is d, is included in S.

Distance to all other vertices


S K a b c d L

K(c, a, b, d) 0 3(K, c) 7(K, c) 2(K) 7(K, c, a) 8(K, c, b)

Since, n-1 vertices are included in S. Hence we have found the shortest distance from K to all
other vertices. Thus, the shortest distance between K and L is 8 and the shortest path is K, c, b,
L.

Binary Tree and Full Binary Tree


A binary tree is a type of data structure where each node can only have two offspring at most
named as “left” and “right” child.
A Binary Tree
There are different types of binary tree but here we are going to discuss the difference between
Complete binary tree and Full binary tree.
Full Binary Tree:
A full binary tree is a binary tree in which all of the nodes have either 0 or 2 offspring. In other
terms, a full binary tree is a binary tree in which all nodes, except the leaf nodes, have two
offspring.

A Full Binary Tree Let, i be the number of internal nodes,


n be the total number of nodes, l be number of leaves, λ be number of levels
Then,
The number of leaves is (i + 1).
The total number of nodes is (2i + 1).
The number of internal nodes is (n – 1) / 2.
The number of leaves is (n + 1) / 2.
The total number of nodes is (2l – 1).
The number of internal nodes is (l – 1).
The number of leaves is at most (2λ – 1).
Complete Binary Tree:
A binary tree is said to be a complete binary tree if all its levels, except possibly the last level,
have the maximum number of possible nodes, and all the nodes in the last level appear as far
left as possible.

A Complete Binary Tree


There are 2 points that you can recognize from here,

1. The leftmost side of the leaf node must always be filled first.
2. It isn’t necessary for the last leaf node to have a right sibling.
Example 1:
Full but not complete

● All of the nodes have either 0 or 2 offspring, therefore, it is a Full binary tree.
● It is not a Complete binary tree because node B has no children whereas node C has
children, and according to a complete binary tree, nodes should be filled from the
left side.
Hence, the binary tree shown above is a Full binary tree and it is not a Complete binary tree.

Example 2:

Neither complete nor full

● Node C has just one child therefore, it is not a Full binary tree.
● Node C also has a right child but no left child, therefore it is also not a Complete
binary tree.
Hence, the binary tree shown above is neither complete nor full binary tree.

Weighted Trees
A tree to whose nodes and/or edges labels (usually number) are assigned.

The word "weight" also has a more specific meaning when applied to trees, namely the weight
of a tree at a point a is the maximum number of edges in any branch at a(Harary 1994, p. 35), as
illustrated above. A point having minimal weight for the tree is called a centroid point, and the
tree centroid is the set of all centroid points.

Example 1:
This is the tree that Rick Decker used in his answer. Each node of the tree that isn’t a leaf has
two edges leading down from it; the one to the left is labeled with a red 0 and the one to the
right with a red 1 think of the tree as a road map; a string of red numbers can be used to describe
how to get from the root (85) to one of the leaves. To get from the root to the leaf 13, for
instance, you must go left (0), then right (1), then left (0) again, so the route is 010, and that’s
the code assigned to the weight 13 leaf.
Notice that the most heavily weighted leaves − the two 17’s − are closest to the root and so have
the shortest codes; this is what makes the Huffman encoding efficient.

Example 2:
Input:

Output: 5
Weight of sub-tree for parent 1 = ((-1) + (5) + (-2) + (-1) + (3)) = 4
Weight of sub-tree for parent 2 = ((5) + (-1) + (3)) = 7
Weight of sub-tree for parent 3 = -1
Weight of sub-tree for parent 4 = 3
Weight of sub-tree for parent 5 = -2
Node 5 gives the minimum sub-tree weighted sum.

You might also like