Here's an idea:
Model intersection nodes like B as as a set of entry/exit points to the intersection. In your case there would be three such nodes, BA, BC and BD, each representing the entry/exit to the road to destinations A, C and D. The relationships between the different nodes of B would all be of a different type than the road relationships. Traversing the graph needs a rule that you can never traverse two intersection relationships in a row (cannot drive round and round in the intersection). Then all you need to add is a direction constraint to the intersection relationships, and you will have achieved your goal.
BC---C
/|
/ |
A---BA |
\ |
\|
BD---D
Roads:
- A---BA, bi-directional road
- C---BC, bi-directional road
- D---BD, bi-directional road
Intersection:
- BA---BD, bi-directional
- BA---BC, bi-directional
- BC-->BD, only one direction - you cannot turn from D to C, only from C to D
So, as long as your traversal algorithm respects the direction of the relationships (both road and interesection) and also enforces the rule that you can never traverse two intersection relationships in a row, then you will not be able to take a right turn from D to C through the intersection.
On Tue, Aug 14, 2012 at 10:41 AM, Benoît Lafontaine
<joel...@gmail.com> wrote:
Hi,
I have to modelize roads. And I have the following problem
/--[Road]-->(C)
/
(A)<--[Road]-->(B)<=
\
\--[Road]-->(D)
A, C and D are points like cities, B is an intersection.
The constraint is that is not allowed to turn to C when you come from D. So you can drive from A to C, from A to D, but you can't drive from D to C.
What's the best way to modelize such graph with this constraint?
Tx