Create a rule model to find the shortest distance between any two points on an arbitrary graph such as this one:

Like this:

Note: These two diagrams were actually created using Corticon!