Graph.Op.js

Defines an abstract class for performing Graph Operations.

Summary
Graph.Op.jsDefines an abstract class for performing Graph Operations.
Graph.OpGeneric Graph Operations.
Functions
removeNodeRemoves one or more Graph.Nodes from the visualization.
removeEdgeRemoves one or more edges from the visualization.
sumAdds a new graph to the visualization.
morphThis method will morph the current visualized graph into the new json representation passed in the method.

Graph.Op

Generic Graph Operations.

Description

An abstract class holding unary and binary powerful graph operations such as removingNodes, removingEdges, adding two graphs and morphing.

Implemented by

Hypertree.Op, RGraph.Op and ST.Op.

Access

The subclasses for this abstract class can be accessed by using the op property of the Hypertree, RGraph or ST instances created.

See also

Hypertree.Op, RGraph.Op, ST.Op, Hypertree, RGraph, ST, Graph.

Summary
Functions
removeNodeRemoves one or more Graph.Nodes from the visualization.
removeEdgeRemoves one or more edges from the visualization.
sumAdds a new graph to the visualization.
morphThis method will morph the current visualized graph into the new json representation passed in the method.

Functions

removeNode

removeNode: function(node,
opt)

Removes one or more Graph.Nodes from the visualization.  It can also perform several animations like fading sequentially, fading concurrently, iterating or replotting.

Parameters

nodeThe node’s id.  Can also be an array having many ids.
optAnimation options.  It’s an object with optional properties
  • type Type of the animation.  Can be “nothing”, “replot”, “fade:seq”, “fade:con” or “iter”.  Default’s “nothing”.
  • duration Duration of the animation in milliseconds.  Default’s 2000.
  • fps Frames per second for the animation.  Default’s 30.
  • hideLabels Hide labels during the animation.  Default’s true.
  • transition Transitions defined in the Animation class.  Default’s the default transition option of the RGraph, Hypertree or ST instance created.

Example

var rg = new RGraph(canvas, config); //could be new ST or new Hypertree also.
rg.op.removeNode('nodeid', {
  type: 'fade:seq',
  duration: 1000,
  hideLabels: false,
  transition: Trans.Quart.easeOut
});
//or also
rg.op.removeNode(['someid', 'otherid'], {
  type: 'fade:con',
  duration: 1500
});

removeEdge

removeEdge: function(vertex,
opt)

Removes one or more edges from the visualization.  It can also perform several animations like fading sequentially, fading concurrently, iterating or replotting.

Parameters

vertexAn array having two strings which are the ids of the nodes connected by this edge (i.e [‘id1’, ‘id2’]).  Can also be a two dimensional array holding many edges (i.e [[‘id1’, ‘id2’], [‘id3’, ‘id4’], ...]).
optAnimation options.  It’s an object with optional properties
  • type Type of the animation.  Can be “nothing”, “replot”, “fade:seq”, “fade:con” or “iter”.  Default’s “nothing”.
  • duration Duration of the animation in milliseconds.  Default’s 2000.
  • fps Frames per second for the animation.  Default’s 30.
  • hideLabels Hide labels during the animation.  Default’s true.
  • transition Transitions defined in the Animation class.  Default’s the default transition option of the RGraph, Hypertree or ST instance created.

Example

var rg = new RGraph(canvas, config); //could be new ST or new Hypertree also.
rg.op.removeEdge(['nodeid', 'otherid'], {
  type: 'fade:seq',
  duration: 1000,
  hideLabels: false,
  transition: Trans.Quart.easeOut
});
//or also
rg.op.removeEdge([['someid', 'otherid'], ['id3', 'id4']], {
  type: 'fade:con',
  duration: 1500
});

sum

sum: function(json,
opt)

Adds a new graph to the visualization.

The json graph (or tree) must at least have a common node with the current graph plotted by the visualization.

The resulting graph can be defined as follows http://mathworld.wolfram.com/GraphSum.html

Parameters

jsonA json tree or graph structure.  See also Loader.loadJSON.
optAnimation options.  It’s an object with optional properties
  • type Type of the animation.  Can be “nothing”, “replot”, “fade:seq” or “fade:con”.  Default’s “nothing”.
  • duration Duration of the animation in milliseconds.  Default’s 2000.
  • fps Frames per second for the animation.  Default’s 30.
  • hideLabels Hide labels during the animation.  Default’s true.
  • transition Transitions defined in the Animation class.  Default’s the default transition option of the RGraph, Hypertree or ST instance created.

Example

//json contains a tree or graph structure.

var rg = new RGraph(canvas, config); //could be new ST or new Hypertree also.
rg.op.sum(json, {
  type: 'fade:seq',
  duration: 1000,
  hideLabels: false,
  transition: Trans.Quart.easeOut
});
//or also
rg.op.sum(json, {
  type: 'fade:con',
  duration: 1500
});

morph

morph: function(json,
opt)

This method will morph the current visualized graph into the new json representation passed in the method.

Can also perform multiple animations.  The json object must at least have the root node in common with the current visualized graph.

Parameters

jsonA json tree or graph structure.  See also Loader.loadJSON.
optAnimation options.  It’s an object with optional properties
  • type Type of the animation.  Can be “nothing”, “replot”, or “fade”.  Default’s “nothing”.
  • duration Duration of the animation in milliseconds.  Default’s 2000.
  • fps Frames per second for the animation.  Default’s 30.
  • hideLabels Hide labels during the animation.  Default’s true.
  • transition Transitions defined in the Animation class.  Default’s the default transition option of the RGraph, Hypertree or ST instance created.

Example

//json contains a tree or graph structure.

var rg = new RGraph(canvas, config); //could be new ST or new Hypertree also.
rg.op.morph(json, {
  type: 'fade',
  duration: 1000,
  hideLabels: false,
  transition: Trans.Quart.easeOut
});
//or also
rg.op.morph(json, {
  type: 'fade',
  duration: 1500
});
A generic Graph class.
removeNode: function(node,
opt)
Removes one or more Graph.Nodes from the visualization.
A Graph node.
removeEdge: function(vertex,
opt)
Removes one or more edges from the visualization.
sum: function(json,
opt)
Adds a new graph to the visualization.
morph: function(json,
opt)
This method will morph the current visualized graph into the new json representation passed in the method.
Performs advanced operations on trees and graphs.
Performs advanced operations on trees and graphs.
Performs advanced operations on trees and graphs.
The main Hypertree class
The main RGraph class
The main ST class
A Class that can perform animations for generic objects.
loadJSON: function(json,
i)
Loads a JSON structure to the visualization.
Close