Data Structures, Nodes, and Edges

Data Structure API

Node API

.value([newValue])

Returns the value stored in this node. If the optional newValue parameter is given, the value is set to the given value.

.addClass(className, [options])

Adds the CSS class className to the node and animates the changes.

.removeClass(className, [options])

Removes the CSS class className from the node and animates the changes.

.toggleClass(className, [options])

Toggles the CSS class className of the node and animates the changes.

.hasClass(className, [options])

Return true/false based on if the node has the CSS class className.

Edge API

All edges in the structures are based on a common Edge type. They all have the functions below. Note, that you do not create edges in your code, they are created by the structures they are used in.

.start([node])

Returns the start node of this edge. If the optional node parameter is given, sets the start node of this edge.

.end([node])

Returns the end node of this edge. If the optional node parameter is given, sets the end node of this edge.

.label()

Returns the label attached to this edge.

.label(newLabel)

Sets the value of the label attached to this edge.

.weight()

Returns the weight of this edge.

.weight(newWeight)

Sets the weight of this edge.

.show()

Shows this edge if it isn’t visible already.

.hide()

Hides this edge if it isn’t hidden already.

.isVisible()

Returns true if this edge is visible, false if hidden.