A directed acyclic graph (DAG). In Verge3D this structure is used to define the hierarchy of node-based materials.
Create a new graph of the size V
.
Graph size.
Graph adjacency list.
Data attached to graph nodes.
Graph edges.
Add a new node to the graph and attach .nodeInfo data to it.
Remove all nodes and edges from the graph.
Add an edge to the graph.
Add a new edge to the graph which connects nodes v
and w
.
Remove an edge from the graph which connects nodes v
and w
.
Return an edge which connects nodes v
and w
. Return null
if no such edge is found.
Return node adjacent to node v
.
Return node info data for node v
.
Return the index of the node which has the passed .nodeInfo data.
Return a new graph which has all edges reversed. The source graph remains intact.
Return graph length.
Return input edges for node v
.
Return output edges for node v
.
Disconnect node v
from the graph. If removeNode=false
(default) leave the disconnected node inside the graph. If removeNode=true
remove the node (with its data) as well.
Insert a G
subgraph into the graph. The edgesInG
and edgesOutG
arrays represent input and output edges which will be used to connect the subgraph. Optional callbacks copyNodeCb
and copyEdgeCb
are executed per node/edge inserted to the graph.
Convert the graph to the DOT (Graphviz) format and print to the browser console. Optional labelCallback
is used to assign labels for the printed graph nodes. It accepts node index and node info as parameters.
For more info on how to obtain the source code of this module see this page.