Edge#

class langchain_core.runnables.graph.Edge(
source: str,
target: str,
data: Stringifiable | None = None,
conditional: bool = False,
)[source]#

Edge in a graph.

Create new instance of Edge(source, target, data, conditional)

Attributes

conditional

Whether the edge is conditional.

data

Optional data associated with the edge.

source

The source node id.

target

The target node id.

Methods

copy(*[, source, target])

Return a copy of the edge with optional new source and target nodes.

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Parameters:
  • source (str)

  • target (str)

  • data (Stringifiable | None)

  • conditional (bool)

copy(
*,
source: str | None = None,
target: str | None = None,
) Edge[source]#

Return a copy of the edge with optional new source and target nodes.

Parameters:
  • source (str | None) – The new source node id. Defaults to None.

  • target (str | None) – The new target node id. Defaults to None.

Returns:

A copy of the edge with the new source and target nodes.

Return type:

Edge

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.