Skip to content

compile_chordal_nbc

from tensorsig.offset_coded_signatures.graph_queries import compile_chordal_nbc

Compile the direct parent-tree family for a chordal occurrence graph.

The occurrence graph joins equal-channel occurrences and lifts every edge of graph to a complete join. It must be connected and chordal.

Source code in src/tensorsig/offset_coded_signatures/_graph/chordal_nbc.py
def compile_chordal_nbc(
    occurrence_channels: Sequence[int],
    graph: DependenceGraph,
) -> ChordalNbcPlan:
    """Compile the direct parent-tree family for a chordal occurrence graph.

    The occurrence graph joins equal-channel occurrences and lifts every edge
    of ``graph`` to a complete join.  It must be connected and chordal.
    """
    if not isinstance(graph, DependenceGraph):
        raise TypeError("graph must be a DependenceGraph.")
    channels = tuple(occurrence_channels)
    if len(channels) < 2:
        raise ValueError("occurrence_channels must contain at least two vertices.")
    channels = _validate_occurrence_channels(channels, len(channels))
    plan = _compile_chordal_nbc(channels, graph)
    if plan is None:
        raise ValueError("the occurrence dependence graph must be connected.")
    return plan