Class: GraphicalModel

GraphicalModel

The regular probability Graphical that supports auto play loops and zoom in capability.

Constructor

new GraphicalModel(graphConfiguration, divID)

Create a defiend space for the graphical model.
Parameters:
Name Type Description
graphConfiguration object A configuration object for configuring the properties of this _pgm, it can be obtained via Config.getPGMConfig().
divID string The id of the html tag that contains this pgm, it is of the form '#id_name'.
Source:

Members

(static) this.config :object

This graph's configuration.
Type:
  • object
Source:

(static) this.config :object

This graph's configuration.
Type:
  • object
Source:

(static) this.graphData :object

Graph data includes labels, vertex and edge data.
Type:
  • object
Properties:
Name Type Description
clusterMat object A matrix of vertex labels in every layer.
data object An arry of vertex data where each vertex specifies its adjacency edges.
Source:

(static) this.graphData :object

Graph data includes labels, vertex and edge data.
Type:
  • object
Properties:
Name Type Description
clusterMat object A matrix of vertex labels in every layer.
data object An arry of vertex data where each vertex specifies its adjacency edges.
Source:

Methods

createAdjacencyMatrix(chartConfig) → {object}

Used create a weighted adjacency matrix for this graph based on the matrix config object.
Parameters:
Name Type Description
chartConfig object The matrix configuration object. It can be obtained via Config.getAdjacencyMatrixConfig().
Source:
Returns:
This graphicalModel object.
Type
object

createAdjacencyMatrix(chartConfig) → {object}

Used create a weighted adjacency matrix for this graph based on the matrix config object.
Parameters:
Name Type Description
chartConfig object The matrix configuration object. It can be obtained via Config.getAdjacencyMatrixConfig().
Source:
Returns:
This graphicalModel object.
Type
object

createCluster(cMat, probabilityDistribution, changeNodeRadiusBasedOnDistribution) → {object}

Used to create an array of vertix data in graphData based on the label cluster matrix (cMat). The graph edge weights are set to be uniform by defaut.
Parameters:
Name Type Description
cMat array The label cluster matrix holds the labels. Ex of cluster mat [layer1_label_array, layer2_label_array, layer3_label_array] where each layer_label_array holds an array of labelrs in one layer.
probabilityDistribution array The array of probability given to each node in the speaker layer to be triggered. For uniform distribution, set probabilityDistribution = [].
changeNodeRadiusBasedOnDistribution boolean Governs whether vertex radius are affected by its distribution.
Source:
Returns:
This graphicalModel object.
Type
object
Example
graphicalModel.createCluster(clusterMat, speakerNodeProbabilityDistribution, true);

createCluster(cMat, probabilityDistribution, changeNodeRadiusBasedOnDistribution) → {object}

Used to create an array of vertix data in graphData based on the label cluster matrix (cMat). The graph edge weights are set to be uniform by defaut.
Parameters:
Name Type Description
cMat array The label cluster matrix holds the labels. Ex of cluster mat [layer1_label_array, layer2_label_array, layer3_label_array] where each layer_label_array holds an array of labelrs in one layer.
probabilityDistribution array The array of probability given to each node in the speaker layer to be triggered. For uniform distribution, set probabilityDistribution = [].
changeNodeRadiusBasedOnDistribution boolean Governs whether vertex radius are affected by its distribution.
Source:
Returns:
This graphicalModel object.
Type
object
Example
graphicalModel.createCluster(clusterMat, speakerNodeProbabilityDistribution, true);

getVertexId(vertexCoordinate) → {number}

Get the vertex id by vertexCoordinate.
Parameters:
Name Type Description
vertexCoordinate array A coordiante pair, e.g [layer index, vertex index at that layer]
Source:
Returns:
id_temp - The id of the vertex in the data array of the graphData.
Type
number

getVertexId(vertexCoordinate) → {number}

Get the vertex id by vertexCoordinate.
Parameters:
Name Type Description
vertexCoordinate array A coordiante pair, e.g [layer index, vertex index at that layer]
Source:
Returns:
id_temp - The id of the vertex in the data array of the graphData.
Type
number

getWeightedAdjacencyMatrix() → {object}

Used to get the weighted adjacency matrix object attached to this graph.
Source:
Returns:
The weighted adjacency matrix object.
Type
object

getWeightedAdjacencyMatrix() → {object}

Used to get the weighted adjacency matrix object attached to this graph.
Source:
Returns:
The weighted adjacency matrix object.
Type
object

init() → {object}

