Skip to main content

teachmedijkstra

This package contains an implementation of the Dijkstra's algorithm for finding the shortest paths in a graph and serves to educational purposes.

Its main goal is to produce a LaTeX document which contains:

  • description of the performing of the Dijkstra's algorithm in a for of a table where each row corresponds to a vertex of the graph and each column corresponds to one time step of the algorithm,
  • shortest path tree (or shortest path covering) which is a subgraph of the processed graph that contains those edges that belong the shortest paths.

The main motivation to write this program was to have a tool to automatically generate examen tests on Dijkstra's algorithm with randomly created graphs and with the corresponding solutions which consist of two items described in the list above.

Installation

Install the package from PyPI utilizing the pip module:

python -m pip install teachmedijkstra

Example

What follows is a simple program using the package teachmedijkstra. It defines an undirected weighted graph with six vertices, performs the Dijkstra's algorithm to find the shortest paths starting from the vertex "a", and exports the result to a LaTeX file "example.tex".

    import teachmedijkstra

    graph = teachmedijkstra.UndirectedGraph()
    graph.addVertex("a", (0,2))
    graph.addVertex("b", (1,2))
    graph.addVertex("c", (2,2))
    graph.addVertex("d", (0,1))
    graph.addVertex("e", (1,1))
    graph.addVertex("f", (2,1))
    graph.addEdge("a", "b", 7)
    graph.addEdge("b", "c", 8)
    graph.addEdge("d", "e", 6)
    graph.addEdge("e", "f", 1)
    graph.addEdge("a", "d", 5)
    graph.addEdge("b", "e", 2)
    graph.addEdge("c", "f", 4)
    graph.addEdge("a", "e", 3)
    graph.addEdge("b", "f", 9)

    dijkstra = teachmedijkstra.Dijkstra(graph, "a")
    dijkstra.run()

    dijkstra.saveToLaTeXFile("example.tex")

More Examples

For more examples see the following programs:

  • example_undirected.py ... example of performing the Dijkstra's algorithm on an undirected weighted graph with 9 vertices,
  • example_directed.py ... example of performing the Dijkstra's algorithm on a directed weighted graph with 9 vertices,
  • example_random.py ... example of creating a number of exercises on Dijkstra's algorithm with randomly generated graphs.

Documentation

The comments in the code of the program are written with respect to produce a nicely written documentation when using pdoc3 (see also the PyPI page of pdoc3). In order to create the HTML document with the program documentation, install first pdoc3 from PyPI utilizing the pip module:

python -m pip install pdoc3

Once installed, run this command from the root directory of the project:

pdoc3 --html teachmedijkstra

A directory html/ that contains the documentation will be created.

Metadata

Release files for teachmedijkstra 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teachmedijkstra 0.1.0
File Size Uploaded Provenance Actions
teachmedijkstra-0.1.0.tar.gz 24.1 kB Without provenance Details for teachmedijkstra-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for teachmedijkstra 0.1.0
File Interpreter ABI Platform Actions
teachmedijkstra-0.1.0-py3-none-any.whl Python 3 none any Details for teachmedijkstra-0.1.0-py3-none-any.whl

Total release size: 52.2 kB

Release files / teachmedijkstra-0.1.0.tar.gz

Download URL teachmedijkstra-0.1.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4ff21ad2ca2203ec11bd8620d6522e3deacfd0d1b56bcac54fcec5f59fd9bcb6
BLAKE2b-256 checksum
How to use checksums
edde8a52a146409fdac26329aff204432b7be69ca91f56b6ef59072fdf9f653b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / teachmedijkstra-0.1.0-py3-none-any.whl

Download URL teachmedijkstra-0.1.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36e129d93e724cd44b1e0b67e4aae91aeef880b4c204b959cef2b74ac8f0b913
BLAKE2b-256 checksum
How to use checksums
8e6d5164e74fe69afa2cc9dd2bd0d5a3f367908c5cf173f0910a24232109fcff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Security for teachmedijkstra 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page