is_connected_to()

Agent predicate that checks if the agent is connected to another agent in a specified network.

Synopsis

is_connected_to(agent-id, network-name)

Description

An agent predicate that checks if the agent has an edge to 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 to 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 to 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 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_to(0002, NETWORK)

returns 1 when evaluated by agent1 and

is_connected_to(0001, NETWORK)

returns 0 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_to(0002, NETWORK)

returns 1 when evaluated by agent1 and

is_connected_to(0001, NETWORK)

returns 1 when evaluated by agent2.

See Also

add_edge_from(), add_edge_to(), delete_edge_from(), delete_edge_to(), is_connected_from()