Interface Connect<NodeDatum, Ops>

an operator that constructs a MutGraph from link data.

Create a default connect operator with graphConnect. The accessor for the source id string, target id string, and whether to allow single nodes can all be modified.

Links in the dag will have the same data as the objects passed in, and nodes will have the ids referenced as either the source or the target.

Type Parameters

Hierarchy

  • Connect
  • convert connect data into a graph

    Type Parameters

    • L extends unknown

    Parameters

    • data: readonly L[]

      an array of each connection

    Returns MutGraph<NodeDatum, L>

    grf - the resulting graph

Methods

  • set the node datum accessor

    Sets the id node datum accessor to the given IdNodeDatum and returns this Connect. This function allows you to decide what data to attach to nodes created via the connect method. The default is just the id string.

    (data) => data
    

    Type Parameters

    • NewNodeDatum

    • NewNodeDatumOp extends IdNodeDatum<NewNodeDatum>

    Parameters

    Returns Connect<NewNodeDatum, U<Ops, "nodeDatum", NewNodeDatumOp>>

  • Get the current id node datum operator

    Returns Ops["nodeDatum"]

  • set the single node allowance

    Sets the allowance for single nodes. If enabled and the source id equals the target id, then a single node with no parents will be created. Otherwise a self loop will be created which will result in an error. Note only single nodes without parents or children need to be specified this way, otherwise any other connection to a node will create it.

    (default: false)

    Parameters

    • val: boolean

    Returns Connect<NodeDatum, Ops>

  • get the current single node setting.

    Returns boolean

  • set the source id accessor

    Sets the source accessor to the given Id and returns this Connect. This should return the source id of the link data. The default accessor is:

    ([source, ]) => source
    

    Type Parameters

    • NewId extends Id<never>

    Parameters

    • id: NewId

    Returns Connect<NodeDatum, U<Ops, "sourceId", NewId>>

  • Gets the current sourceId accessor.

    Returns Ops["sourceId"]

  • set the target id accessor

    Sets the target accessor to the given Id and returns this Connect. This should return the target id of the link data. The default accessor is:

    ([, target]) => target
    

    Type Parameters

    • NewId extends Id<never>

    Parameters

    • id: NewId

    Returns Connect<NodeDatum, U<Ops, "targetId", NewId>>

  • Gets the current targetId accessor.

    Returns Ops["targetId"]

Generated using TypeDoc