Constructor
new ListenerPGM(graphConfiguration, divID)
Create a defiend space for the listener 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:
Extends
Methods
bindToListenerBeliefPGM()
Binds the listener and the listener's belief to each other and set listener's weight.
- Source:
bindToListenerBeliefPGM()
Binds the listener and the listener's belief to each other and set listener's weight.
- Source:
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(). |
- Overrides:
- 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. |
- Overrides:
- 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] |
- Overrides:
- 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.
- Overrides:
- Source:
Returns:
The weighted adjacency matrix object.
- Type
- object
init() → {object}
Used to create and display the graph. Normally called after createCluster().
- Overrides:
- Source:
Returns:
this graphicalModel object.
- Type
- object
Example
graphicalModel.init();
redraw() → {object}
Use this to redraw the graph after reset edge weights.
- Overrides:
- Source:
Returns:
This graphicalModel object.
- Type
- object
resetChart()
Reset the weighted adjacency matrix weights.
- Overrides:
- Source:
resetEdgeWeightsToBeListenerBeliefPGMEdgeWeights()
Reset the listenerPGM's edge weights to be listener's belief edge weights.
- Source:
resetEdgeWeightsToBeListenerBeliefPGMEdgeWeights()
Reset the listenerPGM's edge weights to be listener's belief edge 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. |
- Overrides:
- 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.
- Overrides:
- Source:
updateWeight(weight)
Used to update the listenerPGM's edge weights.
Parameters:
Name | Type | Description |
---|---|---|
weight |
array | The new weights as an 1D array. |
- Source:
updateWeight(weight)
Used to update the listenerPGM's edge weights.
Parameters:
Name | Type | Description |
---|---|---|
weight |
array | The new weights as an 1D array. |
- Source: