Search in sources :

Example 11 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class BetweennessCentralityPluginNGTest method testNoDirectionBetweenness.

@Test
public void testNoDirectionBetweenness() throws Exception {
    final BetweennessCentralityPlugin instance = new BetweennessCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_CONNECTED_COMPONENTS_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId0), 0F);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId1), 0F);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId2), 0F);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId3), 0F);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId4), 0F);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 12 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class BetweennessCentralityPluginNGTest method testUndirectedBetweenness.

@Test
public void testUndirectedBetweenness() throws Exception {
    final BetweennessCentralityPlugin instance = new BetweennessCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(BetweennessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_CONNECTED_COMPONENTS_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId0), 0f);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId1), 6f);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId2), 0f);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId3), 6f);
    assertEquals(graph.getFloatValue(vertexBetweennessAttribute, vxId4), 0f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 13 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class ClosenessCentralityPluginNGTest method testUndirectedCloseness.

@Test
public void testUndirectedCloseness() 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, true);
    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(vertexClosenessAttribute, vxId0), 0.125f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId1), 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId2), 0.16666667f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId3), 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId4), 0.125f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 14 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class ClosenessCentralityPluginNGTest method testNormalisedUndirectedHarmonicCloseness.

@Test
public void testNormalisedUndirectedHarmonicCloseness() throws Exception {
    final ClosenessCentralityPlugin instance = new ClosenessCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(ClosenessCentralityPlugin.HARMONIC_PARAMETER_ID, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    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(vertexHarmonicClosenessAttribute, vxId0), 0.66666675f);
    assertEquals(graph.getFloatValue(vertexHarmonicClosenessAttribute, vxId1), 1.2f / 1.2f);
    assertEquals(graph.getFloatValue(vertexHarmonicClosenessAttribute, vxId2), 0.8571429f);
    assertEquals(graph.getFloatValue(vertexHarmonicClosenessAttribute, vxId3), 1.2f / 1.2f);
    assertEquals(graph.getFloatValue(vertexHarmonicClosenessAttribute, vxId4), 0.66666675f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 15 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class ClosenessCentralityPluginNGTest method testNormalisedUndirectedCloseness.

@Test
public void testNormalisedUndirectedCloseness() 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, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(ClosenessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    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(vertexClosenessAttribute, vxId0), 0.125f / 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId1), 0.2f / 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId2), 0.16666667f / 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId3), 0.2f / 0.2f);
    assertEquals(graph.getFloatValue(vertexClosenessAttribute, vxId4), 0.125f / 0.2f);
}
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