Skip to content

Commit 5cc3c0f

Browse files
authored
Update graphs.md
1 parent 0c13478 commit 5cc3c0f

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

notes/graphs.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,19 +1222,21 @@ Prim(G, i):
12221222
Undirected, weighted graph; start at **A**. Edge weights shown on links.
12231223

12241224
```
1225-
┌────────┐
1226-
│ A │
1227-
└─┬──┬───┘
1228-
4/ │1
1229-
┌── │ ──┐
1230-
┌─────▼──┐ │ ┌▼──────┐
1231-
│ B │──┘2 │ C │
1232-
└───┬────┘ └──┬────┘
1233-
1 │ 4 │
1234-
│ │
1235-
┌───▼────┐ 3 ┌──▼───┐
1236-
│ E │────────│ D │
1237-
└────────┘ └──────┘
1225+
┌────────┐
1226+
│ A │
1227+
└─┬──┬───┘
1228+
4│ │1
1229+
│ │
1230+
┌───────────┘ └───────────┐
1231+
│ │
1232+
┌────▼────┐ ┌────▼────┐
1233+
│ B │◄──────2────────│ C │
1234+
└───┬─────┘ └─────┬───┘
1235+
1 │ 4 │
1236+
│ │
1237+
┌───▼────┐ 3 ┌────▼───┐
1238+
│ E │─────────────────▶│ D │
1239+
└────────┘ └────────┘
12381240
12391241
Edges: A–B(4), A–C(1), C–B(2), B–E(1), C–D(4), D–E(3)
12401242
```
@@ -1372,15 +1374,15 @@ Undirected, weighted graph (we’ll draw the key edges clearly and list the rest
13721374
Start with all vertices as separate sets: `{A} {B} {C} {D} {E} {F}`.
13731375

13741376
```
1375-
Top row: A────────4────────B────────2────────C
1376-
1377-
1378-
7 3
1379-
1380-
Bottom row: F────────1────────E────────────────D
1381-
(E–F)
1377+
Top row: A────────4────────B────────2────────C
1378+
1379+
1380+
7 3 5
1381+
1382+
Bottom row: F────────1────────E────────6────────D
1383+
13821384
Other edges (not all drawn to keep the picture clean):
1383-
A–C(4), B–D(5), C–D(5), C–E(5), D–E(6), D–F(2)
1385+
A–C(4), B–D(5), C–E(5), D–E(6), D–F(2)
13841386
```
13851387

13861388
*Sorted edge list (ascending):*

0 commit comments

Comments
 (0)