bnmetrics.protocol¶
GraphLike Protocol — the cross-package contract for graph input.
Classes¶
A graph backed by a square int8 endpoint-mark matrix. |
Module Contents¶
- class bnmetrics.protocol.GraphLike[source]¶
Bases:
ProtocolA graph backed by a square int8 endpoint-mark matrix.
Conformance is duck-typed: any object that exposes the three attributes below satisfies the Protocol. No inheritance, no import of bnmetrics required. cbcd’s
DAG,CPDAG,PAGinstances conform with zero adaptation.The required attributes are:
n_vars— number of variables (rows / columns ofendpoints).endpoints— square(n_vars, n_vars)endpoint-mark matrix following thebnmetrics.EndpointMarkconvention. Must be an attribute, not a property — bnmetrics metric code reads this in hot loops.var_names— optional human-readable variable names;Nonemeans index-only.
- endpoints: numpy.typing.NDArray[numpy.int8]¶