Figure 2 The distance table used in Figure 1

     
     
     
dist[a] = 1
dist[d] = 2
dist[o] = 3
dist[x] = 5
dist[y] = 0
dist[z] = 5