4.8 out of 5
4.8
24 reviews on Udemy

Graph theory algorithms visualized

Unleash the power of graph theory with cutting-edge algorithms
Instructor:
Inside Code
417 students enrolled
English [CC]
Learn graphs terminology and representation
Learn graph traversal
Learn algorithms related to various graph theory topics (shortest paths, minimum spanning trees...)
Solve graph related coding interview problems

This Graph theory algorithms will teach students the fundamental concepts and algorithms of graph theory with real life examples and eye-appealing visualizations. The course will cover topics such as graph representation, graph traversal, topological sort, shortest paths, minimum spanning trees, graph coloring… With a total of more than 20 covered algorithms.

Discussed algorithms will be implemented in detail by using a programming language to give a better understanding for students. Captions, practice problems, quizzes, slides, and source code will also be here to make the learning experience way better. 

By the end of the course, students will have a strong understanding of graph algorithms and be able to apply their knowledge to solve problems in computer science, mathematics, and beyond.

This course is ideal for students who are looking to pursue careers in computer science, mathematics, or related fields, as well as for professionals who want to expand their knowledge of graph theory algorithms.

Covered algorithms:

  • Graph traversal:

    • Depth-first search

    • Breadth-first search

  • Topological sorting:

    • Depth-first search based topological sort

    • Breadth-first search based topological sort (Kahn’s algorithm)

  • Shortest path:

    • Dijkstra’s algorithm

    • Bellman-Ford algorithm

    • Floyd-Warshall algorithm

    • Johnson’s algorithm

    • Shortest path for unweighted graphs algorithm

    • Shortest path for directed acyclic graphs

    • A* algorithm

  • Trees and minimum spanning trees:

    • Spanning tree algorithm

    • Graph to out-tree algorithm

    • Prim’s algorithm

    • Kruskal’s algorithm

  • Eulerian/Hamiltonian paths and cycles:

    • Hierholzer’s algorithm

    • Hamiltonian cycle backtracking algorithm

  • Graph coloring:

    • 2-colorability algorithm

    • k-colorability backtracking algorithm

    • Greedy coloring algorithm

    • Welsh-Powell heuristic

    • DSatur heuristic

  • Traveling Salesman Problem:

    • TSP Brute force solution

    • TSP Backtracking solution

    • TSP Dynamic programming solution

    • Nearest Neighbor algorithm

    • Sorted Edges algorithm

    • Christofides algorithm

  • Maximum flow problem:

    • Ford-Fulkerson algorithm

    • Edmonds-Karp algorithm

    • Dinic’s algorithm

    • Hopcroft-Karp algorithm

Introduction

1
Introduction to graph theory

An introduction to graph theory and problems it can solve, with various real life examples, and what is a graph?

2
[IMPORTANT] Before we start

Important points that have to be read to have a better learning experience

3
Terminology and types of graphs

Types of graph (edgeless, complete, bipartite...) and important terms that are good to know for this course, with illustrations

4
Quiz: Terminology and types of graphs

A quiz to practice on terminology and types of graphs

Graph representation

1
Adjacency list representation

One of the possible ways to represent a graph in memory: the adjacency list. Explained in this lecture with an example and the implementation

2
Adjacency matrix representation

Another way of representing graphs in memory: the adjacency matrix. Also explained with an example and the implementation

3
Adjacency list vs adjacency matrix

A comparison between the adjacency list and the adjacency matrix in terms of time and space resources, to know which one to choose

4
Quiz: Adjacency lists and matrices

Graph traversal

1
Depth-first search (DFS) algorithm

One of the most fundamental graph algorithms to know: Depth-first search. It's a traversal algorithm that is explained in this lecture with a full animated example, implementation, and complexity analysis

2
Problem: Path exists in a graph

A classic problem to practice on depth-first search, where the goal is to find if there exists a path from a source vertex to a destination vertex

3
Solution: Path exists in a graph

A solution to the "Path exists in graph" problem, explained and implemented

4
Breadth-first search (BFS) algorithm

Another fundamental graph algorithm to know: Breadth-first search. It's a traversal algorithm that is explained in this lecture with a full animated example, implementation, and complexity analysis

5
Problem: Minimum edges from start to end

A classic problem to practice on breadth-first search, where the goal is to find the minimum number of edges required to go from a source vertex to a destination vertex

6
Solution: Minimum edges from start to end

A solution to the "Minimum edges from start to end" problem, explained and implemented

7
DFS and BFS in implicit graphs

Graphs can appear in many ways, not in the form of an adjacency list or matrix only, they can be implicit. For example, a grid can be considered as a graph! This is what we talk about in this lecture, with examples and implementation of dfs and bfs on a grid

8
Quiz: DFS and BFS

A quiz to practice on algorithms learnt during this chapter (depth-first search and breadth-first search)

Topological sort

1
What is topological sort?

We can have a situation where elements have dependencies, for example tasks that require finishing other tasks before doing the current one (e.g.: Before painting a wall, we need to build it). And we may want a sequential ordering of elements that handles dependencies, this is where topological sorting comes in!

2
DFS-based topological sort algorithm

