GFQL Chain Matcher#

Chain enables combining multiple matchers into a single matcher, e.g., for mining paths and subgraphs.

class graphistry.compute.chain.Chain(chain, validate=True)#

Bases: ASTSerializable

Parameters:
classmethod from_json(d, validate=True)#

Convert a JSON AST into a list of ASTObjects

Parameters:
  • d (Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]])

  • validate (bool)

Return type:

Chain

to_json(validate=True)#

Convert a list of ASTObjects into a JSON AST

Return type:

Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]]

validate(collect_all=False)#

Override to collect all chain validation errors.

Parameters:

collect_all (bool)

Return type:

List[GFQLValidationError] | None

validate_schema(g, collect_all=False)#

Validate this chain against a graph’s schema without executing.

Args:

g: Graph to validate against collect_all: If True, collect all errors. If False, raise on first.

Returns:

If collect_all=True: List of errors (empty if valid) If collect_all=False: None if valid

Raises:

GFQLSchemaError: If collect_all=False and validation fails

Parameters:
Return type:

List[GFQLSchemaError] | None

graphistry.compute.chain.chain(self, ops, engine=EngineAbstract.AUTO, validate_schema=True, policy=None, context=None)#

Chain a list of ASTObject (node/edge) traversal operations

Return subgraph of matches according to the list of node & edge matchers If any matchers are named, add a correspondingly named boolean-valued column to the output

For direct calls, exposes convenience List[ASTObject]. Internal operational should prefer Chain.

Use engine=’cudf’ to force automatic GPU acceleration mode

Parameters:
  • ops (List[ASTObject] | Chain) – List[ASTObject] Various node and edge matchers

  • validate_schema (bool) – Whether to validate the chain against the graph schema before executing

  • policy – Optional policy dict for hooks

  • context – Optional ExecutionContext for tracking execution state

  • self (Plottable)

  • engine (EngineAbstract | str)

Returns:

Plotter

Return type:

Plotter

graphistry.compute.chain.combine_steps(g, kind, steps, engine, label_steps=None)#

Collect nodes and edges, taking care to deduplicate and tag any names

Parameters:
Return type:

Any