|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmapss.dif.DIFClusterManager
public class DIFClusterManager
A graph class specializing in maintaining cluster hierarchy. It is usually
instanciated to distinguished away from the original flattened graph.
Clustering is quite often a useful methodology in algorithm design because
of the reduced graph size and complexity. The characteristic of hierarchy is
similar to DIFHierarchy
. However, DIFHierarchy
aims
more at application design style than at clustering functionality.
Caution: Any derived cluster manager should consider overriding
_newEdgeWeight()
, _newNodeWeight()
, and
_clusterNodesComplete(DIFGraph, Collection, Node)
with appropriate
edge weight, node weight, and clustering strategy, respectively.
Constructor Summary | |
---|---|
DIFClusterManager(DIFGraph graph)
A constructor with the original graph. |
Method Summary | |
---|---|
protected java.util.List |
_clusterNodesComplete(DIFGraph graph,
java.util.Collection nodeCollection,
mocgraph.Node superNode)
Given a graph and a collection of nodes, replace the subgraph induced by the node collection with a single node N. |
protected java.util.Map |
_getEdgeMap()
Return the new/old edge map after/before a clustering step. |
protected boolean |
_isReachable(java.util.Collection nodeCollection1,
java.util.Collection nodeCollection2)
Test whether the second node collection is reachable from the first. |
protected boolean |
_isReachable(mocgraph.Node node1,
mocgraph.Node node2)
Test whether the second node is reachable from the first. |
protected DIFEdgeWeight |
_newEdgeWeight()
Return a valid edge weight for a newly created edge in clustering process. |
protected DIFNodeWeight |
_newNodeWeight()
Return a valid node weight for a newly created node in clustering process. |
protected mocgraph.Node |
_newSuperNode()
Return a new super node with weight type suitable for use in this graph. |
protected java.util.Collection |
_reachInNodes(java.util.Collection nodeCollection)
Get the nodes that reach to the given node collection. |
protected java.util.Collection |
_reachInNodes(mocgraph.Node node)
Get the nodes that reach to the given node. |
protected java.util.Collection |
_reachOutNodes(java.util.Collection nodeCollection)
Get the nodes that can be reached from the given node collection. |
protected java.util.Collection |
_reachOutNodes(mocgraph.Node node)
Get the nodes that can be reached from the given node. |
protected void |
_setSuperNode(mocgraph.Node superNode,
DIFGraph subgraph)
Set a node as super node with the associated graph. |
protected void |
_updateReachability(mocgraph.Node superNode,
java.util.Collection nodeCollection)
Update reachability for a given super node and the associated node collection. |
mocgraph.Node |
clusterNodes(java.util.Collection nodeCollection)
Cluster a collection of nodes and replace it with a super node. |
mocgraph.Node |
clusterNodes(DIFGraph graph,
java.util.Collection nodeCollection)
Cluster a collection of nodes in the given graph and replace it with a super node. |
DIFGraph |
getGraph()
Get the clustered graph. |
mocgraph.Edge |
getOriginalEdge(mocgraph.Edge newEdge)
Get the very original edge before any clustering. |
mocgraph.Node |
getRootNode()
Get the root node if the graph is clustered into a single node. |
DIFGraph |
getSubgraph(mocgraph.Node superNode)
Get the subgraph corresponding to the super node. |
boolean |
isSuperNode(mocgraph.Node node)
Test the given node super or not. |
boolean |
testAcyclicClustering(java.util.Collection nodeCollection)
Test whether the clustering of the node collection leads to acyclic topology. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DIFClusterManager(DIFGraph graph)
DIFGraph
.
Method Detail |
---|
public mocgraph.Node clusterNodes(DIFGraph graph, java.util.Collection nodeCollection)
graph
- The given graph.nodeCollection
- The collection of nodes to cluster.
public mocgraph.Node clusterNodes(java.util.Collection nodeCollection)
nodeCollection
- The collection of nodes to cluster.
public DIFGraph getGraph()
public mocgraph.Edge getOriginalEdge(mocgraph.Edge newEdge)
newEdge
- The new edge induced by clustering.
public mocgraph.Node getRootNode()
public DIFGraph getSubgraph(mocgraph.Node superNode)
superNode
- The super node.
public boolean isSuperNode(mocgraph.Node node)
node
- The given node.
public boolean testAcyclicClustering(java.util.Collection nodeCollection)
Caution: The present graph status should be acyclic. This method tests cyclic/acyclic property ONLY due to clustering.
nodeCollection
- The node collection to test acyclic clustering.
protected java.util.List _clusterNodesComplete(DIFGraph graph, java.util.Collection nodeCollection, mocgraph.Node superNode)
List
is returned
which contains these results and users should be aware of what
they are (and their squence in the list). By default, this method
returns both the induced subgraph and a map from newly created
edges to old edges replaced.
Caution: The clustering implementation considers topology only. Any attributes other than topology may also need to be changed in clustering. Therefore, all sub-classes should consider approriate modifications to all attributes.
graph
- The given graph.nodeCollection
- The collection of nodes.superNode
- The super node that will replace the node collection.
protected java.util.Map _getEdgeMap()
protected boolean _isReachable(mocgraph.Node node1, mocgraph.Node node2)
node1
- The first node.node2
- The second node.
node2
is reachable from
node1
; false otherwise.protected boolean _isReachable(java.util.Collection nodeCollection1, java.util.Collection nodeCollection2)
nodeCollection1
- The first node collection.nodeCollection2
- The second node collection.
nodeCollection2
is reachable from
nodeCollection1
; false otherwise.protected DIFEdgeWeight _newEdgeWeight()
protected DIFNodeWeight _newNodeWeight()
protected mocgraph.Node _newSuperNode()
protected java.util.Collection _reachInNodes(mocgraph.Node node)
node
- The given node.
protected java.util.Collection _reachInNodes(java.util.Collection nodeCollection)
node
- The given node node collection.
protected java.util.Collection _reachOutNodes(mocgraph.Node node)
node
- The given node.
protected java.util.Collection _reachOutNodes(java.util.Collection nodeCollection)
node
- The given node Collection.
protected void _setSuperNode(mocgraph.Node superNode, DIFGraph subgraph)
superNode
- The node to set as super.graph
- The associated subgraph.protected void _updateReachability(mocgraph.Node superNode, java.util.Collection nodeCollection)
superNode
- The super node.nodeCollection
- The nodes associated with the super node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |