Skip to content

@jdultra/ultra-globe


@jdultra/ultra-globe / ConnectedGraph

Class: ConnectedGraph

Defined in: topology/ConnectedGraph.d.ts:20

Worker-backed connected graph facade.

This class owns a topology graph description on the main thread and delegates preprocessing and graph algorithms to a single shared worker reused by all ConnectedGraph instances.

The connectivity model is intentionally source-agnostic so the graph can later be built from VectorLayer features, decoded EPANET content from EpanetLayer, or any other importer that can provide stable node and component identifiers.

Components represent network assets such as pipes, valves, pumps, switches, or cables. Nodes represent topological junctions between those assets. Stable component ids are preserved so graph algorithms can return application-facing identifiers directly, such as pipe UUIDs for shortest-path queries or valve ids for isolation traces.

Constructors

Constructor

new ConnectedGraph(connectivity?, options?): ConnectedGraph

Defined in: topology/ConnectedGraph.d.ts:68

Create a connected graph facade.

The constructor may receive connectivity immediately, or the graph can be initialized later through setConnectivity().

Parameters

connectivity?

optional initial connectivity graph definition

Object | null

options?

Object

optional creation options reserved for future worker configuration

Returns

ConnectedGraph

Accessors

graphId

Get Signature

get graphId(): string

Defined in: topology/ConnectedGraph.d.ts:86

Stable internal graph identifier used to address this instance inside the shared worker.

Returns

string

worker graph identifier


summary

Get Signature

get summary(): Object

Defined in: topology/ConnectedGraph.d.ts:92

Lightweight graph summary available on the main thread.

Returns

Object

current graph summary

Methods

destroy()

destroy(): void

Defined in: topology/ConnectedGraph.d.ts:186

Alias of dispose().

Returns

void


dispose()

dispose(): void

Defined in: topology/ConnectedGraph.d.ts:182

Dispose the graph facade and release the associated worker-side graph state.

Returns

void


isolationTrace()

isolationTrace(options?): Promise<Object>

Defined in: topology/ConnectedGraph.d.ts:166

Compute the boundary components that must be closed to isolate one or more target components.

For the pipe/valve use case, pass one pipe id or an array of pipe ids and keep the default boundary kind of valve. The algorithm performs a multi-source trace from the full target set so the isolated working zone is computed in a single traversal instead of repeating the trace for each target independently.

The returned result includes boundaryComponentIds and, when boundary kinds resolve to valves only, the convenience alias valveIds.

Parameters

options?

Object

isolation trace options

Returns

Promise<Object>

promise resolving to the isolation trace result


runAlgorithm()

runAlgorithm(name, params?): Promise<Object>

Defined in: topology/ConnectedGraph.d.ts:141

Execute a named graph algorithm in the shared worker.

This low-level entry point is intended for future algorithms implemented on the worker side. Callers that use a built-in high-level convenience method such as isolationTrace() usually do not need to invoke this method directly.

Parameters

name

string

worker algorithm name

params?

Object

algorithm-specific parameter payload

Returns

Promise<Object>

promise resolving to the algorithm result returned by the worker


setConnectivity()

setConnectivity(connectivity, options?): Promise<ConnectedGraph>

Defined in: topology/ConnectedGraph.d.ts:126

Replace the graph connectivity definition and rebuild worker-side preprocessing structures.

This method is intended for callers that already know the connectivity graph. Automatic extraction from VectorLayer or EPANET decoded content can be layered on top of this API.

Parameters

connectivity

Object

connectivity graph definition

options?

Object

optional creation options reserved for future worker configuration

Returns

Promise<ConnectedGraph>

promise resolving to this graph instance once the worker is ready


whenReady()

whenReady(): Promise<ConnectedGraph>

Defined in: topology/ConnectedGraph.d.ts:103

Wait until the current graph definition has been transferred to the worker and fully initialized.

Returns

Promise<ConnectedGraph>

promise resolving to this graph instance once ready


create()

static create(connectivity, options?): Promise<ConnectedGraph>

Defined in: topology/ConnectedGraph.d.ts:43

Create and initialize a connected graph in one step.

This is the most convenient entry point when the connectivity definition is already available and the caller wants a ready-to-use graph instance.

Parameters

connectivity

Object

connectivity graph definition

options?

Object

optional creation options reserved for future worker configuration

Returns

Promise<ConnectedGraph>

promise resolving to the initialized graph instance