Edge#

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

Edge in a graph.

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

  • target (str) – The target node id.

  • data (Stringifiable |None) – 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

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.

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.