Commit ac4edb7

mo khan <mo.khan@gmail.com>
2020-09-26 20:09:55
docs: provide visual representation of an adjacency matrix
1 parent dbb2eb1
Changed files (1)
src
src/03/05/README.md
@@ -451,6 +451,71 @@ Order: [b, a, f, c, e, j, d, i, g, m, n, h, k, o, p, l]
 
 # Adjacency List
 
+```plaintext
+(a)---(b)---(c)---(d)
+ | \       /     /
+ |  \     /     /
+(e)  \(f)/  (g)/--(h)
+ |     |   / |    /
+ |     |  /  |   /
+(i)---(j)/  (k) / (l)
+ | \         | /   |
+ |  \        |/    |
+(m)  \(n)---(o)---(p)
+
+(a) -> [b, e, f]
+(b) -> [a, c, f]
+(c) -> [b, d, f]
+(d) -> [c, g]
+(e) -> [a, i]
+(f) -> [a, c, j]
+(g) -> [d, h, j, k]
+(h) -> [g, o]
+(i) -> [e, j, m, n]
+(j) -> [f, g, i]
+(k) -> [g, o]
+(l) -> [p]
+(m) -> [i]
+(n) -> [i, o]
+(o) -> [k, n, p]
+(p) -> [l, o]
+```
+
 # Adjacency Matrix
 
+```plaintext
+(a)---(b)---(c)---(d)
+ | \       /     /
+ |  \     /     /
+(e)  \(f)/  (g)/--(h)
+ |     |   / |    /
+ |     |  /  |   /
+(i)---(j)/  (k) / (l)
+ | \         | /   |
+ |  \        |/    |
+(m)  \(n)---(o)---(p)
+```
+
+```plaintext
+-----------------------------------
+| |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|
+|a|0|1|0|0|1|1|0|0|0|0|0|0|0|0|0|0|
+|b|1|0|1|0|0|1|0|0|0|0|0|0|0|0|0|0|
+|c|0|1|0|1|0|1|0|0|0|0|0|0|0|0|0|0|
+|d|0|0|1|0|0|0|1|0|0|0|0|0|0|0|0|0|
+|e|1|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|
+|f|1|0|1|0|0|0|0|0|0|1|0|0|0|0|0|0|
+|g|0|0|0|1|0|0|0|1|0|1|1|0|0|0|0|0|
+|h|0|0|0|0|0|0|1|0|0|0|0|0|0|0|1|0|
+|i|0|0|0|0|1|0|0|0|0|1|0|0|1|1|0|0|
+|j|0|0|0|0|0|1|1|0|1|0|0|0|0|0|0|0|
+|k|0|0|0|0|0|0|1|0|0|0|0|0|0|0|1|0|
+|l|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|
+|m|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|
+|n|0|0|0|0|0|0|0|0|1|0|0|0|0|0|1|0|
+|o|0|0|0|0|0|0|0|0|0|0|1|0|0|1|0|1|
+|p|0|0|0|0|0|0|0|0|0|0|0|1|0|0|1|0|
+-----------------------------------
+```
+
 # Traverse Every Edge