DiagramEdge

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

DiagramEdge

class DiagramEdge

A particle propagator joining two vertices in a Feynman diagram.

Edges retain their particle identity, endpoints, flow direction, and an symbolic numerator contribution when Feynman rules have been instantiated.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
result = process.generate_diagrams(loops=1)
diagram = result.diagrams[0]
edge = diagram.internal_edges[0]
endpoints = (edge.source, edge.target)
particle = edge.particle
factor = edge.numerator_expression()

Attributes

Name Description
directed Report whether the edge carries an oriented particle-flow arrow.
external_connection Return the shared sewing identity of an external momentum carrier.
external_index Return the external-leg index
external_name Return the external-state label retained during finalization.
external_state Return "incoming" or "outgoing" for an external edge
id Return this edge’s integer ID within the diagram.
is_dangling Report whether this line has only one incident interaction vertex.
is_dummy Report whether this line is a dummy graph attachment.
is_external Report whether this edge represents an external particle state.
numerator Return the symbolic numerator annotation as source text
particle The model particle, including symbolic mass, width parameter, spin and charge.
particle_name Return the particle name associated with this propagator edge.
particle_pdg Return the PDG code of the particle carried by this edge.
propagator The model propagator template for an internal physical line, or None
source Return the source interaction ID, or None at a dangling sink.
target Return the target interaction ID, or None at a dangling source.

directed

DiagramEdge.directed: builtins.bool

Report whether the edge carries an oriented particle-flow arrow.

Examples

Using the setup in the DiagramEdge class example:

fermion_edges = [edge for edge in diagram.edges if edge.directed]

external_connection

DiagramEdge.external_connection: typing.Optional[builtins.int]

Return the shared sewing identity of an external momentum carrier.

Examples

Using the setup in the DiagramEdge class example:

connections = [(line.id, line.external_connection) for line in diagram.edges]

external_index

DiagramEdge.external_index: builtins.int

Return the external-leg index.

Raises :class:DiagramError for an internal edge. Use :attr:is_external before accessing external-state metadata.

Examples

Using the setup in the DiagramEdge class example:

external_labels = [(edge.id, edge.external_index) for edge in diagram.external_edges]

external_name

DiagramEdge.external_name: typing.Optional[builtins.str]

Return the external-state label retained during finalization.

Examples

Using the setup in the DiagramEdge class example:

labels = [line.external_name for line in diagram.external_edges]

external_state

DiagramEdge.external_state: builtins.str

Return "incoming" or "outgoing" for an external edge.

Raises :class:DiagramError for an internal edge.

Examples

Using the setup in the DiagramEdge class example:

states = [(line.id, line.external_state) for line in diagram.external_edges]

id

DiagramEdge.id: builtins.int

Return this edge’s integer ID within the diagram.

Examples

Using the setup in the DiagramEdge class example:

numerators = {line.id: line.numerator_expression() for line in diagram.internal_edges}

is_dangling

DiagramEdge.is_dangling: builtins.bool

Report whether this line has only one incident interaction vertex.

Examples

Using the setup in the DiagramEdge class example:

dangling_lines = [line for line in diagram.edges if line.is_dangling]

is_dummy

DiagramEdge.is_dummy: builtins.bool

Report whether this line is a dummy graph attachment.

Examples

Using the setup in the DiagramEdge class example:

physical_lines = [line for line in diagram.edges if not line.is_dummy]

is_external

DiagramEdge.is_external: builtins.bool

Report whether this edge represents an external particle state.

Examples

Using the setup in the DiagramEdge class example:

external_edges = [edge for edge in diagram.edges if edge.is_external]

numerator

DiagramEdge.numerator: builtins.str

Return the symbolic numerator annotation as source text.

Raises :class:DiagramError for an incomplete imported diagram that has no instantiated propagator numerator.

Examples

Using the setup in the DiagramEdge class example:

source_text = edge.numerator
factor = edge.numerator_expression()

particle

DiagramEdge.particle: Particle

The model particle, including symbolic mass, width parameter, spin and charge.

edge.particle.mass >>> edge.particle.width_parameter

Examples

Using the setup in the DiagramEdge class example:

assert edge.particle.name == edge.particle_name

particle_name

DiagramEdge.particle_name: builtins.str

Return the particle name associated with this propagator edge.

Examples

Using the setup in the DiagramEdge class example:

assert edge.particle_name == "phi"

particle_pdg

DiagramEdge.particle_pdg: builtins.int

Return the PDG code of the particle carried by this edge.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.edges[0]
edge.particle.pdg_code == edge.particle_pdg
True

propagator

DiagramEdge.propagator: typing.Optional[Propagator]

The model propagator template for an internal physical line, or None.

Template expressions retain model placeholders. Use numerator_expression() and denominator_expression() for the instantiated diagram factors.

Examples

Using the setup in the DiagramEdge class example:

propagator = edge.propagator

source

DiagramEdge.source: typing.Optional[builtins.int]

Return the source interaction ID, or None at a dangling sink.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.internal_edges[0]
vertices = {vertex.id: vertex for vertex in diagram.vertices}
source_vertex = vertices[edge.source]

target

DiagramEdge.target: typing.Optional[builtins.int]

Return the target interaction ID, or None at a dangling source.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.internal_edges[0]
vertices = {vertex.id: vertex for vertex in diagram.vertices}
target_vertex = vertices[edge.target]

Methods

Name Description
__repr__ Return a concise description of the edge and its endpoints.
_repr_pretty_ Write the edge summary to an IPython pretty printer.
denominator_expression Return this edge’s tagged q² - m² denominator as a scalar TensorExpression
momentum_expression Return the oriented edge momentum as a rank-one Minkowski TensorExpression
momentum_signature Return integer loop and external momentum coefficients in the selected basis
numerator_expression Return the numerator annotation as a Spenso TensorExpression.

__repr__

DiagramEdge.__repr__() -> builtins.str

Return a concise description of the edge and its endpoints.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.edges[0]
print(edge)  # shows particle identity, endpoints, and flow direction

_repr_pretty_

DiagramEdge._repr_pretty_(pretty: typing.Any, cycle: builtins.bool) -> None

Write the edge summary to an IPython pretty printer.

Examples

Using the setup in the DiagramEdge class example:

from IPython.lib.pretty import pretty
text = pretty(edge)

Parameters

  • pretty (Any) The IPython pretty-printer object.
  • cycle (bool) Whether this object is part of a recursive formatting cycle.

denominator_expression

DiagramEdge.denominator_expression(
    *,
    power: builtins.int = 1,
    dimension: typing.Optional[Expression | int | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | ComplexFloat | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | builtins.complex | tuple[Float | builtins.int | builtins.float | builtins.str | decimal.Decimal, Float | builtins.int | builtins.float | builtins.str | decimal.Decimal]] = None,
    in_lmb: builtins.bool = False,
    lmb: typing.Optional[LoopMomentumBasis] = None,
) -> TensorExpression

Return this edge’s tagged q² - m² denominator as a scalar TensorExpression.

Uses the shared diagram denominator builder, excluding widths, iε and custom UFO formulas. External, dummy and dangling lines raise DiagramError. Signed power and dimension follow FeynmanDiagram.denominator_expression(). in_lmb=True uses the stored basis; an explicit lmb takes precedence.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.internal_edges[0]
denominator = edge.denominator_expression(in_lmb=True)

Parameters

  • power (int, optional) Signed propagator power; defaults to one.
  • dimension (Expression or int or None, optional) Lorentz dimension; defaults to the shared symbolic dimension.
  • in_lmb (bool, optional) Route through the diagram’s stored loop-momentum basis.
  • lmb (LoopMomentumBasis or None, optional) Explicit basis from this diagram, overriding in_lmb.

momentum_expression

DiagramEdge.momentum_expression(
    *,
    dimension: typing.Optional[Expression | int | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | ComplexFloat | Float | builtins.int | builtins.float | builtins.str | decimal.Decimal | builtins.complex | tuple[Float | builtins.int | builtins.float | builtins.str | decimal.Decimal, Float | builtins.int | builtins.float | builtins.str | decimal.Decimal]] = None,
    in_lmb: builtins.bool = False,
    lmb: typing.Optional[LoopMomentumBasis] = None,
) -> TensorExpression

Return the oriented edge momentum as a rank-one Minkowski TensorExpression.

The default is Q(edge, mink(D)). With in_lmb=True, return its linear combination of loop and external momenta. An explicit lmb from this diagram takes precedence. Dummy edges have no momentum and raise DiagramError.

Examples

Using the setup in the DiagramEdge class example:

momentum = edge.momentum_expression(dimension=4, in_lmb=True)

Parameters

  • dimension (Expression or int or None, optional) Lorentz dimension; defaults to the shared symbolic dimension.
  • in_lmb (bool, optional) Route through the diagram’s stored loop-momentum basis.
  • lmb (LoopMomentumBasis or None, optional) Explicit basis from this diagram, overriding in_lmb.

momentum_signature

DiagramEdge.momentum_signature(
    *,
    lmb: typing.Optional[LoopMomentumBasis] = None,
) -> MomentumSignature

Return integer loop and external momentum coefficients in the selected basis.

Defaults to the diagram’s stored basis. Dummy edges have no signature.

Examples

Using the setup in the DiagramEdge class example:

edge.momentum_signature().loops
edge.momentum_signature().external

Parameters

  • lmb (LoopMomentumBasis or None, optional) Explicit basis from this diagram; defaults to its stored basis.

numerator_expression

DiagramEdge.numerator_expression() -> TensorExpression

Return the numerator annotation as a Spenso TensorExpression.

Examples

Using the setup in the DiagramEdge class example:

edge = diagram.edges[0]
propagator_factor = edge.numerator_expression()
weighted_propagator = diagram.overall_factor_expression() * propagator_factor