Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook on shortest path using Dijkstra's algorithm #65

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

NikitaSharma1
Copy link

I created a notebook on Dijkstra's algorithm and how it is implemented in NetworkX. I would like to know if there's any other topic I can add or explain in more detail.

@MridulS
Copy link
Member

MridulS commented Apr 14, 2022

Thanks @NikitaSharma1! Can you please convert the .ipynb notebook format to .md? You can use jupytext for this.
With jupytext --to markdown notebook.ipynb you can convert it to markdown.

[we really need to get the contributing guide for nx-guides up and running 😅 ]

@NikitaSharma1
Copy link
Author

@MridulS I converted it to md but I am getting make: *** [Makefile:20: html] Error 1 this error again and again . Can you please tell me how to resolve this?
And yes, contribution guide is much needed 😅

@NikitaSharma1
Copy link
Author

@MridulS thank you so much!!

Copy link
Member

@MridulS MridulS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some general comments.

- ZRH : `min(infinity, 5) = 5`


![Figure 1&2](Graphs/figure1_2.png "Step 1 and Step 2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How were these images generated? It's usually a good idea to keep the code handy to reproduce the figures :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these images should be generated directly by code in the notebook - showing how to make high-quality visualizations of graph/network data is one of the primary goals of these tutorials!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used diagrams.net for the graphs for 2 reasons:

  1. I think inserting code for graphs might break the flow of the learner as it happened to me in Dintz and I have like 6 graphs.
  2. If you'll look in the images, I can add edge labels, node labels and colour edges, but, I don't know how to add the distance of the nodes in the graph (like infinite initially and then keep updating).

But, yes you're right. I'll try to figure it out and create an easy and understandable graph using networkx.


# printing the distance and path from the source node 'DEL' to target node 'LCY'
print(dist[target], paths[target])
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW we don't need to implement the algorithm in the same exact way as done inside NetworkX for nx-guides. The goal is to provide a pedagogical source so if possible feel free to remove bits that you think can be better compressed :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, can I replace it with a basic general implementation?

## Reference

Shivani Sanan, Leena jain, Bharti Kappor (2013). (IJAIEM) "Shortest Path Algorithm" <br>
https://www.ijaiem.org/volume2issue7/IJAIEM-2013-07-23-079.pdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this paper cited in references? This doesn't define the Dijkstra algorithm.
It's defined in:

Dijkstra, Edsger W. "A note on two problems in connexion with graphs." Numerische mathematik 1, no. 1 (1959): 269-271.

https://ir.cwi.nl/pub/9256/9256D.pdf

@NikitaSharma1
Copy link
Author

@MridulS @rossbar I have made the changes you asked for, can you please review them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants