Skip to main content

class GraphContext<UN,TT,Dir,Tp>

undocumented

Implements: GraphBase.Context<UN,Tp>

Type parameters

NameConstraintsDefaultDescription
UNundocumented
TTstringundocumented
Dirbooleanundocumented
TpGraphTypesContextImplGraphTypesContextImplundocumented

Properties

_empty

undocumented

Definition

readonly _empty: WithGraphValues<Tp, UN, any>['normal'];

_fixedType

undocumented

Definition

readonly _fixedType: any;

Overrides

Context._fixedType

builder

undocumented

Definition

readonly builder: () => any;

empty

undocumented

Definition

readonly empty: <N extends UN>() => any;

from

undocumented

Definition

readonly from: any;

isDirected

undocumented

Definition

readonly isDirected: Dir;

Overrides

Context.isDirected

linkConnectionsContext

undocumented

Definition

readonly linkConnectionsContext: WithGraphValues<Tp, UN, any>['linkConnectionsContext'];

Overrides

Context.linkConnectionsContext

linkMapContext

undocumented

Definition

readonly linkMapContext: WithGraphValues<Tp, UN, any>['linkMapContext'];

Overrides

Context.linkMapContext

of

undocumented

Definition

readonly of: <N>(values_0: GraphElement<N>, ...values_1: GraphElement<N>[]) => any;

reducer

undocumented

Definition

reducer: <N extends UN>(source?: StreamSource<GraphElement<N>>) => any;

typeTag

undocumented

Definition

readonly typeTag: TT;

Overrides

Context.typeTag

Methods

builder

Returns an empty builder instance.

Definition

builder<N extends UN>(): WithGraphValues<Tp, N, unknown>['builder'];

Type parameters

NameConstraintsDescription
NUN
example
ArrowValuedGraphHashed.builder<number, string>()    // => ArrowValuedGraphHashed.Builder<number, string>

Overrides

Factory.builder

createBuilder

undocumented

Definition

createBuilder<N extends UN>(source?: WithGraphValues<Tp, N, any>['nonEmpty']): WithGraphValues<Tp, N, any>['builder'];

Type parameters

NameConstraintsDescription
NUN

Parameters

NameTypeDescription
sourceWithGraphValues<Tp, N, any>['nonEmpty']

createNonEmpty

undocumented

Definition

createNonEmpty<N extends UN>(linkMap: WithGraphValues<Tp, N, any>['linkMapNonEmpty'], connectionSize: number): WithGraphValues<Tp, N, any>['nonEmpty'];

Type parameters

NameConstraintsDescription
NUN

Parameters

NameTypeDescription
linkMapWithGraphValues<Tp, N, any>['linkMapNonEmpty']
connectionSizenumber

empty

Returns the (singleton) empty instance of this type and context with given key and value types.

Definition

empty<N extends UN>(): WithGraphValues<Tp, N, unknown>['normal'];

Type parameters

NameConstraintsDescription
NUN
example
ArrowGraphHashed.empty<number>()    // => ArrowGraphHashed<number>
ArrowGraphHashed.empty<string>() // => ArrowGraphHashed<string>

Overrides

Factory.empty

from

Returns an immutable valued Graph, containing the graph elements from each of the given sources.

Definitions

from<N extends UN>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<GraphElement<N>>>): WithGraphValues<Tp, N, unknown>['nonEmpty'];

from<N extends UN>(...sources: ArrayNonEmpty<StreamSource<GraphElement<N>>>): WithGraphValues<Tp, N, unknown>['normal'];

Type parameters

NameConstraintsDescription
NUN

Parameters

NameTypeDescription
sourcesArrayNonEmpty<StreamSource.NonEmpty<GraphElement<N>>>an array of StreamSource instances containing graph elements to add
example
ArrowGraphHashed.from([[1], [2]], [[3, 4]])  // => ArrowGraphHashed.NonEmpty<number>

Overrides

Factory.from

isNonEmptyInstance

undocumented

Definition

isNonEmptyInstance(source: any): source is WithGraphValues<Tp, UN, any>['nonEmpty'];

Parameters

NameTypeDescription
sourceany

of

Returns an immutable valued Graph instance containing the graph elements from the given graphElements.

Definition

of<N extends UN>(...graphElements: ArrayNonEmpty<GraphElement<N>>): WithGraphValues<Tp, N, unknown>['nonEmpty'];

Type parameters

NameConstraintsDescription
NUN

Parameters

NameTypeDescription
graphElementsArrayNonEmpty<GraphElement<N>>a non-empty array of graph elements that are either a single tuple containing a node, or a triplet containing two connection nodes and the connection value.
example
ArrowGraphHashed.of([1], [2], [3, 4]) // => ArrowGraphHashed.NonEmpty<number>

Overrides

Factory.of

reducer

Returns a Reducer that adds received graph elements to a Graph and returns the Graph as a result. When a source is given, the reducer will first create a graph from the source, and then add graph elements to it.

Definition

reducer<N extends UN>(source?: StreamSource.NonEmpty<GraphElement<N>>): Reducer<GraphElement<N>, WithGraphValues<Tp, N, unknown>['normal']>;

Type parameters

NameConstraintsDescription
NUN

Parameters

NameTypeDescription
sourceStreamSource.NonEmpty<GraphElement<N>>(optional) an initial source of graph elements to add to
example
const someSource: GraphElement<number>[] = [[1, 2], [3], [5]];
const result = Stream.of([1, 3], [4, 3]).reduce(ArrowGraphSorted.reducer(someSource))
result.toArray() // => [[1, 2], [1, 3], [4, 3], [5]]
note

uses a builder under the hood. If the given source is a Graph in the same context, it will directly call .toBuilder().

Overrides

Factory.reducer