SNIK Graph - v25.01
    Preparing search index...

    Class Graph

    Cytoscape.js Graph Class with path operations and styling.

    Index

    Constructors

    • Creates a new cytoscape graph, assigns it to the #cy container and sets up basic event listeners.

      Parameters

      • container: HTMLElement

        parent element

      Returns Graph

    Properties

    container: HTMLElement
    cy: Core
    instancesLoaded: boolean = false
    matchComponents: Collection<SingularElementReturnValue, SingularElementArgument>[] = []
    pathSource: NodeSingular = null
    selectedNode: NodeSingular = null
    starMode: boolean = false

    Methods

    • Inverts the screen colors in the canvas for day mode. Uses an inverted node js style file to keep node colors.

      Parameters

      • dayScheme: boolean

        whether the canvas colors should be inverted.

      • coloredEdges: boolean

        Give every edge-type a certain color.

      • showProperty: boolean

        Show the property as edge label even on all edges, else only show edge labels on unselected edges.

      Returns void

    • Get the equivalent elements in this graph of the given elements from another graph.

      Parameters

      • eles: Collection

        elements from another graph

      Returns Collection

      equivalent elements that exist in this graph

    • Get the equivalent nodes in this graph of the given nodes from another graph.

      Parameters

      • nodes: NodeCollection

        nodes from another graph

      Returns NodeCollection

      equivalent nodes that exist in this graph

    • Sets whether close matches are grouped in compound nodes.

      Parameters

      • enabled: boolean

        Whether to activate or deactivate combine match mode. *

      Returns Promise<void>

    • Returns, whether cumulative search is activated.

      Returns boolean

      whether cumulative search is activated.

    • Get a collection of nodes/edges using a list of their IDs. If not existent in this graph, then all others are scanned. If found, the node or edge is added to the current view and returned.

      Parameters

      • ids: Iterable<string>

        iterable of cytoscape ids

      Returns Collection

      cytoscape collection of elements with those ids

    • Get a collection of nodes/edges using a list of their IDs. Works only in this graph.

      Parameters

      • ids: Iterable<string>

        iterable of cytoscape ids

      Returns Collection

      cytoscape collection of elements with those ids

    • Returns the start node for all path operations

      Returns NodeSingular

      the start node for all path operations, or null if none exists.

    • Move all matching nodes together.

      Parameters

      • distance: number

        the distance between them

      Returns void

    • position in a circle around the first node

      Parameters

      • nodes: NodeCollection

        the nodes to position

      • distance: number

        the radius of the circle

      Returns void

    • Multiplex takes a function that takes exactly one parameter in the form of a a single cytoscape Node, such as a star. It returns a function that executes the given function one or more times with different input based on the following criteria: If the nodes parameter is given, then multiplex uses it as input. For example multiplexing a star on a collection of nodes will execute that star for each node in the collection. If the nodes parameter is not given, but more than one node is selected, then multiplex uses the nodes selected in this graph as input. If the direct parameter is truthy then f will be called exactly once directly passing in the input as single parameter instead of looping over it. If the nodes parameter is not given and the set of selected nodes has size 0 or 1, then the given function is executed with the original input. Whatever happens, the singular input parameter of the returned function is always included as well. TODO: This function is hard to maintain, simplify if possible.

      Parameters

      • f: any

        a function that accepts a single node

      • Optionalnodes: NodeCollection

        The nodes, each of which will be passed as parameter to a separate call of the given function. Can be null or undefined,

      • Optionaldirect: boolean

        whether the input is a cytoscape collection that can be passed directly into the function without looping, which can be much faster if possible.

      Returns (ele?: NodeSingular) => void

      the function described above.

    • Create and return a new graph if the option is set to create star operations in a new view.

      Parameters

      • alwaysNew: boolean = false

      Returns Promise<Graph>

      this iff the option to create stars in a new view is unset, a new view's graph if it is set

    • Center and highlight the given URI.

      Parameters

      • uri: string

        The URI of a class in the graph.

      Returns boolean

      whether presenting the URI succeeded

    • Center and highlight the given URIs.

      Parameters

      • uris: string[]

        the URIs to present

      • hideOthers: boolean = false

        whether to hide the other nodes

      Returns boolean

      whether presenting the URIs succeeded

    • Removes all highlighting (except selection) and shows all hidden nodes.

      Returns void

    • Set the given node as source for all path operations.

      Parameters

      • node: NodeSingular

        the new source

      Returns boolean

      whether node is not null

    • Show close matches of the given nodes.

      Parameters

      • nodes: NodeCollection

        the nodes whose close matches are shown

      Returns void

    • Highlight the given two nodes, directly connected nodes (in both directions) of both of them and a shortest path between the two. Hide all other nodes except when in star mode.

      Parameters

      • to: NodeSingular

        path target node

      Returns boolean

      whether a path could be found

    • Show all nodes and edges on a shortest path between "from " and "to". Hide all other nodes except when in star mode.

      Parameters

      • to: NodeSingular

        path target node

      • OptionalstarPath: boolean

        whether to show the star around all nodes on the path

      Returns (from: NodeSingular) => boolean

      a function that given a source node shows that path if possible and returns whether a path could be found

    • Highlight the give node and all its directly connected nodes (in both directions). Hide all other nodes except when in star mode.

      Parameters

      • center: NodeCollection

        node or collection of nodes. center of the star

      • changeLayout: boolean = false

        arrange the given node and it's close matches in the center and the connected nodes in a circle around them.

      • Optionaldirection: Direction

        only show edges that originate from node, not those that end in it. Optional and defaults to false.

      Returns void

    • Multiplex star operations.

      Parameters

      • changeLayout: boolean = false

        arrange the given node and its close matches in the center and the connected nodes in a circle around them.

      • Optionaldirection: Direction

        show edges that originate from node, not those that end in it. Optional and defaults to false.

      Returns (_nodes: NodeCollection) => void

      show star function applied to multiple nodes

    • Multiplex star operations into a new view.

      Parameters

      • changeLayout: boolean = false

        arrange the given node and its close matches in the center and the connected nodes in a circle around them.

      • direction: Direction = Direction.BOTH

        only show edges that originate from node, not those that end in it. Optional and defaults to false.

      • alwaysNew: boolean = false

      Returns Promise<(_node: NodeSingular) => Graph>

      show star function applied to multiple nodes

    • Show a "spider worm" between two nodes, which combines a star around "to" with a shortest path from "from" to "to". Hide all other nodes except when in star mode.

      Parameters

      • from: NodeSingular

        path source node

      • to: NodeSingular

        path target node, gets a "star" around it as well

      Returns boolean

      whether a path could be found

    • Show (unhide) the given elements or hide them using visibility: hidden. Do not use this for filters as they use other classes to interact properly with shown and hidden elements. Does not unhide filtered elements on its own.

      Parameters

      • eles:
            | NodeSingular
            | NodeCollection
            | EdgeCollection
            | Collection<SingularElementReturnValue, SingularElementArgument>

        the elements to hide

      • visible: boolean = true

        Whether to show or hide the nodes. Defaults to the sometimes implied value of true.

      Returns void

    • Parameters

      • eles: Collection

        the elements to assign the star mode css class to

      Returns void