construct a graph from hierarchical data
a source node to recursively find children of; you can pass multiple source nodes for disconnected or multi-rooted graphs
graph - a graph of the hierarchical data
set a new children accessor
This accessor takes passed in node data and returns an iterable of new node data that correspond to that nodes children. When this is specified, link data are left undefined.
Due to the way typescript inference happens, to make this accessor valid you will likely have to define a separate interface for the data type so that the recursive definition of children can be specified.
The default accessor is:
({ children }) => children
get the current children accessor
This is the current Children. If childrenData was specified, this will return a wrapped version that returns only the children of that operator.
set a new children data accessor
This accessor takes passed in node data and returns an iterable with tuples of new node data and the link data for the corresponding link. Use this function when your graph data has link information that you want to preserve in the graph structure for easy access from links.
get the current children data accessor
This is the current ChildrenData. If children was specified, this will return a wrapped version that returns undefined for all link data.
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.