{"id":22513836,"url":"https://github.com/emahtab/floyd-warshall-algorithm","last_synced_at":"2026-01-08T04:03:03.098Z","repository":{"id":79525502,"uuid":"443692803","full_name":"eMahtab/floyd-warshall-algorithm","owner":"eMahtab","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-03T02:10:50.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T03:25:28.928Z","etag":null,"topics":["floyd-warshall-algorithm","graph","shortest-path"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eMahtab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-02T05:54:34.000Z","updated_at":"2022-01-03T02:10:53.000Z","dependencies_parsed_at":"2023-05-10T17:15:47.588Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/floyd-warshall-algorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffloyd-warshall-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffloyd-warshall-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffloyd-warshall-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffloyd-warshall-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/floyd-warshall-algorithm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245952058,"owners_count":20699423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["floyd-warshall-algorithm","graph","shortest-path"],"created_at":"2024-12-07T03:14:36.429Z","updated_at":"2026-01-08T04:02:58.067Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Floyd Warshall Algorithm\nFloyd Warshall algorithm is used to find the shortest ath from any vertex to any other vertex in a weighted graph.\n\n## Algorithm:\n1. Create a 2D array `matrix` of n * n , where n is the number of vertices in the weighted graph\n2. Initialize the 2D array `matrix[i][i] = 0` and all other cells as `matrix[i][j] = Integer.MAX_VALUE (some higher value)`\n3. Loop over the 2D array n times, k = 0 to less than n, and update the matrix[i][j] as below\n```java\nfor(int k = 0; k \u003c N; k++)\n  for(int i = 0; i \u003c N; i++)\n    for(int j = 0; j \u003c N; j++)\n      matrix[i][j] = Math.min(matrix[i][j], matrix[i][k] + matrix[k][j]);\n```\n4. At the end we will have the shorted path from any vertex i to any vertex j in the matrix.\n\n# References :\nhttps://www.youtube.com/watch?v=oNI0rf2P9gE\n\n# Problems :\n1. https://leetcode.com/problems/network-delay-time\n2. https://leetcode.com/problems/course-schedule-iv\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Ffloyd-warshall-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Ffloyd-warshall-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Ffloyd-warshall-algorithm/lists"}