Skip to main content

interface EdgeValuedGraphHashed.Context<UN>

The EdgeValuedGraphHashed's Context instance that serves as a factory for all related immutable instances and builders.

Extends: EdgeValuedGraphBase.Context<UN,Tp>

Type parameters

NameDescription
UNthe upper type limit for node types for which this context can create instances

Properties

_fixedType

undocumented

Definition

readonly _fixedType: UN;

Overrides

Context._fixedType

isDirected

Returns true if the graphs created by this context are arrow (directed) graphs.

Definition

readonly isDirected: boolean;

Overrides

Context.isDirected

linkConnectionsContext

The context instance used to create internal connection maps

Definition

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

Overrides

Context.linkConnectionsContext

linkMapContext

The context instance used to create internal link maps

Definition

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

Overrides

Context.linkMapContext

typeTag

undocumented

Definition

readonly typeTag: 'EdgeValuedGraphHashed';

Overrides

Context.typeTag

Methods

builder

Returns an empty builder instance.

Definition

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

Type parameters

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

Overrides

Factory.builder

empty

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

Definition

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

Type parameters

NameConstraintsDescription
NUN
V
example
ArrowValuedGraphHashed.empty<number, string>()    // => ArrowValuedGraphHashed<number, string>
ArrowValuedGraphHashed.empty<string, boolean>() // => ArrowValuedGraphHashed<string, boolean>

Overrides

Factory.empty

from

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

Definitions

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

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

Type parameters

NameConstraintsDescription
NUN
V

Parameters

NameTypeDescription
sourcesArrayNonEmpty<StreamSource.NonEmpty<ValuedGraphElement<N, V>>>an array of StreamSource instances containing graph elements to add
example
ArrowValuedGraphHashed.from([[1], [2]], [[3, 4, 'c']])  // => ArrowValuedGraphHashed.NonEmpty<number, string>

Overrides

Factory.from

of

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

Definition

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

Type parameters

NameConstraintsDescription
NUN
V

Parameters

NameTypeDescription
graphElementsArrayNonEmpty<ValuedGraphElement<N, V>>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
ArrowValuedGraphHashed.of([1], [2], [3, 4, 'a']) // => ArrowValuedGraphHashed.NonEmpty<number, string>

Overrides

Factory.of

reducer

Returns a Reducer that adds valued received graph elements to a ValuedGraph and returns the ValuedGraph 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, V>(source?: StreamSource.NonEmpty<ValuedGraphElement<N, V>>): Reducer<ValuedGraphElement<N, V>, WithGraphValues<Tp, N, V>['normal']>;

Type parameters

NameConstraintsDescription
NUN
V

Parameters

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

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

Overrides

Factory.reducer