langchain_core.runnables.graph.Edge¶

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

Edge in a graph.

Parameters
  • source (str) – The source node id.

  • target (str) – The target node id.

  • data (Optional[Stringifiable]) – Optional data associated with the edge. Defaults to None.

  • conditional (bool) – Whether the edge is conditional. Defaults to False.

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

Attributes

conditional

Alias for field number 3

data

Alias for field number 2

source

Alias for field number 0

target

Alias for field number 1

Methods

__init__()

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.

__init__()¶
copy(*, source: Optional[str] = None, target: Optional[str] = None) Edge[source]¶

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

Parameters
  • source (Optional[str]) – The new source node id. Defaults to None.

  • target (Optional[str]) – 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.