Directed Graphs

Sometimes connections in a graph are one-way: imagine roads in a one-way system. Such a graph is called a directed graph. We will learn about directed graphs and different ways of formalising graphs.

Watch the video and then answer the questions below.

Eight-minute video

You can also view this video on YouTube


Key Points

  1. Graphs can be directed or undirected.
  2. A directed graph has edges that only go one way. Edges in an undirected graph go both ways
  3. Edges can be written as an ordered tuple <n1,n2>, where n1 is the source node, and n2 is the destination node.

In-degree and Out-degree

While in a directed graph the degree of a node is still how many edges connect to it, there are also two more related concepts:

  • In-degree - the number of edges that go to this node
  • Out-degree - the number of edges that go from this node

Adjacency matrices for directed graphs see the example below (in-edges along top, out-edges down the side):

  n1 n2 n3 n4
n1   1 1  
n2     1  
n3        
n4       1

Questions

1. Check your knowledge

1. Graph 1

Look at the graph and answer the questions below

Check Answers

2. Adjacency Matrix

Look at the following adjacency matrix for a directed graph: ‘to’ nodes are along the top, ‘from’ nodes are down the side.

  n1 n2 n3 n4
n1   1 1  
n2       1
n3 1      
n4   1   1

Check Answers


Summary

In this section we have learned about directed graphs.

  • You should know what it means for a graph to be directed.
  • You should be able to recognise and create directed and undirected graphs

In the next section we are going to see an application of graphs to the study of language.