Used to create and display the graph. Normally called after createCluster().
Source:
Returns:
this graphicalModel object.
Type
object
Example
graphicalModel.init();

init() → {object}

Used to create and display the graph. Normally called after createCluster().
Source:
Returns:
this graphicalModel object.
Type
object
Example
graphicalModel.init();

redraw() → {object}

Use this to redraw the graph after reset edge weights.
Source:
Returns:
This graphicalModel object.
Type
object

redraw() → {object}

Use this to redraw the graph after reset edge weights.
Source:
Returns:
This graphicalModel object.
Type
object

resetChart()

Reset the weighted adjacency matrix weights.
Source:

resetChart()

Reset the weighted adjacency matrix weights.
Source:

setEdgeWeights(id, edges) → {object}

Set the adjacency edges for a vertex by id.
Parameters:
Name Type Description
id number The id or the index of the vertex in the data array of the graphData.
edges object The object contains the adjacency edges of a vertex and their weights. return this pgm to allow setEdgeWeights to be stacked.
Source:
Returns:
This grpahicalModel object.
Type
object
Example
// Create three directed edges 0->3, 0->4, 0->5 with edge weiths 0.8, 0.1 and 0.1
graphicalModel.setEdgeWeights(0, [{
            id: 3,
            weight: 0.8
        }, {
            id: 4,
            weight: 0.1
        }, {
            id: 5,
            weight: 0.1
        }]);

setEdgeWeights(id, edges) → {object}

Set the adjacency edges for a vertex by id.
Parameters:
Name Type Description
id number The id or the index of the vertex in the data array of the graphData.
edges object The object contains the adjacency edges of a vertex and their weights. return this pgm to allow setEdgeWeights to be stacked.
Source:
Returns:
This grpahicalModel object.
Type
object
Example
// Create three directed edges 0->3, 0->4, 0->5 with edge weiths 0.8, 0.1 and 0.1
graphicalModel.setEdgeWeights(0, [{
            id: 3,
            weight: 0.8
        }, {
            id: 4,
            weight: 0.1
        }, {
            id: 5,
            weight: 0.1
        }]);

setUniformEdgeWeights()

Set the graph edge weights to be uniform.
Source:

setUniformEdgeWeights()

Set the graph edge weights to be uniform.
Source:

GraphicalModel

The regular probability Graphical that supports auto play loops and zoom in capability.

Constructor

new GraphicalModel(graphConfiguration, divID)

Create a defiend space for the graphical model.
Parameters:
Name Type Description
graphConfiguration object A configuration object for configuring the properties of this _pgm, it can be obtained via Config.getPGMConfig().
divID string The id of the html tag that contains this pgm, it is of the form '#id_name'.
Source:

Members

(static) this.config :object

This graph's configuration.
Type:
  • object
Source:

(static) this.config :object

This graph's configuration.
Type:
  • object
Source:

(static) this.graphData :object

Graph data includes labels, vertex and edge data.
Type:
  • object
Properties:
Name Type Description
clusterMat object A matrix of vertex labels in every layer.
data object An arry of vertex data where each vertex specifies its adjacency edges.
Source:

(static) this.graphData :object

Graph data includes labels, vertex and edge data.
Type:
  • object
Properties:
Name Type Description
clusterMat object A matrix of vertex labels in every layer.
data object An arry of vertex data where each vertex specifies its adjacency edges.
Source:

Methods

createAdjacencyMatrix(chartConfig) → {object}

Used create a weighted adjacency matrix for this graph based on the matrix config object.
Parameters:
Name Type Description
chartConfig object The matrix configuration object. It can be obtained via Config.getAdjacencyMatrixConfig().
Source:
Returns:
This graphicalModel object.
Type
object

createAdjacencyMatrix(chartConfig) → {object}

Used create a weighted adjacency matrix for this graph based on the matrix config object.
Parameters:
Name Type Description
chartConfig object The matrix configuration object. It can be obtained via Config.getAdjacencyMatrixConfig().
Source:
Returns:
This graphicalModel object.
Type
object

createCluster(cMat, probabilityDistribution, changeNodeRadiusBasedOnDistribution) → {object}

