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

Computing Algorithms Project

The document summarizes a 12th week computing project to write code that constructs a graph and checks whether it is connected and/or acyclic using depth-first search implemented with adjacency matrix and list. It explains the differences between cyclic and acyclic graphs and connected and disconnected graphs. The code implementation overview includes importing libraries, defining a graph class, initializing the graph, adding edges, checking connectivity and acyclicity with DFS, and visualizing the graph. Different graph inputs are presented and discussed to showcase the property differences.

Uploaded by

Nadine Mostafa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Computing Algorithms Project

The document summarizes a 12th week computing project to write code that constructs a graph and checks whether it is connected and/or acyclic using depth-first search implemented with adjacency matrix and list. It explains the differences between cyclic and acyclic graphs and connected and disconnected graphs. The code implementation overview includes importing libraries, defining a graph class, initializing the graph, adding edges, checking connectivity and acyclicity with DFS, and visualizing the graph. Different graph inputs are presented and discussed to showcase the property differences.

Uploaded by

Nadine Mostafa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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