0% found this document useful (0 votes)
138 views10 pages

Mini Project

The document presents a mini project on directed graphs, detailing the definitions of adjacency lists and matrices as graph representations. It analyzes the theoretical and experimental time complexities of graph operations, concluding that both are O(n^2). The findings are supported by a trendline equation indicating a quadratic relationship between computational time and input size.

Uploaded by

fkfardinkhan007
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)
138 views10 pages

Mini Project

The document presents a mini project on directed graphs, detailing the definitions of adjacency lists and matrices as graph representations. It analyzes the theoretical and experimental time complexities of graph operations, concluding that both are O(n^2). The findings are supported by a trendline equation indicating a quadratic relationship between computational time and input size.

Uploaded by

fkfardinkhan007
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

Mini project

Group : 07 (Mini Project 1)


CSE 106
Discrete Mathematics
Section : 01
Submitted to:
Md. Mozammel Huq Azad Khan, PhD
Professor, CSE Department, East West University

Submitted by :
Proyas Pratim Nandi Samya
ID: 2024-3-60-491
Md. Shakib Hassan
ID: 2024-3-60-676
Tahsin Mahmud
2024-3-60-698
Directed Graph :

A directed graph is defined by a set of vertices and a set of directed edges.

V5
V1
E1 E6 E5
V6 E4
V2

E2 V4

V3 E3
Presenting Graph
Graph

Adjacency List Adjacency Matrix

Adjacency List : A adjacency list is a way of representing a graph using a


collection of lists or array.

Adjacency Matrix : An adjacency matrix is a way of representing a graph using a


2D array.
Outputs :
Theoretical Time Complexity :

Time complexity represents how the computational time of a program increases as the input size grows.

We use an n × n adjacency matrix to represent the graph.

To generate the graph, we fill an n × n matrix, which requires O(n^2) operations.

For each of the n vertices, we perform O(n^2) operations to calculate both in-degree and out-degree.

Total operations = O(n) × O(n)


= O(n^2)

Total time complexity = O(n^2) + O(n^2)


= O(n^2)
Experimental time complexity ( from graph ) :

The equation of the trendline was of the form :


Y = 0.003x^2 + 0.14x + 10

The highest degree term in the equation is x^2, which confirms that the time complexity grows quadratically with n.

The trendline shows a quadratic relationship between the computational time and n.

The experimental results also suggest that the complexity of the program is O(n^2).

Comparison : Theoretical vs Experimental :

From analyzing the code, we determined that the time complexity is O(n^2).

From the excel graph and the polynomial trendline, confirming that the experimental time complexity ia also O(n^2).

Both the theoretical and experimental time complexity of the program are O(n^2).
Thank You

You might also like