Edge<E>Represents edge data containing source, target, and user data.
When to use
Use as the graph edge value that carries source node, target node, and stored edge data together.
export class class Edge<E>class Edge {
source: number;
target: number;
data: E;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Represents edge data containing source, target, and user data.
When to use
Use as the graph edge value that carries source node, target node, and stored
edge data together.
Edge<function (type parameter) E in Edge<E>E> extends import DataData.const Class: new <
A extends Record<string, any> = {}
>(
args: Types.VoidIfEmpty<{
readonly [P in keyof A]: A[P]
}>
) => Readonly<A> & Pipeable.Pipeable
Provides a base class for immutable data types.
When to use
Use when you need a lightweight immutable value type with .pipe() support.
Details
Extend Class with a type parameter to declare fields. The constructor
accepts those fields as a single object argument. When there are no fields
the argument is optional. Instances are Readonly and Pipeable.
Example (Defining a value class)
import { Data, Equal } from "effect"
class Person extends Data.Class<{ readonly name: string }> {}
const mike1 = new Person({ name: "Mike" })
const mike2 = new Person({ name: "Mike" })
console.log(Equal.equals(mike1, mike2))
// true
Class<{
readonly source: NodeIndexsource: type NodeIndex = numberNode index for node identification using plain numbers.
When to use
Use when storing or passing the stable identifier of a graph node between
Graph operations.
Details
addNode allocates node identifiers from the graph's next node index.
Gotchas
A NodeIndex is an identifier, not an array offset. Removed node identifiers
are not reused.
NodeIndex
readonly target: NodeIndextarget: type NodeIndex = numberNode index for node identification using plain numbers.
When to use
Use when storing or passing the stable identifier of a graph node between
Graph operations.
Details
addNode allocates node identifiers from the graph's next node index.
Gotchas
A NodeIndex is an identifier, not an array offset. Removed node identifiers
are not reused.
NodeIndex
readonly data: Edata: function (type parameter) E in Edge<E>E
}> {}