Search in sources :

Example 16 with PluginParameters

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);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 17 with PluginParameters

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);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 18 with PluginParameters

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);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 19 with PluginParameters

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);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 20 with PluginParameters

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);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)377 Test (org.testng.annotations.Test)185 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)60 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)60 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)58 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)58 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)52 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)48 ArrayList (java.util.ArrayList)47 Graph (au.gov.asd.tac.constellation.graph.Graph)37 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)34 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)32 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)24 List (java.util.List)20 Map (java.util.Map)20 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)19 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)19 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)19 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)17 IOException (java.io.IOException)17