Skip to content

Commit 8c0c792

Browse files
committed
Added Floyd–Warshall algorithm in comparison table.
1 parent a07268b commit 8c0c792

4 files changed

+17
-11
lines changed

en/1-1000/743-network-delay-time.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ The following code will introduce how to optimize.
5454
For a detailed description of **Dijkstra's algorithm**, please refer to [1514. Path with Maximum Probability](../1001-2000/1514-path-with-maximum-probability.md).
5555

5656
### Common graph theory algorithm comparison table
57-
|Algorithm name|Main application scenarios|Optimization methods|Importance|Difficulty|min_distances|Negative weights|Additional application scenarios|
57+
|Algorithm name|Main application scenarios|Optimization methods|Importance|Difficulty|min_<br>distances|Negative weights|Additional application scenarios|
5858
|--------------|--------------------------|--------------------|----------|----------|-------------|----------------|--------------------------------|
59-
|[Prim's algorithm](../1001-2000/1584-min-cost-to-connect-all-points.md) |Minimum Spanning Tree |Heap Sort Simplify|Important |Medium |Used |Can handle||
60-
|[Kruskal's algorithm](../1001-2000/1584-min-cost-to-connect-all-points-2.md)|Minimum Spanning Tree |No need |important |Relatively hard|Not used|Can handle|Relative: [Undirected Graph Cycle Detection](./684-redundant-connection.md), [Directed Graph Cycle Detection](./685-redundant-connection-ii.md)|
61-
|[Dijkstra's algorithm](../1001-2000/1514-path-with-maximum-probability.md) |Single-Source Shortest Path |Heap Sort |Very important|Relatively hard|Used |Cannot handle||
62-
|[Bellman-Ford algorithm](./743-network-delay-time.md) |Single-Source Shortest Path |Queue-Improved |Very Important|Easy |Used |Can handle|[Detect Negative Cycles](https://www.geeksforgeeks.org/detect-negative-cycle-graph-bellman-ford/), <br>[Shortest Hop-Bounded Paths](./787-cheapest-flights-within-k-stops.md)|
59+
|[Prim's algorithm](../1001-2000/1584-min-cost-to-connect-all-points.md) |Minimum Spanning Tree |Heap Sort Simplify|Important |Medium |Used |Can handle||
60+
|[Kruskal's algorithm](../1001-2000/1584-min-cost-to-connect-all-points-2.md) |Minimum Spanning Tree |No need |important |Relatively hard|Not used|Can handle|Relative: [Undirected Graph Cycle Detection](./684-redundant-connection.md), [Directed Graph Cycle Detection](./685-redundant-connection-ii.md)|
61+
|[Dijkstra's algorithm](../1001-2000/1514-path-with-maximum-probability.md) |Single-Source Shortest Path |Heap Sort |Very important|Relatively hard|Used |Cannot handle||
62+
|[Bellman-Ford algorithm](./743-network-delay-time.md) |Single-Source Shortest Path |Queue-Improved |Very Important|Easy |Used |Can handle|[Detect Negative Cycles](https://www.geeksforgeeks.org/detect-negative-cycle-graph-bellman-ford/), <br>[Shortest Hop-Bounded Paths](./787-cheapest-flights-within-k-stops.md)|
63+
|[Floyd–Warshall](../1001-2000/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md)|Multi-Source Shortest Path |No need |Less important|Relatively hard|Used |Can handle||
6364

6465
## Complexity
6566
**V**: vertex count, **E**: Edge count.

en/1001-2000/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ The city 0 has 1 neighboring city at a distanceThreshold = 2.
6565
</details>
6666

6767
## Intuition
68-
Just like the `Hints` says, you can use **Floyd-Warshall algorithm** to compute any-point to any-point shortest distances.
68+
Just like the `Hints` says, you can use **Floyd-Warshall Algorithm** to compute any-point to any-point shortest distances.
6969

70-
Or you can also do **Dijkstra algorithm** from every node due to the weights are non-negative.
70+
Or you can also do **Dijkstra Algorithm** from every node due to the weights are non-negative.
71+
72+
Or you can also do **Queue-Improved Bellman-Ford Algorithm** from every node.
7173

7274
## Complexity
7375
* Time: `O(N^3)`.

zh/1-1000/743-network-delay-time.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@
5858

5959
|算法名称|主要的适用场景|优化方式|重要度|难度|min_<br>distances|负边权值|额外的适用场景|
6060
|-------|-----------|-------|-------|---|-------------|--------|------------|
61-
|[Prim算法](../1001-2000/1584-min-cost-to-connect-all-points.md) |最小生成树 |堆排序简化 |重要 |中等|用到|能处理||
62-
|[Kruskal算法](../1001-2000/1584-min-cost-to-connect-all-points-2.md)|最小生成树 |无需优化 |重要 |较难|不用|能处理|相关:[无向图环检测](./684-redundant-connection.md), [有向图环检测](./685-redundant-connection-ii.md)|
63-
|[Dijkstra算法](../1001-2000/1514-path-with-maximum-probability.md) |单源最短路径|堆排序优化 |很重要|较难|用到|不能处理||
64-
|[Bellman-Ford算法](./743-network-delay-time.md) |单源最短路径|集合优化|很重要|简单|用到|能处理|[负环检测](https://www.geeksforgeeks.org/detect-negative-cycle-graph-bellman-ford/), [限定步数最短路径](./787-cheapest-flights-within-k-stops.md)|
61+
|[Prim算法](../1001-2000/1584-min-cost-to-connect-all-points.md) |最小生成树 |堆排序简化|重要 |中等|用到|能处理||
62+
|[Kruskal算法](../1001-2000/1584-min-cost-to-connect-all-points-2.md) |最小生成树 |无需优化 |重要 |较难|不用|能处理|相关:[无向图环检测](./684-redundant-connection.md), [有向图环检测](./685-redundant-connection-ii.md)|
63+
|[Dijkstra算法](../1001-2000/1514-path-with-maximum-probability.md) |单源最短路径|堆排序优化 |很重要 |较难|用到|无能力||
64+
|[Bellman-Ford](./743-network-delay-time.md) |单源最短路径|集合优化 |很重要 |简单|用到|能处理|[负环检测](https://www.geeksforgeeks.org/detect-negative-cycle-graph-bellman-ford/), [限定步数最短路径](./787-cheapest-flights-within-k-stops.md)|
65+
|[Floyd–Warshall](../1001-2000/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md)|多源最短路径|无需优化 |较不重要|较难|用到|能处理||
6566

6667
## 复杂度
6768
**V**: 顶点数量,**E**: 边的数量。

zh/1001-2000/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969

7070
或者,你可以多次调用 **Dijkstra 算法**,每次调用时用不同的城市做为`起始城市`
7171

72+
或者,你可以多次调用 **集合优化的 Bellman-Ford 算法**,每次调用时用不同的城市做为`起始城市`
73+
7274
## Complexity
7375
* Time: `O(N^3)`.
7476
* Space: `O(N^2)`.

0 commit comments

Comments
 (0)