General
Computer Science
-
1. Introduction to Computer Science
-
Introduction to Computer Science
-
History of Computer Science
-
Fundamentals of Computer Science
-
Algorithms
-
Data Structures
-
Programming Concepts
-
Web Development
-
Databases and SQL
-
Networking and Security
-
Artificial Intelligence and Machine Learning
-
Mobile App Development
-
Game Development
-
Future of Computer Science
-
Careers in Computer Science
Legacy Course
Graph Algorithms
Graph algorithms are methods used to manipulate and analyze the structureThe organisation and order of information in a text. of a graph. Three common graph algorithms are breadth-first search, depth-first search, and Dijkstra's algorithm for finding the shortest path.
Breadth-first search (BFS) is an algorithm used to traverse a graph. It starts at a given vertex (node) and explores all of its neighboring vertices before moving on to the next level of vertices. This process continues until all vertices in the graph have been visited. The time complexity of BFS is O(V + E), where V is the number of vertices and E is the number of edges in the graph. BFS is often used to find the shortest path in an unweighted graph.
Depth-first search (DFS) is another algorithm used to traverse a graph. It starts at a given vertex and explores as far as possible along each branch before backtracking. The time complexity of DFS is also O(V + E). DFS is often used to find a path between two vertices or to perform a topological sort of a directed acyclic graph (DAG).
Dijkstra's algorithm is used to find the shortest path between two vertices in a weighted graph. The algorithm starts at the source vertex and assigns a tentative distance to each vertex. The algorithm then selects the vertex with the smallest tentative distance and updates the tentative distance of its neighbors. This process is repeated until the target vertex is reached or all vertices have been visited. The time complexity of Dijkstra's algorithm is O(V2) or O(E + VlogV) using a priority queue.
Continue the lesson
This section is available to learners with course access. Continue learning with Knowness to unlock the full explanation, examples, revision tools, and progress tracking.
The remaining lesson content includes further guided explanation, important learning points, and supporting interactive material designed to help you understand and revise this topic.
Unlock this topic to view the full activity, worked examples, common mistakes, and additional revision support.
More content available
Knowness lessons are structured to build understanding step by step. Create an account or upgrade your access to continue from this point.
This preview does not include the hidden lesson text, answers, explanations, or embedded interactions.
Continue learning with Knowness
Sign up to access the full lesson, predicted grades, revision tools, progress tracking, and more.
Create a free account