add_edge¶
Syntax¶
Parameters¶
network- The network in which to add an edge.
source_node_id- The ID of the source node to add an edge from.
dest_node_id- The ID of the destination node to add an edge to.
Description¶
If an edge does not exist from the source node to the destination node parameters, then an edge is created. Otherwise, the action has no effect.
Examples¶
simulation {
start_date = 2020-Jan-01
end_date = 2020-Jan-01
locations = none
default_model = none
}
network my_network {
is_directed = 1
}
startup {
spawn_agent()
}
condition TestCondition {
start_state = Start
meta_start_state = Excluded
state Start {
add_edge(my_network, id(), 5)
print("1 == ", has_edge_from(my_network, id(), 5))
print("0 == ", has_edge_from(my_network, 5, id()))
wait(0)
default(Excluded)
}
}