Traffic simulation : directed graph including specific rules

  • I
  • Thread starter Guitz
  • Start date
In summary, the algorithm must exclude the previous node from the nodes to traverse next, unless its the only option.
  • #1
Guitz
22
8
Hi all,

I'm trying to use a directed graph for a traffic simulation program.

This is an example of a simplified graph :

graph.gif


The red triangle is the position and orientation of the car. The green circle is the destination node.

I wish to prohibit a U-turn on a bend and a crossroads but I authorize it on a dead end (node 4).

The array of nodes (3, 6, 8) is therefore prohibited.
Likewise (3, 1, 3, 6, 8) is forbidden.
On the other hand, (3, 1, 2, 3, 6, 8) and (3, 4, 3, 6, 8) are allowed. The latter being the shortest path.

How please modify the data structure of my graph and the A* (or Dijkstra's) algorithm to achieve my goals?

Thanks
 
Last edited:
Mathematics news on Phys.org
  • #2
Your search algorithm must exclude the previous node from the nodes to traverse next, unless its the only option.

If a search algorithm marks nodes as allread visted (to abort subsequent longer paths), then you must refine this flag to encode from wich node it has already been entered.

Did you really not find any code online for this?
 
Last edited:
  • #3
I would probably also consider changing the algorithm to adjust for the need at hand, but in case you are somehow required to use a "standard" algorithm unchanged you can perhaps consider to generate a new directed graph from your undirected graph such that the two travel directions on each edge is transformed into a node and these nodes are then connected with directed edges representing valid ways through an intersection or end-point.

This should be possible to do in a fairly mechanic way. For example, the sub-graph from your nodes 1, 2 and 3 you would add the nodes and transitions (1-2) -> (2-3) -> (3-1) and (3-2) -> (2-1) -> (1-3), that is two isolated cycles. Adding your node 4 to this would then add nodes (3-4) and (4-3) along with the transitions {(1-3), (2-3)} -> (3-4) -> (4-3) -> {(3-1), (3-2)}, and so forth.

Old suggestion that was only half baked:
Perhaps it is possible to transform your problem into a directed graph where your original nodes with more than one edge is replaced by two nodes, each with directed edges in relevant directions?
 
Last edited:
  • Like
Likes Guitz and FactChecker
  • #4
thanks a lot for your replies
 
  • Like
Likes berkeman
  • #5
A.T. said:
Did you really not find any code online for this?
Unfortunately no
 
  • #6
  • Like
Likes Guitz

FAQ: Traffic simulation : directed graph including specific rules

What is a traffic simulation using a directed graph?

A traffic simulation using a directed graph is a computational model that represents the flow of vehicles through a network of roads and intersections. In this model, intersections are represented as nodes, and roads as directed edges that indicate the permissible direction of travel. This approach allows for the analysis of traffic patterns, congestion, and the effectiveness of traffic management strategies.

What specific rules can be implemented in a traffic simulation?

Specific rules in a traffic simulation can include traffic light timings, stop signs, right-of-way regulations, lane usage restrictions, and pedestrian crossings. Additionally, rules can govern vehicle behavior such as acceleration, deceleration, and turning at intersections. These rules help create a more realistic simulation of traffic conditions and driver behavior.

How can directed graphs improve the accuracy of traffic simulations?

Directed graphs improve the accuracy of traffic simulations by providing a clear representation of traffic flow direction and restrictions. They allow for the modeling of one-way streets, restrictions on turns, and other directional constraints that reflect real-world traffic scenarios. This enhances the fidelity of the simulation and enables more precise predictions of traffic behavior and congestion points.

What are the benefits of using traffic simulations for urban planning?

Traffic simulations are beneficial for urban planning as they allow planners to visualize and analyze the impact of proposed infrastructure changes, such as new roads, traffic signals, and public transportation systems. By simulating different scenarios, planners can identify potential bottlenecks, assess the effectiveness of traffic management strategies, and make informed decisions to improve traffic flow and safety.

What software tools are commonly used for traffic simulations with directed graphs?

Common software tools for traffic simulations that utilize directed graphs include VISSIM, AIMSUN, Synchro, and SUMO. These tools offer various features for modeling traffic flow, analyzing data, and visualizing results. They often provide user-friendly interfaces and support for implementing specific rules and behaviors, making them suitable for researchers and urban planners alike.

Similar threads

Replies
5
Views
1K
Replies
1
Views
2K
Replies
2
Views
4K
Replies
125
Views
18K
Replies
8
Views
3K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
13
Views
2K
Back
Top