Skip to content

Commit 86aead2

Browse files
committed
743-network-delay-time.md Added DFS, BFS, UnionFind into comparison table.
1 parent bb6cb6e commit 86aead2

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

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

+9-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ For a detailed description of **Dijkstra's algorithm**, please refer to [1514. P
5656
### Common graph theory algorithm comparison table
5757
|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-
|[A* search algorithm](./752-open-the-lock.md) |Single-Source Shortest Path|Built-in Heap Sort|Very important|Medium |Not used|It depends||
63-
|[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)|
64-
|[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||
59+
|[Depth-first search](./797-all-paths-from-source-to-target.md) |Traverse a graph |No need |Very important|Easy |No need |Can handle||
60+
|[Breath-first search](../1001-2000/1971-find-if-path-exists-in-graph.md) |Traverse a graph |No need |Very important|Easy |No need |Can handle|Single-Source Shortest Path if No Weight|
61+
|[UnionFind, aka disjoint-set](./684-redundant-connection.md) |Graph Connectivity |Path Compression |Very important|Medium |No need |Can handle|[Directed Graph Cycle Detection](./685-redundant-connection-ii.md)|
62+
|[Prim's algorithm](../1001-2000/1584-min-cost-to-connect-all-points.md) |Minimum Spanning Tree |Heap Sort to Simplify|Important |Medium |Used |Can handle||
63+
|[Kruskal's algorithm](../1001-2000/1584-min-cost-to-connect-all-points-2.md) |Minimum Spanning Tree |No need |Important |Relatively hard|No need|Can handle||
64+
|[Dijkstra's algorithm](../1001-2000/1514-path-with-maximum-probability.md) |Single-Source Shortest Path|Heap Sort |Very important|Relatively hard|Used |Cannot handle||
65+
|[A* search algorithm](./752-open-the-lock.md) |Single-Source Shortest Path|Built-in Heap Sort |Very important|Medium |No need|It depends||
66+
|[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)|
67+
|[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||
6568

6669
## Complexity
6770
**V**: vertex count, **E**: Edge count.

en/1001-2000/1971-find-if-path-exists-in-graph.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Solution:
9494
return False
9595
```
9696

97-
### Depth-first search
97+
### Depth-first search (more complex)
9898
```python
9999
class Solution:
100100
def __init__(self):

en/3001-4000/unorganized.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ The improved way with a queue is commonly more efficient. Relaxing **All Edges**
5959
* The time complexity of `Floyd–Warshall algorithm` is `V * V * V`. For a dense graph, `Floyd–Warshall algorithm` is still faster.
6060
* `A* algorithm` use a `priority queue`, `pop()` to get the vertex closest to the destination vertex. We need to choose **proper math formula** to determine which one is the closest. We to the very near place of destination vertex, we can use some special method to make it can handle the last part.
6161

62-
|Algorithm name|Focus|Key implementation methods|
62+
|Algorithm name|Focus|Key implementation methods|mark visited|
6363
|Prim's algorithm|Vertices||
6464
|Kruskal's algorithm|Edges|Union-Find|
6565
|Dijkstra's algorithm|Vertices||
6666
|Bellman-Ford algorithm|Edges(Vertices+Edges for SPFA)||
67+
|Dijkstra's by heap sort - min_distance = A*|
68+
UnionFind + Heap sort = Kruskal
69+
BFS + heap sort = A*
6770

6871
Add a table to show the differences between A-Start and breadth-first search
6972

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@
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) |单源最短路径|堆排序优化|很重要 |较难|用到|无能力||
61+
|[深度优先搜索](./797-all-paths-from-source-to-target.md) |遍历图 |无需优化 |很重要 |简单|不用|能处理||
62+
|[广度优先搜索](../1001-2000/1971-find-if-path-exists-in-graph.md) |遍历图 |无需优化 |很重要 |简单|不用|能处理|不考虑权时,可用于求单源最短路径|
63+
|[并查集](./684-redundant-connection.md) |检测图的连通性|路径压缩|很重要 |中等|不用|能处理|[有向图环检测](./685-redundant-connection-ii.md)|
64+
|[Prim 算法](../1001-2000/1584-min-cost-to-connect-all-points.md) |最小生成树 |堆排序简化|重要 |中等|用到|能处理||
65+
|[Kruskal 算法](../1001-2000/1584-min-cost-to-connect-all-points-2.md) |最小生成树 |无需优化 |重要 |较难|不用|能处理||
66+
|[Dijkstra 算法](../1001-2000/1514-path-with-maximum-probability.md) |单源最短路径|堆排序优化|很重要 |较难|用到|无能力||
6467
|[A* 算法](./752-open-the-lock.md) |单源最短路径|固有堆排序|很重要 |中等|不用|看情况||
6568
|[Bellman-Ford](./743-network-delay-time.md) |单源最短路径|集合优化 |很重要 |简单|用到|能处理|[负环检测](https://www.geeksforgeeks.org/detect-negative-cycle-graph-bellman-ford/), [限定步数最短路径](./787-cheapest-flights-within-k-stops.md)|
6669
|[Floyd–Warshall](../1001-2000/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md)|多源最短路径|无需优化 |较不重要|较难|用到|能处理||

0 commit comments

Comments
 (0)