syntax
dijkstra_od(link_impedance, link_node1_rel, lin_node2_rel, originloc_node_rel, originloc_impedance, originloc_origin_rel, destloc_node, destloc_impedance, destloc_dest_rel)
or
dijkstra_od_maxdist(link_impedance, link_node1_rel, lin_node2_rel, originloc_node_rel, originloc_impedance, originloc_origin_rel, destloc_node, destloc_impedance, destloc_dest_rel, origin_impedance_max )
with:
- link_impedance: a data item with the impedance of the links of a linkset;
- link_node1_rel: index number of the first node of a link set;
- link_node2_rel: index number of the last node of a link set;
- originloc_node_rel: index number of the origin nodes;
- originloc_impedance: start impedance for each origin, from the startpoint to the startnode;
- originloc_origin_rel: index number of each origin;
- destloc_node: index number of the destination node;
- destloc_impedance: end impedance for each destination, from the endnode to the end point;
- destloc_dest_rel: index number of each destination;
- origin_impedance_max: maximum distance for the resulting sparse matrix of od_pairs
description
The dijkstra_od function applies the dijkstra algorithm to calculate the shortest network impedance from a set of origin points to a set of destination points.The result is an O(rigin) D(estination) matrix, in DutchHerkomst/Bestemmingsmatrix.
To apply any dijkstra function, first configure a nodeset (based on the origin and destination points) and a linkset (based on the segments in an arc set, usually with roads).
This variant of the dijkstra function results in a new domain unit with a subitem called Impedance. This subitem indicates the impedance from each origin point towards each destination point. The values unit of this item is the same as the values unit of the three impedance arguments. The cardinality of the new domain unit is the product of the cardinality of the origin and destination domain units.
The index numbers of the origin(originn_nr) and destination(destination_nr) domains can be configured with the expressions presented in the example.
applies to
impedance_link, impedance_origin and impedance_destination are data items with value type:
- float32
- float64
F1, F2, nr_originnode, nr_destnode, indexnumber_origin and indexnumber_destination are data items with value type:
- uint32
conditions:
- Attributes impedance_link, F1 and F2 need to be match with regard to their domain unit.
- Attributes nr_originnode, impedance_origin and indexnumber_origin need to be match with regard to their domain unit.
- Attributes nr_destnode, impedance_destination and indexnumber_destination need to be match with regard to their domain unit.
- Attributes impedance_link, impedance_origin and impedance_destination need to be match with regard to their values unit.
since version
5.95
example
unit<uint32> OD:
expr = "dijkstra(dist, F1, F2
,nr_OrgNode, const(0, ODomain, m), id(ODomain)
,nr_DestNode,const(0, DDomain, m), id(DDomain))"
{
attribute<ODomain> originn_nr: expr = "id(OD) / #DDomain";
attribute<DDomain> destination_nr: expr = "mod(id(OD), #DDomain)";
}
| dist | F1 | F2 |
| 713.44 | 9 | 10 |
| 907.33 | 0 | 3 |
| 1913.96 | 3 | 19 |
| 1907.31 | 19 | 26 |
| .. | .. | .. |
| .. | .. | .. |
| nr_orgnode |
| 22 |
| 17 |
| 14 |
| 29 |
| 8 |
| nr_destnode |
| 22 |
| 13 |
| 6 |
| 30 |
| Impedance | origin_nr | destination_nr |
| 0 | 0 | 0 |
| 5093.28 | 0 | 1 |
| 5596.24 | 0 | 2 |
| 5410 | 0 | 3 |
| 5896.14 | 1 | 0 |
| 1383.17 | 1 | 1 |
| 5272.83 | 1 | 2 |
| 5086.39 | 1 | 3 |
| 4901.69 | 2 | 0 |
| 3775.21 | 2 | 1 |
| 1393.9 | 2 | 2 |
| 4091.94 | 2 | 3 |
| 6181.57 | 3 | 0 |
| 5055.09 | 3 | 1 |
| 5558.26 | 3 | 2 |
| 1457.7 | 3 | 3 |
| 5956.03 | 4 | 0 |
| 1443.05 | 4 | 1 |
| 5332.71 | 4 | 2 |
| 5146.27 | 4 | 3 |