mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-10 22:46:07 +00:00
Release Rust code to documents. (#656)
This commit is contained in:
@@ -94,6 +94,12 @@
|
||||
[class]{GraphAdjMat}-[func]{}
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
|
||||
```rust title="graph_adjacency_matrix.rs"
|
||||
[class]{GraphAdjMat}-[func]{}
|
||||
```
|
||||
|
||||
## 基于邻接表的实现
|
||||
|
||||
设无向图的顶点总数为 $n$ 、边总数为 $m$ ,则有:
|
||||
@@ -191,6 +197,12 @@
|
||||
[class]{GraphAdjList}-[func]{}
|
||||
```
|
||||
|
||||
=== "Rust"
|
||||
|
||||
```rust title="graph_adjacency_list.rs"
|
||||
[class]{GraphAdjList}-[func]{}
|
||||
```
|
||||
|
||||
## 效率对比
|
||||
|
||||
设图中共有 $n$ 个顶点和 $m$ 条边,下表为邻接矩阵和邻接表的时间和空间效率对比。
|
||||
|
||||
Reference in New Issue
Block a user