Function graphHierarchy

  • create a new Hierarchy with default settings

    Hierarchy operators create graphs from data that are already in a graph like form. By default it expects node data to have a children property with more node data.

    You can specify a different way to access children with Hierarchy#children or also specify link data with Hierarchy#childrenData.

    Parameters

    • Rest ...args: never[]

    Returns DefaultHierarchy

    Example

    If you want to make simple graph with default settings:

    const data = {
    "id": "Euler",
    "children": [
    {
    "id": "Lagrange",
    "children": [
    {
    "id": "Fourier"
    },
    {
    "id": "Poisson",
    "children": [ { "id": "Dirichlet" } ]
    }
    ]
    }
    ]
    } as const;

    const builder = graphHierarchy();
    const grf = builder(data);

    Example

    If you want to make a graph with link data:

    const data = {
    "id": "Euler",
    "children": [
    [
    { "id": "Lagrange" },
    "advisee",
    ]
    ]
    } as const;

    interface Data {
    children?: [Data, string][];
    }

    const builder = graphHierarchy()
    .childrenData(({ children = [] }: Data) => children);
    const grf = builder(data);

Generated using TypeDoc