delete_edge_from()
Deletes the edge connecting from a given agent to this agent, or from a list of agents to this agent, within a given network.
Synopsis
delete_edge_from(network, agent)
delete_edge_from(network, agent-list)
Description
If an edge exists in the given network from a given agent ID to the current agent, then the edge is deleted. Otherwise, the action has no effect. If the second argument is a list expression, then edges are deleted from each agent in the list.
For undirected networks, because direction does not matter,
both delete_edge_from()
and delete_edge_to()
have the same effect
of deleting an undirected edge between the current and other agents.
Parameters
network
The name of the network to manipulate.
agent
An expression that evaluates to the ID of an agent.
agent-list
A list of agent ids.
Examples
If there is a directed network named NETWORK
with three agents, agent1
agent2
and agent3
, with agent ids, id1
id2
and id3
respectively, connected with an edge to agent1 from agent2 and another edge to agent1 from agent3, then the edge to agent1 from agent2 can be deleted with the following action rule:
if (id == id1) then delete_edge_from(NETWORK, id2)
In the same scenario described above, both connections can be deleted with the action rule:
if (id == id1) then delete_edge_from(NETWORK, list(id2,id3))
See Also
delete_edge_to(), add_edge_to(), add_edge_from(), is_connected_to(), is_connected_from()