Class Network

Represents a network to be visualized by Mycelium.

Inherits from graphlib.

Example

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);

The information that is shown for each node can be specified in the constructor of ui.Node.

Hierarchy

Constructors

Methods

  • Parameters

    • parentName: string

    Returns undefined | string

  • Parameters

    • edgeObj: Edge

    Returns GraphEdge

  • Parameters

    • outNodeName: string
    • inNodeName: string
    • Optional name: string

    Returns GraphEdge

  • Returns number

  • Parameters

    • callback: ((nodeId) => boolean)
        • (nodeId): boolean
        • Parameters

          • nodeId: string

          Returns boolean

    Returns Graph<Node>

  • Returns GraphLabel

  • Parameters

    • edgeObj: Edge

    Returns boolean

  • Parameters

    • outNodeName: string
    • inNodeName: string
    • Optional name: string

    Returns boolean

  • Parameters

    • name: string

    Returns boolean

  • Parameters

    • inNodeName: string
    • Optional outNodeName: string

    Returns undefined | Edge[]

  • Returns boolean

  • Returns boolean

  • Parameters

    • name: string

    Returns undefined | Node<Node>[]

  • Parameters

    • id: string | Label

    Returns Node<Node>

  • Returns number

  • Parameters

    • outNodeName: string
    • Optional inNodeName: string

    Returns undefined | Edge[]

  • Parameters

    • name: string

    Returns undefined | Node<Node>[]

  • Parameters

    • outNodeName: string
    • inNodeName: string
    • Optional name: string

    Returns Graph<Node>

  • Parameters

    • name: string

    Returns Graph<Node>

  • Parameters

    • callback: string | ((v, w, name?) => string | Label)

    Returns Graph<Node>

  • Parameters

    • callback: string | ((nodeId) => string | Label)

    Returns Graph<Node>

  • Parameters

    • params: Edge
    • Optional value: string | {
          [key: string]: any;
      }

    Returns Graph<Node>

  • Parameters

    • sourceId: string
    • targetId: string
    • Optional value: string | Label
    • Optional name: string

    Returns Graph<Node>

  • Parameters

    • label: GraphLabel

    Returns Graph<Node>

  • Parameters

    • name: string
    • label: string | Label

    Returns Graph<Node>

  • Parameters

    • childName: string
    • parentName: string

    Returns void

  • Returns Node<Node>[]

  • Returns Node<Node>[]

  • Parameters

    • name: string

    Returns undefined | Node<Node>[]