Computing Algorithms Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Computing

Algorithms
12th Week Project

• Done By :

• Abdalrahman Sherif Ibrahim – 20107171

• Nadine Mohammed – 20107088

• Sara Ashraf - 20105551


Project Idea: (6)
• Project 6 Write a code that constructs a graph. After creating the graph, the code should
check whether the graph is: a. Connected. b. acyclic. The above check will be done
using Depth-First-Search (DFS) and implemented by both adjacency matrix and
adjacency list.
Rubric
Objectives:

Explain the difference between Acyclic and Cyclic graphs.

Illustrate the difference between connected and disconnected graphs.

Explain the code implementation and demonstrate graph visualization.

Present and discuss different inputs to showcase the differences.


What is the difference between Cyclic
& Acyclic graphs?

• A graph that contains at least


one cycle is known as a
cyclic graph. Conversely, a
graph that contains zero
cycles is known as an acyclic
graph.
Additional
examples for
illustration.
2. Illustrate the
difference between
connected &
disconnected graphs.

• A graph is said to be connected graph


if there is a path between every pair of
vertex. From every vertex to any other
vertex there must be some path to
traverse. This is called the connectivity
of a graph. A graph is said to be
disconnected, if there exists multiple
disconnected vertices and edges.
3. Code
Implementation
(step-by-step)
using Python.
1. Import libraries
2. Define the graph class
3. Initialize the graph.

Importing libraries ,
Defining & initializing
the graph class.
• 4. Add edges to the graph
• 5. Check if the graph is
connected
• 6. Check if the graph is acyclic
• 7. Performing Depth-First Search
(DFS):
8.Checking for Cycles using DFS:
9.Visualizing the Graph:
Main
function
4. Present and discuss different
inputs to showcase the
differences.
In that case the graph is acylic & connected.
1
2
In that case the graph is cyclic &
disconnected.
3
In that case the graph is acylic &
disconnected.
4
In that case the graph is Cyclic &
connected.
Conclusion

In this project, we learned about graphs and their


properties. We implemented code to determine if
a graph is cyclic or acyclic, as well as connected or
disconnected. The visualization feature helped us
better understand the graphs by displaying them
visually. Overall, this project provided an
introduction to graph theory concepts and allowed
us to explore different types of graphs.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy