Skip to content

set_edge_label

Signature/Parameters

def set_edge_label(self, edge_label)

Assign or update labels for one or more edges.

Parameters:

Name Type Description Default
edge_label dict

Mapping of edge specifications to label values. Keys can be any valid edge representation accepted at initialization. Values are stored verbatim without validation.

required

Examples:

>>> G = DAG(graph="X -> Y")
>>> G.set_edge_label({("X", "Y"): "beta"})
>>> G.edge_label[("X", "Y")]
'beta'
Source code in causalinf/gcm.py
def set_edge_label(self, edge_label):
    """
    Assign or update labels for one or more edges.

    Parameters
    ----------
    edge_label : dict
        Mapping of edge specifications to label values. Keys can be any
        valid edge representation accepted at initialization. Values are
        stored verbatim without validation.

    Examples
    --------
    >>> G = DAG(graph="X -> Y")
    >>> G.set_edge_label({("X", "Y"): "beta"})
    >>> G.edge_label[("X", "Y")]
    'beta'
    """
    for edge, label in edge_label.items():
        self.edge_label[edge] = label