Skip to content

@graphty/graphty-element / session / CostEstimate

Interface: CostEstimate ​

Defined in: graphty-element/src/session/cost/estimate.ts:66

What a run would cost, and how much the answer is worth.

Every field is something a consumer would otherwise guess at. seconds gates the button, confidence decides whether the sentence beside it reads "about" or "at least", blocksFrame decides whether a spinner is honest, cancellable decides whether a Cancel button appears at all, available and reason decide whether the control is offered, and basis is the sentence a person reads when they want to know where the number came from.

Properties ​

available ​

readonly available: boolean

Defined in: graphty-element/src/session/cost/estimate.ts:85

Whether it can run on this graph at all.


basis ​

readonly basis: string

Defined in: graphty-element/src/session/cost/estimate.ts:89

Where the number came from, in a sentence: the sizes, the work term and the provenance.


blocksFrame ​

readonly blocksFrame: boolean

Defined in: graphty-element/src/session/cost/estimate.ts:81

Whether running it would hold the render loop, so a UI knows a spinner would freeze.


cancellable ​

readonly cancellable: boolean

Defined in: graphty-element/src/session/cost/estimate.ts:83

Whether the work can be stopped once it has started.


confidence ​

readonly confidence: CostConfidence

Defined in: graphty-element/src/session/cost/estimate.ts:77

How much the number is worth.


costClass ​

readonly costClass: "instant" | "iterative" | "heavy" | "cubic" | "unbounded"

Defined in: graphty-element/src/session/cost/estimate.ts:79

The cost class the catalogue declares for this algorithm.


reason? ​

readonly optional reason?: string

Defined in: graphty-element/src/session/cost/estimate.ts:87

Why it cannot, in a sentence a person can read. Present only when available is false.


seconds ​

readonly seconds: number

Defined in: graphty-element/src/session/cost/estimate.ts:75

How long the run would take, in seconds.

Number.POSITIVE_INFINITY when the work cannot be bounded in advance -- an unbounded cost class, or a graph whose size is not a usable number. Infinity compares correctly against every threshold a consumer sets, so a gate written as seconds < 10 refuses it rather than letting an unbounded run through.