As of writing this document WilmaScope
includes the following graph modifier plug-ins (found in
org.wilmascope.graphmodifier.plugin):
- ChangeViews - replace the GraphElementViews of nodes and/or edges
with the current default settings from the toolbar.
- CopyCluster - copy either the root graph or a particular cluster
- DirectedCycleRemoval - reverse the direction of edges such that
the graph is acyclic.
- InsertDummyNodes - if LevelConstraints are defined, this inserts
dummy nodes into edges that span multiple levels
- KMeansClustering - creates clusters around nodes that are close
together in the current layout
- LongestPathLayering - assigns nodes to LevelConstraints such that
edges are monotonically directed (uses DirectedCycleRemoval).
Plug-ins for
Performing Graph/Cluster Analysis
The GraphAnalysis plug-in framework works in a similar way to
GraphModifier plugins, but GraphAnalysis plug-ins are not expected to
modify the structure or attributes of a graph directly. Rather,
they should set a property in nodes and edges corresponding to the name
of the plugin (the string returned by the getName method) with a
floating point value that can be mapped by other classes to visual
attributes (for example, the VisualMapping classes defined in the
org.wilmascope.graphanalysis package).
A graph analysis plug-in must extend the
org.wilmascope.graphanalysis.GraphAnalysis class, implementing the
getName and analyse methods. As with GraphModifier getName simply
returns a descriptive string. The analyse method takes no
argument. Rather, you must use getCluster() to operate on the
cluster in the analyse method. For example:
/**
* Calculate degree centrality for each node, ie for node v in V:
* degreecentrality(v) = degree(v)/max(degree(w)|w in V)
*
* @author dwyer
*/
public class DegreeCentrality extends GraphAnalysis {
public String getName() {
return "Degree Centrality";
}
/*
* @see org.wilmascope.graphanalysis.GraphAnalysis#analyse(org.wilmascope.control.GraphControl.Cluster)
*/
public void analyse() {
int maxDegree = 0;
for (Node n : getCluster().getNodes()) {
int degree = n.getDegree();
if (degree > maxDegree) {
maxDegree = degree;
}
}
if (maxDegree > 0) {
for (Node n : getCluster().getNodes()) {
float degreeCentrality = (float) n.getDegree() / (float) maxDegree;
n.getProperties().setProperty(getName(), "" + degreeCentrality);
}
}
}
}
There is no need for a getControls method in GraphAnalysis
plug-ins. By default an instance of AnalysisPanel is created by
the super class. AnalysisPanel allows a user to choose visual
mappings for the results of the analysis, and appears in the Graph
Analysis window, shown below with a number of mappings defined for
various analysis plugins: