class GraphContext<UN,TT,Dir,Tp>
undocumented
Implements: GraphBase.Context<UN,Tp>
Type parameters
Name | Constraints | Default | Description |
---|---|---|---|
UN | undocumented | ||
TT | string | undocumented | |
Dir | boolean | undocumented | |
Tp | GraphTypesContextImpl | GraphTypesContextImpl | undocumented |
Properties
_empty
undocumented
_empty
Definition
readonly _empty:
WithGraphValues
<Tp, UN, any>['normal'];
_fixedType
undocumented
_fixedType
isDirected
undocumented
isDirected
linkConnectionsContext
undocumented
linkConnectionsContext
Definition
readonly linkConnectionsContext:
WithGraphValues
<Tp, UN, any>['linkConnectionsContext'];
Overrides
linkMapContext
undocumented
linkMapContext
of
undocumented
of
Definition
readonly of: <N>(values_0: GraphElement<N>, ...values_1: GraphElement<N>[]) => any;
reducer
undocumented
reducer
Definition
reducer: <N extends UN>(source?:
StreamSource
<GraphElement<N>>) => any;
typeTag
undocumented
typeTag
Methods
builder
Returns an empty builder instance.
builder
Definition
builder<N extends UN>():
WithGraphValues
<Tp, N, unknown>['builder'];
Type parameters
Name | Constraints | Description |
---|---|---|
N | UN |
ArrowValuedGraphHashed.builder<number, string>() // => ArrowValuedGraphHashed.Builder<number, string>
Overrides
createBuilder
undocumented
createBuilder
Definition
createBuilder<N extends UN>(source?:
WithGraphValues
<Tp, N, any>['nonEmpty']):
WithGraphValues
<Tp, N, any>['builder'];
Type parameters
Name | Constraints | Description |
---|---|---|
N | UN |
Parameters
Name | Type | Description |
---|---|---|
source | WithGraphValues <Tp, N, any>['nonEmpty'] |
createNonEmpty
undocumented
createNonEmpty
Definition
createNonEmpty<N extends UN>(linkMap:
WithGraphValues
<Tp, N, any>['linkMapNonEmpty'], connectionSize: number):
WithGraphValues
<Tp, N, any>['nonEmpty'];
Type parameters
Name | Constraints | Description |
---|---|---|
N | UN |
Parameters
Name | Type | Description |
---|---|---|
linkMap | WithGraphValues <Tp, N, any>['linkMapNonEmpty'] | |
connectionSize | number |
empty
Returns the (singleton) empty instance of this type and context with given key and value types.
empty
Definition
empty<N extends UN>():
WithGraphValues
<Tp, N, unknown>['normal'];
Type parameters
Name | Constraints | Description |
---|---|---|
N | UN |
ArrowGraphHashed.empty<number>() // => ArrowGraphHashed<number>
ArrowGraphHashed.empty<string>() // => ArrowGraphHashed<string>
Overrides
from
Returns an immutable valued Graph, containing the graph elements from each of the given sources
.
from
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
Name | Constraints | Description |
---|---|---|
N | UN |
Parameters
Name | Type | Description |
---|---|---|
sources | ArrayNonEmpty < StreamSource.NonEmpty <GraphElement<N>>> | an array of StreamSource instances containing graph elements to add |
ArrowGraphHashed.from([[1], [2]], [[3, 4]]) // => ArrowGraphHashed.NonEmpty<number>
Overrides
isNonEmptyInstance
undocumented
isNonEmptyInstance
Definition
isNonEmptyInstance(source: any): source is
WithGraphValues
<Tp, UN, any>['nonEmpty'];
Parameters
Name | Type | Description |
---|---|---|
source | any |
of
Returns an immutable valued Graph instance containing the graph elements from the given graphElements
.
of
graphElements
.Definition
of<N extends UN>(...graphElements:
ArrayNonEmpty
<GraphElement<N>>):
WithGraphValues
<Tp, N, unknown>['nonEmpty'];
Type parameters
Name | Constraints | Description |
---|---|---|
N | UN |
Parameters
Name | Type | Description |
---|---|---|
graphElements | ArrayNonEmpty <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. |
ArrowGraphHashed.of([1], [2], [3, 4]) // => ArrowGraphHashed.NonEmpty<number>
Overrides
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.
reducer
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
Name | Constraints | Description |
---|---|---|
N | UN |
Parameters
Name | Type | Description |
---|---|---|
source | StreamSource.NonEmpty <GraphElement<N>> | (optional) an initial source of graph elements to add to |
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]]
uses a builder under the hood. If the given source
is a Graph in the same context, it will directly call .toBuilder()
.