Interface Stratify<LinkDatum, Ops>

The operator that constructs a MutGraph from stratified tabularesque data.

Create a default operator with graphStratify. The accessors for a node's id or parents' ids can be altered, or parentData can be specified to specify parent ids and attach data to the edge for that parent.

interface Stratify<LinkDatum, Ops extends StratifyOps<never, LinkDatum>> {
    id<NewId extends Id<never>>(
        id: NewId,
    ): Stratify<LinkDatum, U<Ops, "id", NewId>>;
    id(): Ops["id"];
    parentData<
        NewLinkDatum,
        NewParentData extends ParentData<never, NewLinkDatum>,
    >(
        data: NewParentData & ParentData<never, NewLinkDatum>,
    ): Stratify<
        NewLinkDatum,
        {
            id: Ops["id"];
            parentData: NewParentData;
            parentIds: WrappedParentData<NewParentData>;
        },
    >;
    parentData(): Ops["parentData"];
    parentIds<NewParentIds extends ParentIds<never>>(
        ids: NewParentIds,
    ): Stratify<
        undefined,
        {
            id: Ops["id"];
            parentData: WrappedParentIds<NewParentIds>;
            parentIds: NewParentIds;
        },
    >;
    parentIds(): Ops["parentIds"];
    <N extends unknown>(data: readonly N[]): MutGraph<N, LinkDatum>;
}

Type Parameters

  • create a graph from stratify data

    Type Parameters

    • N extends unknown

    Parameters

    • data: readonly N[]

      the node data to create a graph from

    Returns MutGraph<N, LinkDatum>

    graph - the graph representation of the data

Methods