One-way Road Network
In this example, we want to construct a network graph of one-way roads.
The direction is important when defining this network graph.
The end of a one-way street can touch either:
-
The start of another one-way street, or
-
Anywhere on a two-way street
A two-way street can touch either:
-
The start of a one-way street, or
-
Anywhere on a two-way street
Here we will show two methods of creating this network graph. One using a single complex Action, and another that uses two simple Actions.
Method 1: One Action
In our example below, a one-way road network is constructed using the built in operations add_position and connect_positions.
Although the network graph is constructed successfully, the required Action is very complicated.



Method 2: Two Simpler Actions
Alternatively, you can simplify the process by creating two separate Actions.
This first Action adds all roads to the network, including all two-way roads.


The second Action then removes all roads that aren't relevant to the one way system.


Using two Actions is simpler, but does mean that you will be processing all Roads twice.