In this lesson, we look at the graph data structure and implement common graph algorithms like breadth-fist search, depth-first search, and shortest paths.

Asking/Answering Questions :
Reply to this thread to ask questions. Before asking, scroll through the thread and check if your question (or a similar one) is already present. If yes, just like it. We will give priority to the questions with the most likes. The rest will be answered by our mentors or the community. If you see a question you know the answer to, please post your answer as a reply to that question. Let’s help each other learn!

Hi, the notebook is not updated with the lecture material. Seems Aakash forgot to commit the notebook. Can we have the codes recreated in the notebook, please?

I practiced it from This: https://www.geeksforgeeks.org/detect-cycle-undirected-graph/
and from some you tube channel(better to search). it took good amount of time to get the hang of it. but the explanation is good. there’s another way of graph coloring!! i have to check it too.
Oh and yes try to break it the whole code first to understand properly then practice together!

Thank You very much…I would be checking and learning all of these in a couple of days…
I might become a champion in Graphs becuase of You…Thank You once again Mariha…

i know this is a stupid question but is this same as Dijkstra’s algorithm. i came up with this after reading the explaination that was given in the jovian notebook.
it is also giving the correct answer so i thought i should confirm with some expert

in the below photo i compared the the time of mine and the given algo in notbook and my algo is certainly faster. so please someone confirm this

nevermind, i understood what i am missing. correct me if i am wrong but the algo i have written doesn’t give shortest path but follows the path which seems shortest from current node

Hi everyone, I have a question regarding the video of Lesson 5.

At 1:52:47 of the lesson video, I wonder why the algorithm on graph2 returns 15:

shortest_path(graph2, 2, 8)

While graph2 is defined as a undirected graph, the shortest path from 2 to 8 should be 12 (going through 2 → 3 → 0 → 8), instead of 15 (going through 2 → 3 → 4 → 8).

It is also strange that shortest_path(graph2, 1, 2) returns infinity, while shortest_path(graph2, 2, 1) returns 6. For undirected graph it should be the same.

Have anyone checked it out and had an idea of it? Am I understanding it correctly? Thank you for any of your advise.