Skip to content

GraphOperations

Access via client.graphs. Also available as convenience methods on client.datasets.graph() and client.samples.graph().

crucible.resources.graphs.GraphOperations

Entity graph traversal operations.

Access via: client.graphs.get(), or as a convenience via client.samples.graph() / client.datasets.graph().

get(entity_id, recursive=False, as_networkx=False)

Return the graph of entities connected to entity_id.

By default returns only first-degree neighbours (direct parents, children, and cross-linked entities). Pass recursive=True for the full connected component.

Parameters:

Name Type Description Default
entity_id str

Unique ID of any sample or dataset.

required
recursive bool

If True, traverse the full connected component.

False
as_networkx bool

If True, return a networkx DiGraph instead of the raw node-link dict. Requires networkx to be installed.

False

Returns:

Type Description

dict | networkx.DiGraph: Node-link graph data.

project(project_id, as_networkx=False)

Return the full graph of all entities in a project.

Parameters:

Name Type Description Default
project_id str

Project identifier.

required
as_networkx bool

If True, return a networkx DiGraph instead of the raw node-link dict. Requires networkx to be installed.

False

Returns:

Type Description

dict | networkx.DiGraph: Node-link graph data.