3. Matrices for directed graphs
On the previous page, we discussed how to represent a graph using an adjacency matrix. The example used was a simple undirected and unweighted graph.
You can also use matrices to represent directed and weighted graphs.
For example, let's look at the graph below:
Just like the undirected matrix, lay out a table whose rows and columns are labeled with the vertex names.
Just as before, for each row, put a 1 in the columns for the nodes that vertex connects to. However, this time, the connections are one-directional. A connects with C, but C does not connect with A.
This produces the following matrix:
Note that the C, D, and E rows are empty, since they have no outgoing connections at all. Column F is empty too, as it has no incoming connections. Filling in the zeros for the full and complete matrix produces the following:
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: Graphs adjacency matrix