0% found this document useful (0 votes)
124 views6 pages

Mohd Talib Akhtar B.Tech (Lateral Entry) Section-B Iv Semester Discrete Mathematics Assignment ENROLL NO.: 2019-208-007

The document discusses different types of graphs including directed and undirected graphs, connected and disconnected graphs, and weighted graphs. It also covers trees, rooted trees, and binary search trees. Key points include: - A graph consists of vertices and edges that connect pairs of vertices. - Graphs can model real-world networks and are used in applications like social media. - Directed graphs have edges with directions, while undirected graphs do not. - A connected graph has a path between all vertex pairs, while disconnected graphs lack some paths. - Weighted graphs assign weights to edges. - Trees are connected acyclic graphs with no cycles.

Uploaded by

umair riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views6 pages

Mohd Talib Akhtar B.Tech (Lateral Entry) Section-B Iv Semester Discrete Mathematics Assignment ENROLL NO.: 2019-208-007

The document discusses different types of graphs including directed and undirected graphs, connected and disconnected graphs, and weighted graphs. It also covers trees, rooted trees, and binary search trees. Key points include: - A graph consists of vertices and edges that connect pairs of vertices. - Graphs can model real-world networks and are used in applications like social media. - Directed graphs have edges with directions, while undirected graphs do not. - A connected graph has a path between all vertex pairs, while disconnected graphs lack some paths. - Weighted graphs assign weights to edges. - Trees are connected acyclic graphs with no cycles.

Uploaded by

umair riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MOHD TALIB AKHTAR

B.TECH (LATERAL ENTRY)


SECTION-B IV SEMESTER
DISCRETE MATHEMATICS ASSIGNMENT
ENROLL NO. : 2019-208-007

GRAPH:
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are
sometimes also referred to as vertices and the edges are lines or arcs that connect any two
nodes in the graph. More formally a Graph can be defined as,
A Graph consists of a finite set of vertices(or nodes) and set of Edges which connect a pair of
nodes.

In the above Graph, the set of vertices V = {0,1,2,3,4} and the set of edges E = {01, 12, 23,
34, 04, 14, 13}.
Graphs are used to solve many real-life problems. Graphs are used to represent networks. The
networks may include paths in a city or telephone network or circuit network. Graphs are also
used in social networks like linkedIn, Facebook. For example, in Facebook, each person is
represented with a vertex(or node). Each node is a structure and contains information like
person id, name, gender, locale etc.

Types

 Directed Graph & Undirected Graph

Directed Graphs: A directed graph or digraph G is defined as an unordered pair


(V, E), where V is the set of points called vertices and E is the set of edges. Each
edge in the graph G is assigned a direction and is identified with an ordered pair
(u, v), where u is the initial vertex, and v is the end vertex.
Example: Consider the graph G = (V, E) as shown in fig. Determine the vertex
set and edge set of graph G.

Solution: The vertex and edge set of graph G =(V, E) is as follow


G={{1,2,3},{(1,2),(2,1),(2,2),(2,3),(1,3)}}.

Undirected Complete Graph: An undirected complete graph G=(V,E) of n vertices is a


graph in which each vertex is connected to every other vertex i.e., and edge exist
between every pair of distinct vertices. It is denoted by Kn.A complete graph with n

vertices will have edges.

Example: Draw Undirected Complete Graphs k4and k6.

Solution: The undirected complete graph of k4 is shown in fig1 and that of k6is shown in
fig2.
 Connected Graph & Disconnected Graph

Connected Graph : A graph is called connected if there is a path from any vertex u to
v or vice-versa.
Disconnected Graph : A graph is called disconnected if there is no path between any
two of its vertices.
Example: Consider the graph shown in fig. Determine whether the graphs are
(a)Disconnected Graph
(b)Connected Graph.
Also, write their connected components.

Solution:
(i) The graph is shown in fig is a Disconnected Graph, and its connected components
are
{V1,V2,V3,V4},{V5,V6,V7,V8} and {V9,V10}.
(ii) The graph shown in fig is a Disconnected Graph and its connected components are
{V1,V2},{V3,V4},{V5,V6},{V7,V8},{V9,V10}and {V11,V12}.
 Weighted Graph

Weighted Graphs: A graph G=(V, E) is called a weighted graph if each edge of graph
G is assigned a positive number w called the weight of the edge e.
Example: The graph shown in fig is a Weighted Graph.
Tree:
A connected acyclic graph is called a tree. In other words, a connected graph with no cycles
is called a tree.
The edges of a tree are known as branches. Elements of trees are called their nodes. The
nodes without child nodes are called leaf nodes.
A tree with ‘n’ vertices has ‘n-1’ edges. If it has one more edge extra than ‘n-1’, then the
extra edge should obviously has to pair up with two vertices which leads to form a cycle.
Then, it becomes a cyclic graph which is a violation for the tree graph.

Example 1

The graph shown here is a tree because it has no cycles and it is connected. It has four
vertices and three edges, i.e., for ‘n’ vertices ‘n-1’ edges as mentioned in the definition.

Properties of Trees:

1. There is only one path between each pair of vertices of a tree.


2. If a graph G there is one and only one path between each pair of vertices G is a tree.
3. A tree T with n vertices has n-1 edges.
4. A graph is a tree if and only if it a minimal connected.
Rooted Tree
A rooted tree GG is a connected acyclic graph with a special node that is called the root of
the tree and every edge directly or indirectly originates from the root. An ordered rooted tree
is a rooted tree where the children of each internal vertex are ordered. If every internal
vertex of a rooted tree has not more than m children, it is called an m-ary tree. If every
internal vertex of a rooted tree has exactly m children, it is called a full m-ary tree.
If m=2m=2, the rooted tree is called a binary tree.

Binary Search Tree

Binary Search tree is a binary tree which satisfies the following property −

 XX in left sub-tree of vertex V,Value(X)≤Value(V)V,Value(X)≤Value(V)


 YY in right sub-tree of vertex V,Value(Y)≥Value(V)V,Value(Y)≥Value(V)
So, the value of all the vertices of the left sub-tree of an internal node VV are less than or
equal to VV and the value of all the vertices of the right sub-tree of the internal node VV are
greater than or equal to VV. The number of links from the root node to the deepest node is
the height of the Binary Search Tree.

Example

You might also like