Adds a new link to the graph. If link already exists and the graph is not a multigraph, then link's data is overwritten with a new data.
When graph is a multigraph, then a new link is always added between the nodes.
Adds a new node to the graph. If node with such id already exists its data is overwritten with the new data
Suspend all notifications about graph changes until endUpdate is called.
Removes all nodes and links from the graph.
Resumes all notifications about graph changes and fires graph 'changed' event in case there are any pending changes.
Iterates over every single link in the graph, passing the link to a callback. If callback function returns "true"-like value, enumeration stops.
Iterates over other node connected to the nodeId. If oriented is set to true,
the callback will receive nodes on the link.toId end. Otherwise callback will
receive nodes on either .fromId or .toId, depending on the nodeId argument.
Iterates over every single node in the graph, passing the node to a callback.
If callback function returns "true"-like value, enumeration stops.
Synonym of getLinkCount()
Returns a link between two nodes
Returns a link by its id
Returns number of links (edges) in the graph
Returns all links associated with this node
Returns number of links (edges) in the graph
Returns a node by its identifier. Undefined value is returned if node with such identifer does not exist.
Returns number of nodes in the graph
Returns number of nodes in the graph
Checks if link is present in the graph
Checks whether given node exists in the graph. Return the node or undefined if no such node exist.
Removes a link from the graph. You'll need to pass an actual link instance to remove it. If you pass two arguments, the function assumes they represent from/to node ids, and removes the corresponding link.
Returns true if link is found and removed. False otherwise.
Removes node by node id. Returns true if node was removed, false otherwise (e.g. no such node exists in the graph)
Internal version of the library surfaced for duck-typing hints.
A graph data structure