use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class ClosenessCentralityPluginNGTest method testDirectedCloseness.
@Test
public void testDirectedCloseness() throws Exception {
final ClosenessCentralityPlugin instance = new ClosenessCentralityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(ClosenessCentralityPlugin.HARMONIC_PARAMETER_ID, false);
parameters.setBooleanValue(ClosenessCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
parameters.setBooleanValue(ClosenessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
parameters.setBooleanValue(ClosenessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
parameters.setBooleanValue(ClosenessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
parameters.setBooleanValue(ClosenessCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
parameters.setBooleanValue(ClosenessCentralityPlugin.NORMALISE_CONNECTED_COMPONENTS_PARAMETER_ID, false);
parameters.setBooleanValue(ClosenessCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(vertexOutClosenessAttribute, vxId0), 0.125f);
assertEquals(graph.getFloatValue(vertexOutClosenessAttribute, vxId1), 0.25f);
assertEquals(graph.getFloatValue(vertexOutClosenessAttribute, vxId2), 0.33333334f);
assertEquals(graph.getFloatValue(vertexOutClosenessAttribute, vxId3), 1f);
assertEquals(graph.getFloatValue(vertexOutClosenessAttribute, vxId4), 0f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class DegreeCentralityPluginNGTest method testInDegree.
@Test
public void testInDegree() throws Exception {
final DegreeCentralityPlugin instance = new DegreeCentralityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId0), 0f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId1), 1f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId2), 1f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId3), 2f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId4), 1f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class DegreeCentralityPluginNGTest method testOutDegree.
@Test
public void testOutDegree() throws Exception {
final DegreeCentralityPlugin instance = new DegreeCentralityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
parameters.setBooleanValue(DegreeCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(vertexOutDegreeAttribute, vxId0), 1f);
assertEquals(graph.getFloatValue(vertexOutDegreeAttribute, vxId1), 2f);
assertEquals(graph.getFloatValue(vertexOutDegreeAttribute, vxId2), 1f);
assertEquals(graph.getFloatValue(vertexOutDegreeAttribute, vxId3), 1f);
assertEquals(graph.getFloatValue(vertexOutDegreeAttribute, vxId4), 0f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class DegreeCentralityPluginNGTest method testNormalisedInDegree.
@Test
public void testNormalisedInDegree() throws Exception {
final DegreeCentralityPlugin instance = new DegreeCentralityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
parameters.setBooleanValue(DegreeCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
parameters.setBooleanValue(DegreeCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
parameters.setBooleanValue(DegreeCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId0), 0f / 2f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId1), 1f / 2f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId2), 1f / 2f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId3), 2f / 2f);
assertEquals(graph.getFloatValue(vertexInDegreeAttribute, vxId4), 1f / 2f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class EigenvectorCentralityPluginNGTest method testNormalisedEigenvector.
@Test
public void testNormalisedEigenvector() throws Exception {
final EigenvectorCentralityPlugin instance = new EigenvectorCentralityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setIntegerValue(EigenvectorCentralityPlugin.ITERATIONS_PARAMETER_ID, 100);
parameters.setFloatValue(EigenvectorCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
parameters.setBooleanValue(EigenvectorCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, true);
parameters.setBooleanValue(EigenvectorCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(vertexEigenvectorAttribute, vxId0), 0.11620406f);
assertEquals(graph.getFloatValue(vertexEigenvectorAttribute, vxId1), 0.2675919f);
assertEquals(graph.getFloatValue(vertexEigenvectorAttribute, vxId2), 0.23240812f);
assertEquals(graph.getFloatValue(vertexEigenvectorAttribute, vxId3), 0.2675919f);
assertEquals(graph.getFloatValue(vertexEigenvectorAttribute, vxId4), 0.11620406f);
}
Aggregations