is_connected_from()
Agent predicate that checks if the agent is connected from another agent in a specified network.
Synopsis
is_connected_from(agent-d, network-name)
Description
An agent predicate that checks if the agent has an edge connecting from another agent in a specified network.
For undirected networks, is_connected_from()
and is_connected_to()
are logically equivalent.
Parameters
agent_id
The
id
of the agent from whom the connection is being checked.network-name
The name of the network in which the connection is being checked.
Returns
1
if the evaluating agent has an edge directed from the agent with ID of <agent_id>
in a directed network, <network>
. 0
otherwise.
In an undirected network, 1
is returned if there is an edge connecting the two agents in the network. 0
otherwise.
Examples
If there is a directed network named NETWORK
with two agents, agent1
and agent2
, with agent ids, 0001
0002
respectively, with an edge from agent1
to agent2
, but no edge from agent2
to agent1
, then:
is_connected_from(0002, NETWORK)
returns 0
when evaluated by agent1
and
is_connected_from(0001, NETWORK)
returns 1
when evaluated by agent2
.
In the same situation but where NETWORK
is an undirected network where agent1
and agent2
have an edge connecting them:
is_connected_from(0002, NETWORK)
returns 1
when evaluated by agent1
and
is_connected_from(0001, NETWORK)
returns 1
when evaluated by agent2
.
See Also
is_connected_to(), add_edge_to(), add_edge_from(), delete_edge_to(), delete_edge_from()