Reference 〉 Function

Edges.add(partnerAgent, kindstr'edge', directionint|bool|AgentNone, weightnum1)

Creates a new Edge object between the current agent and a new agent, for use in graphs and networks.


  • partner Agent, required

    The agent to which the current agent should be connected.

  • kind str, optional

    The type of connection being made. Can be used to create multiple non-conflicting networks.

    Default value: 'edge'

  • direction int|bool|Agent, optional

    • If an int, direction>0 signifies an outbound edge from the agent, direction<0 creates in inbound edge to the agent, and direction==0 creates an undirected edge.
    • If a bool, True creates an outbound link from the agent and False creates an undirected link.
    • If an agent object, indicates which agent should be the endpoint, the other being the startpoint.
    • If None, creates an undirected edge.

    Default value: None

  • weight num, optional

    The weight of the connection.

    Default value: 1

Return Value Edge

The newly created Edge object.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.