A first algorithm that is based on depth-first search to apply topological sorting, explained with an animated example then the implementation and time complexity analysis

3
BFS-based topological sort algorithm (Kahn's algorithm)

A second algorithm that is based on breadth-first search to apply topological sorting, Kahn's algorithm, explained with an animated example then the implementation and time complexity analysis

4
Problem: Find all possible recipes

An interesting problem that we solve by using topological sorting, the "Find all possible recipes" problem!

5
Solution: Find all possible recipes

A solution to the "Find all possible recipes" problem, explained with an animated example then the implementation and time complexity analysis

6
Quiz: Topological sort

Shortest path problem

1
Introduction to the shortest path problem

One of the most important subtopics of graph theory: Shortest path problem, the problem of finding the shortest path from a source vertex to a destination vertex, introduced in this lecture with different variations

2
Dijkstra's algorithm

A fundamental graph theory algorithm: Dijkstra's algorithm, an algorithm that solves the single-source shortest path problem, explained in this lecture with the intuition behind it, a full example, pseudocode, implementation, path reconstruction, comparison between various implementations (sorted array, binary heap, Fibonacci heap), time complexity analysis, and limitations

3
Bellman-Ford algorithm

Another single-source shortest path problem algorithm: Bellman-Ford algorithm. Explained in this lecture with the intuition behind it, an example, its dynamic programming aspect, implementation, time complexity analysis, and a comparison with Dijkstra's algorithm

4
Floyd-Warshall algorithm

A fundamental algorithm that solves the all-pairs shortest path problem: Floyd-Warshall algorithm. Explained in this lecture with the intuition behind it, an example, its dynamic programming aspect, implementation, time complexity analysis, and why it's efficient with dense graphs

5
Johnson's algorithm

Another all-pairs shortest path problem algorithms: Johnson's algorithm. An algorithm that combines Dijkstra's algorithm and Bellman-Ford algorithm to create an algorithm that is efficient for sparse graphs. It's explained in this lecture with an example, how to reweight edges, why it works, implementation, time complexity analysis, and a comparison with Floyd-Warshall algorithm

6
Shortest path in unweighted graphs

We may want to find the shortest path in an unweighted graph, such that the length of a path is defined by its number of edges. Instead of turning it to a weighted graph and use one of the previous algorithms, we can use a more efficient algorithm, it's explained in this lecture with an example, implementation, and time complexity analysis

7
Shortest path in directed acyclic graphs

Directed acyclic graphs are special cases of graphs where we can use more efficient shortest path algorithms, the topic of this lecture. We will study two approaches, an example for each, with implementation and time complexity analysis for both of them

8
A* algorithm
9
Solution: Cheapest flights within k stops
10
Quiz: Shortest path problem

A quiz to strengthen knowledge on algorithms taught in this chapter

Trees

1
What is a tree?

Trees are one of the types of graphs, that come in many applications, this is why we study them in this lecture with definitions and examples, and how to check if a given graph is a tree or not

2
Out-trees (arborescence) and graph to out-tree conversion

Out-trees are in reality the classic tree data structure you probably know about, you know, the one that has a root made of a value and multiple trees as children. We study the concept in this lecture with definitions and examples, and how to turn a graph into an out-tree

3
Problem: All nodes distance k in a tree

A problem to practice on trees: All nodes distance k in a tree, we want nodes we can reach by performing k moves from the start node

4
Solution: All nodes distance k in a tree

A solution to the "All nodes distance k in a tree" problem, explained with an example, implementation, and time complexity analysis

5
Quiz: What is a tree?

Minimum spanning trees

1
What is a (minimum) spanning tree?

Minimum spanning trees (MSTs) are an important topic in graph theory, they appear in many real life problems. We introduce them in this lecture.

2
Prim's algorithm

Prim's algorithm is one of the algorithms that find the minimum spanning tree of a graph, we study it in this lecture with a full example, implementation, and how we improve the approach and use a Fibonacci heap to have a lower time complexity

3
Kruskal's algorithm

Kruskal's algorithm is another minimum spanning tree algorithm that works that always adding the lightest edge that doesn't form a cycle in the MST. We explain it in this lecture with an example, implementation, and why we use a disjoint-set (union find) data structure to improve the time complexity

4
Problem: Min cost to connect all points

A problem to practice on minimum spanning trees: Min cost to connect all points.

5
Solution: Min cost to connect all points problem

A solution to the "Min cost to connect all points" problem, illustrated with an example and the implementation, and which algorithm to use, Prim or Kruskal, to get a better time complexity

6
Quiz: Minimum spanning trees

Eulerian and Hamiltonian paths/cycles

1
What is a Eulerian path/cycle?

We may want a path that passes from each edge exactly once, that's what we call a Eulerian path. In this lecture, we study Eulerian paths, Eulerian cycles, when is a graph considered semi-Eulerian, Eulerian, and what are conditions it needs to respect, all that with examples of course

2
Hierholzer's algorithm

Hierholzer's algorithm is an algorithm that finds a Eulerian path in a graph, we study it in this lecture with a full animated example, implementation, and time complexity analysis

3
Problem: Reconstruct itinerary

A problem to practice on Eulerian paths: Reconstruct itinerary

4
Solution: Reconstruct itinerary

A solution to the "Reconstruct itinerary" problem, with an example, implementation, and time complexity analysis

5
What is a Hamiltonian path/cycle?

We may want a path that passes from each vertex exactly once this time, that's what we call a Hamiltonian path. In this lecture, we study Hamiltonian paths, Hamiltonian cycles, when is a graph considered semi-Hamiltonian, Hamiltonian, and do we have ways to know if a graph is Hamiltonian quickly, with examples obviously

6
Hamiltonian cycle finding backtracking algorithm

In this lecture, we discuss an algorithm that uses backtracking to find a Hamiltonian cycle in a graph, with a full animated example, implementation, and time complexity analysis

7
Quiz: Eulerian and Hamiltonian paths/cycles

A multiple choices questions quiz on Eulerian and Hamiltonian paths/cycles to strengthen the knowledge gained during this chapter

Cuts and connectivity

1
Introduction
2
Tarjan's algorithm for finding SCCs
3
Kosaraju's algorithm for finding SCCs
4
Articulation points finding algorithm
5
Solution: Minimum days to disconnect island
6
Quiz: Cuts and connectivity

A quiz to strengthen your knowledge on concepts and algorithms presented in this chapter

Graph coloring

1
Introduction to graph coloring

Let's say you have multiple rides to perform in a day, each with a start and end time. You may not be able to use only one car for them all because some of them may overlap in time. How to calculate the minimum number of required cars then? This is where graph coloring comes in, discover it in this lecture along with multiple examples, important definitions, lower and upper bounds of the minimum number of colors (chromatic number), and the four color theorem

2
Checking 2-colorability (bipartite graph)

Checking if a graph can be colored with only 2 colors is equivalent to checking if it's bipartite, this is what we learn to do in this lecture, with an example, implementation, and time complexity

3
Checking k-colorability with backtracking

To find if a graph can be colored with at most k colors and find its chromatic number, we can use backtracking, this is what we learn to do in this lecture, with an example, implementation, and time complexity

4
Greedy coloring

The algorithm of the previous lecture is really slow, we may want a faster algorithm, one that runs in linear time, even if it doesn't always give the optimal result. This is what we learn about in this lecture: greedy coloring, an approximation algorithm for graph coloring problem. You will find an example, its lower and upper bound, implementation, and time complexity analysis

5
Heuristics (Welsh-Powell, DSatur)

Greedy coloring doesn't always give good results, it may give really bad examples because of a bad vertex traversal ordering. To improve the way we choose the ordering, we can use heuristics such as Welsh-Powell and DSatur, the topic of this lecture. Both heuristics are illustrated with an example, implementation, and time complexity analysis

6
Problem: Sudoku solver

Sudoku is a popular grid game that you probably played before, in this problem you are asked to solve it by using graph coloring

7
Solution: Let's make a Sudoku solver

In this lecture, we learn how to solve a Sudoku grid with graph coloring, with an example and the implementation

8
Quiz: Graph coloring

Traveling Salesman Problem

1
Introduction to Traveling Salesman Problem
2
Brute force and backtracking solution for TSP
3
Dynamic programming solution for TSP
4
Nearest Neighbor algorithm and Sorted Edges algorithm
5
Christofides algorithm
6
Problem: Find the shortest superstring (LeetCode #943)
7
Solution: Find the shortest superstring (LeetCode #943)
8
Quiz: Traveling Salesman Problem

A quiz to strengthen knowledge on TSP and its algorithms

Maximum flow problem

1
Introduction
2
Ford-Fulkerson algorithm
3
Edmonds-Karp algorithm
4
Dinic's algorithm
5
Hopcroft-Karp algorithm (unweighted bipartite matching)
6
Problem: Maximum students taking exam (LeetCode #1349)
7
Solution: Maximum students taking exam (LeetCode #1349)
8
Quiz: Maximum flow problem

A quiz to strengthen your knowledge on the maximum flow problem and its algorithms

Practice problems

1
Problem: Keys and rooms (LeetCode #841)

Practice problem: Keys and rooms, the LeetCode problem number 841

2
Solution: Keys and rooms (LeetCode #841)

We solve the Keys and rooms practice problem, by using both depth-first search and breadth-first search

3
Problem: Rotting oranges (LeetCode #994)

Practice problem: Rotting oranges, the LeetCode problem number 994

4
Solution: Rotting oranges (LeetCode #994)

We solve the Rotting oranges problem by applying our knowledge on implicit graphs, because we work on a grid

5
Problem: Alternating color path (LeetCode #1129)

Practice problem: Alternating color path, the LeetCode problem number 1129

6
Solution: Alternating color path (LeetCode #1129)

We solve the Alternating color path problem, we see how we can adapt bfs to introduce a new constraint

7
Problem: Sum of distances in tree (LeetCode #834)

Practice problem: Sum of distances in tree, the LeetCode problem number 834

You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.8
4.8 out of 5
24 Ratings

Detailed Rating

Stars 5
18
Stars 4
6
Stars 3
0
Stars 2
0
Stars 1
0