SPeCS Packages Documentation
    Preparing search index...

    The class with functionality for the base graph type.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Accessors

    Methods

    • Checks if the graph has a function with the given name.

      The function must be in the map, the respective node must exist, and the node must be a FunctionNode for this method to return true.

      Parameters

      • name: string

        The name of the function.

      Returns boolean

      true if the graph has a function with the given name, false otherwise.

    • Initializes the graph with the information of a builder. This is effectively extends the type of the graph to include the data and scratch data of the builder.

      The same graph may simultaneously be of multiple types, as long as the data and scratch data are compatible with the types. The builder methods may overwrite data and scratch data fields with names that collide with its type's fields.

      Type Parameters

      Parameters

      Returns BaseGraph.Class<D2, S2>

      The same graph, with the data and scratch data of the builder. The graph is downcasted to BaseGraph.Class because the builder may overwrite the data and scratch data fields, invalidating the current type.

    • Sets the id generator to be used when generating edge identifiers. This id generator is only used when creating an edge without specifying an id. In other words, if an id is explicitly provided when creating an edge, it will have precedence over calling the id generator.

      When no id generator is set and no id is provided when creating an edge, the id generation will be delegated to cytoscape.

      Parameters

      • generator: Edge.IdGenerator | undefined

        The id generator to use, or undefined to delegate to cytoscape's default id generation.

      Returns this

      itself for chaining.

    • Sets the id generator to be used when generating node identifiers. This id generator is only used when creating a node without specifying an id. In other words, if an id is explicitly provided when creating a node, it will have precedence over calling the id generator.

      When no id generator is set and no id is provided when creating a node, the id generation will be delegated to cytoscape.

      Parameters

      • generator: Node.IdGenerator | undefined

        The id generator to use, or undefined to delegate to cytoscape's default id generation.

      Returns this

      itself for chaining.

    • Tries to change the functionality class of the current graph. If the graph is not compatible with the new class, undefined is returned.

      Type Parameters

      Parameters

      • GraphType: Graph<D2, S2, G2>

        The graph type to change the functionality class into.

      Returns G2 | undefined

      The graph, wrapped in the new functionality class, or undefined if the graph is not compatible with the type.

      if (graph === undefined || !graph.is(FlowGraph)) {
      return undefined;
      }
      return node.as(FlowGraph);

      Can be simplified to:

      return node?.tryAs(FlowGraph);