Used to create an array of vertix data in graphData based on the label cluster matrix (cMat). The graph edge weights are set to be uniform by defaut.
Parameters:
Name Type Description
cMat array The label cluster matrix holds the labels. Ex of cluster mat [layer1_label_array, layer2_label_array, layer3_label_array] where each layer_label_array holds an array of labelrs in one layer.
probabilityDistribution array The array of probability given to each node in the speaker layer to be triggered. For uniform distribution, set probabilityDistribution = [].
changeNodeRadiusBasedOnDistribution boolean Governs whether vertex radius are affected by its distribution.
Source:
Returns:
This graphicalModel object.
Type
object
Example
graphicalModel.createCluster(clusterMat, speakerNodeProbabilityDistribution, true);

createCluster(cMat, probabilityDistribution, changeNodeRadiusBasedOnDistribution) → {object}

Used to create an array of vertix data in graphData based on the label cluster matrix (cMat). The graph edge weights are set to be uniform by defaut.
Parameters:
Name Type Description
cMat array The label cluster matrix holds the labels. Ex of cluster mat [layer1_label_array, layer2_label_array, layer3_label_array] where each layer_label_array holds an array of labelrs in one layer.
probabilityDistribution array The array of probability given to each node in the speaker layer to be triggered. For uniform distribution, set probabilityDistribution = [].
changeNodeRadiusBasedOnDistribution boolean Governs whether vertex radius are affected by its distribution.
Source:
Returns:
This graphicalModel object.
Type
object
Example
graphicalModel.createCluster(clusterMat, speakerNodeProbabilityDistribution, true);

getVertexId(vertexCoordinate) → {number}

Get the vertex id by vertexCoordinate.
Parameters:
Name Type Description
vertexCoordinate array A coordiante pair, e.g [layer index, vertex index at that layer]
Source:
Returns:
id_temp - The id of the vertex in the data array of the graphData.
Type
number

getVertexId(vertexCoordinate) → {number}

Get the vertex id by vertexCoordinate.
Parameters:
Name Type Description
vertexCoordinate array A coordiante pair, e.g [layer index, vertex index at that layer]
Source:
Returns:
id_temp - The id of the vertex in the data array of the graphData.
Type
number

getWeightedAdjacencyMatrix() → {object}

Used to get the weighted adjacency matrix object attached to this graph.
Source:
Returns:
The weighted adjacency matrix object.
Type
object

getWeightedAdjacencyMatrix() → {object}

Used to get the weighted adjacency matrix object attached to this graph.
Source:
Returns:
The weighted adjacency matrix object.
Type
object

init() → {object}

Used to create and display the graph. Normally called after createCluster().
Source:
Returns:
this graphicalModel object.
Type
object
Example
graphicalModel.init();

init() → {object}

Used to create and display the graph. Normally called after createCluster().
Source:
Returns:
this graphicalModel object.
Type
object
Example
graphicalModel.init();

redraw() → {object}

Use this to redraw the graph after reset edge weights.
Source:
Returns:
This graphicalModel object.
Type
object

redraw() → {object}

Use this to redraw the graph after reset edge weights.
Source:
Returns:
This graphicalModel object.
Type
object

resetChart()

Reset the weighted adjacency matrix weights.
Source:

resetChart()

Reset the weighted adjacency matrix weights.
Source:

setEdgeWeights(id, edges) → {object}

Set the adjacency edges for a vertex by id.
Parameters:
Name Type Description
id number The id or the index of the vertex in the data array of the graphData.
edges object The object contains the adjacency edges of a vertex and their weights. return this pgm to allow setEdgeWeights to be stacked.
Source:
Returns:
This grpahicalModel object.
Type
object
Example
// Create three directed edges 0->3, 0->4, 0->5 with edge weiths 0.8, 0.1 and 0.1
graphicalModel.setEdgeWeights(0, [{
            id: 3,
            weight: 0.8
        }, {
            id: 4,
            weight: 0.1
        }, {
            id: 5,
            weight: 0.1
        }]);

setEdgeWeights(id, edges) → {object}

Set the adjacency edges for a vertex by id.
Parameters:
Name Type Description
id number The id or the index of the vertex in the data array of the graphData.
edges object The object contains the adjacency edges of a vertex and their weights. return this pgm to allow setEdgeWeights to be stacked.
Source:
Returns:
This grpahicalModel object.
Type
object
Example
// Create three directed edges 0->3, 0->4, 0->5 with edge weiths 0.8, 0.1 and 0.1
graphicalModel.setEdgeWeights(0, [{
            id: 3,
            weight: 0.8
        }, {
            id: 4,
            weight: 0.1
        }, {
            id: 5,
            weight: 0.1
        }]);

setUniformEdgeWeights()

Set the graph edge weights to be uniform.
Source:

setUniformEdgeWeights()

Set the graph edge weights to be uniform.
Source: