set_weight¶
Syntax¶
Parameters¶
network- The name of a network.
source_node_id- The ID of the source node to find an edge on.
dest_node_id- The ID of the destination node to find an edge on.
weight- The weight to assign to the edge.
Description¶
Sets the weight of an edge that exists in a network.
It is an error to try to set a weight for an edge that does not exist.
Examples¶
simulation {
start_date = 2020-Jan-01
end_date = 2020-Jan-01
locations = none
default_model = none
}
network my_network {
is_directed = 1
}
condition TestCondition {
start_state = Excluded
meta_start_state = MetaStart
state MetaStart {
add_edge(my_network, 1, 2)
print("Expect 1 == ", get_weight(my_network, 1, 2))
set_weight(my_network, 1, 2, 999)
print("Expect 999 == ", get_weight(my_network, 1, 2))
wait(0)
default(Excluded)
}
}