Interface Hierarchy<NodeDatum, LinkDatum, Child, ChildData>

create a MutGraph from hierarchical data

By default, each piece of data passed in corresponds to a node, and their children will be explored recursively creating more nodes. Use children to change how children are found, or childrenData to also attach link data.

Created with graphHierarchy.

interface Hierarchy<
    NodeDatum,
    LinkDatum,
    Child extends Children<NodeDatum>,
    ChildData extends ChildrenData<NodeDatum, LinkDatum>,
> {
    children<NewNode, NewChildren extends Children<NewNode>>(
        val: NewChildren & Children<NewNode>,
    ): Hierarchy<
        NewNode,
        undefined,
        NewChildren,
        WrappedChildren<NewNode, NewChildren>,
    >;
    children(): Child;
    childrenData<
        NewNode,
        NewLink,
        NewChildrenData extends ChildrenData<NewNode, NewLink>,
    >(
        data: NewChildrenData & ChildrenData<NewNode, NewLink>,
    ): Hierarchy<
        NewNode,
        NewLink,
        WrappedChildrenData<NewNode, NewChildrenData>,
        NewChildrenData,
    >;
    childrenData(): ChildData;
    (...data: readonly NodeDatum[]): MutGraph<NodeDatum, LinkDatum>;
}

Type Parameters

Methods