Kumar-laxmi / Algorithms

A Repository for algorithms in C, C++, Python and Java
Apache License 2.0
310 stars 372 forks source link

Johnson's Algorithm in C, C++, Java and Python #1455

Closed Kumar-laxmi closed 2 months ago

Kumar-laxmi commented 1 year ago

Feature = Johnson's Algorithm

Appraoch :

1.Graph Transformation:

  1. Bellman-Ford Algorithm:

    • Use the Bellman-Ford algorithm to calculate the shortest distances from the newly added vertex to all other vertices in the graph.
    • If a negative cycle is detected during this step, terminate the algorithm as it indicates that the graph contains no shortest paths.
  2. Graph Modification:

    • Modify the weights of the original graph based on the results of the Bellman-Ford algorithm.
    • For each edge (u, v) in the graph, update its weight as the sum of its original weight and the distance from the newly added vertex to u minus the distance from the newly added vertex to v.
  3. Dijkstra's Algorithm (Multiple Times):

    • Apply Dijkstra's algorithm to each vertex in the modified graph to find the shortest paths from that vertex to all other vertices.
    • This step is performed multiple times, once for each vertex in the graph.

Additional context image

tarunvyshnav777 commented 1 year ago

@Kumar-laxmi kindly assign this to me under SSOC'23

Mrudula1205 commented 1 year ago

@Kumar-laxmi I would like to work on this issue. Please assign it to me

Devchawla2608 commented 1 year ago

@Kumar-laxmi kindly assign this to me under SSOC'23. I'm ready to contribute in all 4 languages

Shankhadweep commented 1 year ago

@Kumar-laxmi Kindly assign this issue to me. I would like to work on this issue under SSOC'23.

Kumar-laxmi commented 1 year ago

Assigned! @Shankhadweep : C, C++, Python and Java

Unassigned @Shankhadweep

shanvijha30 commented 1 year ago

@Kumar-laxmi Please assign this issue to me I would like to work on it. Thank you!

Kumar-laxmi commented 1 year ago

Assigned! @tarunvyshnav777 : C, C++, Java & Python

Aarsh30 commented 12 months ago

if any one is not doing these algo let me know i would like to work on this @Kumar-laxmi assign it to me thank you

tarunvyshnav777 commented 12 months ago

I'm working on it. By the end of today, I will submit my pr

github-actions[bot] commented 2 months ago

Stale issue message