Graph

Classes

Graph

Methods

(static) create() → {Graph}

Instantiates a graph without needing `new`.
Source:
Returns:
- A graph instance.
Type
Graph

(static) source(object) → {Graph}

Imports a format compliant graph into a new one. It expects nested nodes to use the node metadata format. Useful for sending and importing graphs over the network.
Parameters:
Name Type Description
object Object The raw graph object.
Source:
Returns:
- A new graph instance that consumes the imported data.
Type
Graph

merge(graph) → {Graph}

Merge one graph with another (graph union operation).
Parameters:
Name Type Description
graph Object The graph to merge with. Items must be enumerable, and cannot be inherited from prototypes.
Source:
Returns:
- The `this` context.
Type
Graph

overlap(target) → {Graph}

Figures out what fields are common to both graphs.
Parameters:
Name Type Description
target Graph Any other graph.
Source:
Returns:
- The shared properties between both graphs.
Type
Graph

rebase(target) → {Graph}

Replays all the changes in the graph as though they occurred after the events in the target graph.
Parameters:
Name Type Description
target Graph Preceding state.
Source:
Returns:
- A new graph containing the rebased nodes.
Type
Graph

value(key) → {Node|null}

Return the unmodified value of a node lookup.
Parameters:
Name Type Description
key String The name/uid of the node.
Source:
Returns:
- The node if found, otherwise `null`.
Type
Node | null