Skip to content

Evaluate Graph

evaluate_graph

Evaluate_graph workflow action.

Compares a learned graph against a ground-truth reference and returns structural metrics. The action reads the matched entry of the input graph cache (MAP pattern) and writes a single metrics object to the output cache. Metric values live only in that object: the action metadata records the effective parameters and the outcome status. The action is stateless, so validation and execution delegate to module-level helpers and each step stays within the module and method limits.

The action class lives in action and delegates to request, execution, comparison, reference and metric_values; shared constants live in constants. Public names are re-exported here so the provider and existing imports keep working.

Modules:

  • action –

    The evaluate_graph action class and parameter validation.

  • comparison –

    Structural and equivalence comparisons for evaluate_graph.

  • constants –

    Shared constants for the evaluate_graph action.

  • execution –

    Executing one evaluate_graph comparison.

  • metric_values –

    Metric values and metrics objects for evaluate_graph.

  • reference –

    Resolving the ground-truth reference graph for evaluate_graph.

  • request –

    Building evaluate_graph requests and action metadata.

Classes:

Attributes:

NO_GRAPH_ERROR module-attribute

NO_GRAPH_ERROR = 'No graph present'

Error recorded when the input run produced no learnt graph.

VALID_EVALUATE_METRICS module-attribute

VALID_EVALUATE_METRICS = frozenset(
    {
        "f1",
        "shd",
        "precision",
        "recall",
        "edge",
        "node_count",
        "equiv.f1",
        "equiv.shd",
        "equiv.edge",
    }
)

Metric names supported by the evaluate_graph action.

EvaluateGraphAction

Evaluate a learned graph against a ground-truth reference.

Attributes:

  • action_name –

    Action name as used in workflow definitions.

  • pattern –

    Workflow action pattern used for cache validation.

Methods:

  • run –

    Evaluate the matched entry graph against the reference graph.

  • validate –

    Validate evaluate_graph parameters before execution.

run
run(
    parameters: Dict[str, Any],
    mode: str,
    context: Optional[Any] = None,
    logger: Optional[Any] = None,
) -> ActionResult

Evaluate the matched entry graph against the reference graph.

MAP pattern action: exactly one graph arrives via the '_aggregation_entries' parameter, and the reference may be a single ground-truth graph file or a workflow cache (.db) whose entries share the input cache's key structure.

Parameters:

  • parameters
    (Dict[str, Any]) –

    Action parameter values.

  • mode
    (str) –

    Execution mode ('dry-run', 'run' or 'compare').

  • context
    (Optional[Any], default: None ) –

    Workflow context for optimisation.

  • logger
    (Optional[Any], default: None ) –

    Logger for reporting.

Returns:

  • ActionResult –

    Tuple of (status, metadata, objects).

Raises:

  • ActionExecutionError –

    If execution fails.

validate
validate(parameters: Dict[str, Any]) -> None

Validate evaluate_graph parameters before execution.

Parameters:

  • parameters
    (Dict[str, Any]) –

    Action parameter values.

Raises:

  • ValueError –

    If a parameter is missing or invalid. The provider converts this to an ActionValidationError.