[Video Tutorial Series] Graph Theory: From Beginner to Intermediate - Dardev

Hi,

I am planning to post all solutions of CSES graph series; while also discussing the necessary theory involved.

Update: I reuploaded the first 12 videos with better audio quality. All audios are good now.

Here is the entire playlist: https://www.youtube.com/watch?v=oglZA8d6rRw&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3

  1. Intro part 1: https://www.youtube.com/watch?v=oglZA8d6rRw

  2. Intro part 2: https://www.youtube.com/watch?v=5NOQmseaH6A

  3. CSES 1: Counting Rooms(1192): https://www.youtube.com/watch?v=WUqkIH1gHMM

  4. CSES 2: Labyrinth(1193): https://www.youtube.com/watch?v=s0DnJ0CdNEE

  5. CSES 3: Building Roads: https://www.youtube.com/watch?v=ZuahPX13NR4

  6. CSES 4: Message Route https://www.youtube.com/watch?v=TJolGL0G3O4

  7. CSES 5: Building Teams: https://www.youtube.com/watch?v=MDTq58KLIx0

  8. CSES 6: Round Trip: https://www.youtube.com/watch?v=qYyyj2SRsRc

  9. CSES 7: Monsters: https://www.youtube.com/watch?v=hB59dxdDLII

  10. Theory Time: Heaps Part 1 — Intro to Heaps, Trees, Rooting a Tree, Binary Tree, Complete Binary Tree https://www.youtube.com/watch?v=pc-m_251X6k

  11. Theory Time: Heaps Part 2 — Inserting, Retrieving, Heapfication into Heap https://www.youtube.com/watch?v=LzBJefIvZ80

  12. Theory Time: Heaps Part 3 — Flattening Heap into Vector. Navigating a Flattened Tree https://www.youtube.com/watch?v=HZYeAEaT5j0

  13. CSES 8: Shortest Routes I: https://www.youtube.com/watch?v=ditJWdFqoXk

  14. CSES 9: Shortest Routes II: https://www.youtube.com/watch?v=sdy6qXlB7g8

  15. CSES 10: High Score: https://www.youtube.com/watch?v=2Epc8xZObIc

  16. CSES 11: Flight Discount: https://www.youtube.com/watch?v=GZtZXhir7Wg

  17. CSES 12: Cycle Finding: https://www.youtube.com/watch?v=kZfm68XKC58

  18. CSES 13: Flight Routes: https://www.youtube.com/watch?v=009PBKHXtyA

  19. CSES 14: Round Trip II: https://www.youtube.com/watch?v=kzeAHV2Pw2o

  20. CSES 15: Course Schedule: https://www.youtube.com/watch?v=NLgYD6oFK2E

  21. CSES 16: Longest Flight Route: https://youtu.be/9HMawd5jn9A

  22. CSES 17: Game Routes: https://youtu.be/g_1qUIlpuzg

  23. CSES 18: Investigation: https://youtu.be/Obwl9U6i-6o

  24. CSES 19: Planet Queries I

  25. Planet Queries II

29 Likes

Very underrated. Your explanations are amazing!

9 Likes

i agree

4 Likes

I liked how you submitted your single source BFS code to prove that it won’t work.

4 Likes

Thanks! I am glad you are following the series.

Here are the updates:

  1. I solved another CSES problem: Lava Flow and Multisource BFS
    https://www.youtube.com/watch?v=Hbi8HbAhNXg&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3&index=8

  2. Introduction to Trees, Binary Trees, Min/Max Heaps, Flattening a Tree into a Vector
    https://www.youtube.com/watch?v=_l5qVB66YGg&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3&index=9

  3. I made an introductory video 00 to make things even simpler
    https://www.youtube.com/watch?v=BRSTzBEGwyI&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3&index=1

  4. I am reuploading the solution to the first problem, for greater audio clarity and better explanation/presentation
    https://www.youtube.com/watch?v=2-pLGwqzknA&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3&index=2

6 Likes

Today I will try and share Dijkstra theory while solving the next CSES problem.

7 Likes

Language dependent or independent videos ?

2 Likes

I explain concepts in English. But my implementation is in C++, I explain every critical aspect of code though. Just check it out, you’ll like it.

5 Likes

This video series is really helpful! I am really excited about this series and will keep posting updates to support you. I just finished the first two videos. Nice explanation of BFS and DFS on the grid.

1 Like

Thanks a lot for you effort and hard work. It is really helpful for the coding comminity.

1 Like

Thank you guys. Please subscribe! Its a humble request. Will post more videos soon.

3 Likes

Hey please try to make a few more videos on Dijkstra algo, with some interesting problems

1 Like

Done with Dijkstra:: https://www.youtube.com/watch?v=ditJWdFqoXk

Do give feedback, please!

5 Likes

I updated the Dijkstra’s with more information/explanation/simulation/demonstration! :slight_smile:

2 Likes

I will be adding Bellman-Ford and solving more problems starting tomorrow.

You guys can expect a lot more Dijkstra variants too :slight_smile:

Please keep following this series to improve your understanding of graph theory.

1 Like

Hey, can you help me with this problem?

Check out my DFS

void dfs(int u)
{
	for(idx[u]; idx[u] < g[u].size(); idx[u]++)
	{	
		int v = g[u][idx[u]];
		int x = u;
		int y = v;
		if(x > y)
		{
			swap(x,y);
		}
		if(edge[x].find(y) == edge[x].end()) continue;

		edge[x].erase(y);
		--degree[u];
		--degree[v];
		dfs(v);
	}
	stck.push(u);
}

See what i did there? I created a global vector idx and did the following to track the edge being currently explored.

for(idx[u]; idx[u] < g[u].size(); idx[u]++)

When I come back, I don’t start checking ALL neighbours of vertex ‘u’. I simply continue from where I left. Hope that makes sense?

If we don’t take care of this, we will search ALL edges every time in the following case. I am calling this graph a flower-with-petal graph. Only seven petals in this graph, but imagine what happens if there are 10^5 petals (with O(N^2) complexity)

image

If it doesn’t I am not going to type out more here. I try to make a Eulerian Circuit video on priority and explain this aspect clearly.

Watch out for this video series: https://www.youtube.com/watch?v=BRSTzBEGwyI&list=PL2S6Mj7iLqEjNVq0e-pZ9rSnpAacHzVm3

1 Like


One can also follow this

1 Like

Hey guys! Just solved another problem for you guys: High Score and this time we study the “Bellman-Ford” Algorithm.

Hope you’ll love it.

3 Likes

one of the best graph theory tutorial is by Code N Code

1 Like