graph
sample
Sample graph nodes.
strata graph sampledb.graphs.sample(graph: 'str', *, count: 'Optional[int]' = None) -> 'Sample'wire graph_sample
Returns a deterministic representative sample of nodes from a graph: the total live node count and up to `count` nodes (default 10), evenly strided over the ordered node ids. Latest state only.
Paginated responses use opaque cursors. Clients should pass the returned cursor back to the same command shape and must not parse cursor contents.
To see the complete help for this command, run:
strata graph sample --helphelp(db.graphs.sample)
Example
A representative sample of nodes plus the total count.
strata graph create gstrata graph add-node g astrata graph add-node g bstrata graph sample g
_ = db.graphs.create("g")_ = db.graphs.add_node("g", "a")_ = db.graphs.add_node("g", "b")db.graphs.sample("g").total_count
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| graph | string | yes | Graph name. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| count | integer or null | no | Optional sample count. Defaults to 10. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
SamplePage<GraphNodeDataOutput>
- dataobject
Shared pagination continuation facts.
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.graph_name | never | not_started |
| not_found.engine.graph | never | not_applicable |