Adds a script to split given modes from the links on the network graph from under the 'modes' attribute. You end up with a graph with many more links, the links with mentioned modes exists only with that mode, all other attributes are copied across (for the time being anyway, we might have to set/scale capacity/speed eventually).
Context: We use Hermes in MATSim, which results in slower vehicles, like bikes, blocking cars on links. Creating separate links for that mode is an initial solution to that problem.
Bonus: Noticed a lag with method that adds links. Because with this script we're adding links with the same from and to nodes, we need to generate a multi-index (links are stores in the graph in this format: (from_node, to_node, multiindex)). One line, which gives a closer initial guess for the multi-index speeds things up for larger graphs:
Adds a script to split given modes from the links on the network graph from under the
'modes'
attribute. You end up with a graph with many more links, the links with mentioned modes exists only with that mode, all other attributes are copied across (for the time being anyway, we might have to set/scale capacity/speed eventually).Context: We use Hermes in MATSim, which results in slower vehicles, like bikes, blocking cars on links. Creating separate links for that mode is an initial solution to that problem.
Bonus: Noticed a lag with method that adds links. Because with this script we're adding links with the same from and to nodes, we need to generate a multi-index (links are stores in the graph in this format:
(from_node, to_node, multiindex)
). One line, which gives a closer initial guess for the multi-index speeds things up for larger graphs:(time in seconds)