Represents a network to be visualized by Mycelium.
Inherits from graphlib.
The following snippet shows how to create a simple network:
const [a, b, c, d, m, n] = ['a', 'b', 'c', 'd', 'm', 'n'] as Array<NodeId>;const network = new Network();network.setNode(n, new ui.Node(n));network.setNodeWithParent(m, new ui.Node(m), n);network.setNode(a, new ui.Node(a));network.setNodeWithParent(b, new ui.Node(b), m);network.setNodeWithParent(c, new ui.Node(c), m);network.setNodeWithParent(d, new ui.Node(d), n);network.setEdge(a, b);network.setEdge(a, c);network.setEdge(b, d);network.setEdge(c, d); Copy
const [a, b, c, d, m, n] = ['a', 'b', 'c', 'd', 'm', 'n'] as Array<NodeId>;const network = new Network();network.setNode(n, new ui.Node(n));network.setNodeWithParent(m, new ui.Node(m), n);network.setNode(a, new ui.Node(a));network.setNodeWithParent(b, new ui.Node(b), m);network.setNodeWithParent(c, new ui.Node(c), m);network.setNodeWithParent(d, new ui.Node(d), n);network.setEdge(a, b);network.setEdge(a, c);network.setEdge(b, d);network.setEdge(c, d);
The information that is shown for each node can be specified in the constructor of ui.Node.
Optional
The types for graphlib seem to be wrong so we provide our own children method with correct types.
graphlib
children
Static
Represents a network to be visualized by Mycelium.
Inherits from graphlib.
Example
The following snippet shows how to create a simple network:
The information that is shown for each node can be specified in the constructor of ui.Node.