Class Index | File Index

Classes


Class de.aitools.js.Graph

Implementation of a graph data structure
Defined in: Graph.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A graph consists of vertices and edges.
Method Summary
Method Attributes Method Name and Description
 
Method for adding nodes to the graph.
 
Method to clone the graph.
 
compute(graphProcedure)
Generic method for graph procedures (like normalization).
 
containsEdge(fromNodeId, toNodeId)
Method to check whether or not an edge exists between two nodes.
 
containsNode(nodeId)
Method to check whether or not the graph contains a certain node id.
 
Method to get all node ids adjacent to the given node id.
 
Method to count the number of edges within the graph.
 
getEdgeWeight(fromNodeId, toNodeId)
Method to get the weight of an edge of two nodes.
 
getMass(nodeIds)
Method to calculate the mass of a graph or certain given nodes: If nodeId is not given as an argument, the mass of the whole graph is calculated.
 
Method to count the number of nodes within the graph.
 
Method to get all node ids contained within the graph.
 
removeEdge(fromNodeId, toNodeId)
Method to remove a certain edge from the graph.
 
removeNode(nodeId)
Method to remove a certain node id from the graph.
 
setEdge(fromNodeId, toNodeId, weight)
Method to set an edge between to given nodes.
Class Detail
de.aitools.js.Graph()
A graph consists of vertices and edges. Nodes represent single document ids and edges contain the respective similarity.
Author: Christian Fricke [email protected].
Method Detail
{Number} addNode()
Method for adding nodes to the graph. arguments[0] is fetched in order for clone() to work. This feature is not supposed to be used elsewhere. Note: uId_ will always be set to last (highest) node id.
Returns:
{Number} Id of a the added node

{de.aitools.js.Graph} clone()
Method to clone the graph. It is not yet fully implemented - the adjMap_ is not copied in the process.
Returns:
{de.aitools.js.Graph} A cloned graph

{Object} compute(graphProcedure)
Generic method for graph procedures (like normalization).
Parameters:
graphProcedure
Returns:
{Object} Depends on the generic method.

{Boolean} containsEdge(fromNodeId, toNodeId)
Method to check whether or not an edge exists between two nodes.
Parameters:
{Number} fromNodeId
A unique node id
{Number} toNodeId
Another unique node id
Returns:
{Boolean} True or false

{Boolean} containsNode(nodeId)
Method to check whether or not the graph contains a certain node id.
Parameters:
{Number} nodeId
The node id to be checked
Returns:
{Boolean} True or false

{Array} getAdjacentNodes(nodeId)
Method to get all node ids adjacent to the given node id.
Parameters:
{Number} nodeId
The node id to be used
Returns:
{Array} An array of all adjacent node ids

{Number} getEdgeCount()
Method to count the number of edges within the graph.
Returns:
{Number} The amount of edges within the graph

{Number} getEdgeWeight(fromNodeId, toNodeId)
Method to get the weight of an edge of two nodes.
Parameters:
{Number} fromNodeId
A unique node id
{Number} toNodeId
Another unique node id
Returns:
{Number} The edge weight

{Number} getMass(nodeIds)
Method to calculate the mass of a graph or certain given nodes: If nodeId is not given as an argument, the mass of the whole graph is calculated. Otherwise getMass(nodeIds) calculates the mass of a given set of nodes contained within the graph.
Parameters:
{Array} nodeIds
An array of node ids
Returns:
{Number} The mass of the entire graph or certain nodes

{Number} getNodeCount()
Method to count the number of nodes within the graph.
Returns:
{Number} The amount of nodes within the graph

{Array} getNodes()
Method to get all node ids contained within the graph.
Returns:
{Array} An array of all node ids contained within the graph

removeEdge(fromNodeId, toNodeId)
Method to remove a certain edge from the graph.
Parameters:
{Number} fromNodeId
A unique node id
{Number} toNodeId
Another unique node id

removeNode(nodeId)
Method to remove a certain node id from the graph.
Parameters:
{Number} nodeId
The node id to be removed

setEdge(fromNodeId, toNodeId, weight)
Method to set an edge between to given nodes.
Parameters:
{Number} fromNodeId
A unique node id
{Number} toNodeId
Another unique node id
{Number} weight
The edge weight to be set

Documentation generated by JsDoc Toolkit 2.4.0 on Wed May 30 2012 16:21:04 GMT+0200 (CEST)