Closed IansGithubAcc closed 5 months ago
Hi @IansGithubAcc,
Can you provide a tuple of 3 like ('from', 'to', {}) ? otherwise there would be checks of ifs and will slow the load of data in this way.
Anyways, I suggest you use from_nodes_edges_set
function instead:
# nodes representing (1,2) of lon = 1, lat = 2
# required : 'x' for lon, 'y' for lat ; optional 'tt' for terminals (boolean or None)
my_nodes = {
(1, 2): {'x': 1, 'y': 2},
(2, 2): {'x': 2, 'y': 2}
}
# (1,2) -> (2,2) with weight, representing the distance, other attributes can be added
# recognized attributes are : `weight` (distance), `passage` (name of the passage to be restricted by restrictions)
my_edges = {
(1, 2): {
(2, 2): {"weight": 10, "other_attr": "some_value"}
}
}
# Marnet
myM = sr.from_nodes_edges_set(sr.Marnet(), my_nodes, my_edges)
closing this as no followup, please re-open if needed
I'm adding custom rootes to the default MarNet using
add_edges_from_list
. This function takes anedge_list
as input. However, when unpacking the edge it is assuming it has additional args. This is ofc not always the case and in this case you need to add an empty dict.I suggest to rewrite this:
to this: