FeynKit · latest
On this page

DiagramEdge

symbolica.community.hepkit 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()

Member details

id

Property · read-only#
id: 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}

source

Property · read-only#
source: Optional[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

Property · read-only#
target: Optional[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]

particle

Property · read-only#
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

propagator

Property · read-only#
propagator: 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

external_index

Property · read-only#
external_index: int

Return the external-leg index.

Raises DiagramError for an internal edge. Use 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_state

Property · read-only#
external_state: str

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

Raises 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]

is_external

Property · read-only#
is_external: 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]

external_connection

Property · read-only#
external_connection: Optional[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_name

Property · read-only#
external_name: Optional[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]

is_dummy

Property · read-only#
is_dummy: 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_dangling

Property · read-only#
is_dangling: 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]

particle_name

Property · read-only#
particle_name: 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

Property · read-only#
particle_pdg: 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

directed

Property · read-only#
directed: 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]

numerator

Property · read-only#
numerator: str

Return the symbolic numerator annotation as source text.

Raises 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()

denominator_expression

Method#
denominator_expression(*, power: int = 1, dimension: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]] = None, in_lmb: bool = False, lmb: 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

NameTypeDefaultDescription
powerint1

Signed propagator power; defaults to one.

dimensionOptional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]]None

Lorentz dimension; defaults to the shared symbolic dimension.

in_lmbboolFalse

Route through the diagram's stored loop-momentum basis.

lmbOptional[LoopMomentumBasis]None

Explicit basis from this diagram, overriding in_lmb.

energy_expression

Method#
energy_expression() -> Expression

Return this physical edge's symbolic energy component before momentum routing.

Use this scalar expression to build polynomial numerators for CFF energy integration.

Examples

Using the setup in the DiagramEdge class example:

energy = edge.energy_expression()
quadratic = energy ** 2

momentum_expression

Method#
momentum_expression(*, dimension: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]] = None, in_lmb: bool = False, lmb: 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

NameTypeDefaultDescription
dimensionOptional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]]None

Lorentz dimension; defaults to the shared symbolic dimension.

in_lmbboolFalse

Route through the diagram's stored loop-momentum basis.

lmbOptional[LoopMomentumBasis]None

Explicit basis from this diagram, overriding in_lmb.

momentum_signature

Method#
momentum_signature(*, lmb: 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

NameTypeDefaultDescription
lmbOptional[LoopMomentumBasis]None

Explicit basis from this diagram; defaults to its stored basis.

numerator_expression

Method#
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

__repr__

Method#
__repr__() -> 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_

Method#
_repr_pretty_(pretty: Any, cycle: 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

NameTypeDefaultDescription
prettyAny—

The IPython pretty-printer object.

cyclebool—

Whether this object is part of a recursive formatting cycle.