Skip to content

Commit 85be9a7

Browse files
committed
added more info on adj matrix
1 parent 08dd13f commit 85be9a7

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

docs/graphs.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ Also known as Chromatic Colouring
572572

573573
<img src="images/Pasted image 20220302121245.png" alt="Pasted image 20220302121245" width="200">
574574

575-
The [chromatic number](#chromatic-number) of this graph is 3. As there are 3 colours.
575+
The [chromatic number](#chromatic-number) of this graph is 3. As there are 3 unique colours.
576576

577577
#### Chromatic Number
578578

@@ -590,24 +590,37 @@ An adjacency matrix shows weightings of edges on an undirected graph. Where an a
590590

591591
An example of an undirected connected graph with nodes $A$,$B$, and an edge between them
592592

593+
![undirected graph with nodes A and B connected](images/adjmatrix1.png){width=200px}
594+
593595
$$
596+
\begin{array}{c|cc}
597+
& A & B \newline
598+
\hline
599+
A & 0 & 1 \newline
600+
B & 1 & 0
601+
\end{array}
602+
\hspace{0.6cm}
603+
\text{or equivalently}
604+
\hspace{0.6cm}
594605
\begin{bmatrix}
595-
0 & 1
596-
\\
606+
0 & 1 \newline
597607
1 & 0
598608
\end{bmatrix}
599609
$$
600610

601-
A directed graph where $A$ points to $B$:
611+
612+
A directed graph where $A \to B$:
613+
614+
![direct graph with A connected to B](images/adjmatrix2.png){width=200px}
602615

603616
$$
604-
\begin{bmatrix}
605-
0 & 1
606-
\\
607-
0 & 0
608-
\end{bmatrix}
617+
\begin{array}{c|cc}
618+
& A & B \newline
619+
\hline
620+
A & 0 & 1 \newline
621+
B & 0 & 0
622+
\end{array}
609623
$$
610-
611624
The direction can be read from **the left of the matrix** (left side of rows) **to the right** of the row to find the head.
612625

613626
!!! note

docs/images/adjmatrix1.png

19.6 KB
Loading

docs/images/adjmatrix2.png

22.1 KB
Loading

0 commit comments

Comments
 (0)