Search in sources :

Example 21 with PluginParameters

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

the class HitsCentralityPluginNGTest method testNormalisedHits.

@Test
public void testNormalisedHits() throws Exception {
    final HitsCentralityPlugin instance = new HitsCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setIntegerValue(HitsCentralityPlugin.ITERATIONS_PARAMETER_ID, 100);
    parameters.setFloatValue(HitsCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
    parameters.setBooleanValue(HitsCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexHitsAuthorityAttribute, vxId0), 0f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsAuthorityAttribute, vxId1), 1.874E-42f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsAuthorityAttribute, vxId2), 0.5257311f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsAuthorityAttribute, vxId3), 0.8506508f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsAuthorityAttribute, vxId4), 1.874E-42f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsHubAttribute, vxId0), 1.157E-42f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsHubAttribute, vxId1), 0.8506508f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsHubAttribute, vxId2), 0.5257311f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsHubAttribute, vxId3), 1.157E-42f / 0.8506508f, 0.000001f);
    assertEquals(graph.getFloatValue(vertexHitsHubAttribute, vxId4), 0f / 0.8506508f, 0.000001f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 22 with PluginParameters

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

the class KatzCentralityPluginNGTest method testKatz.

@Test
public void testKatz() throws Exception {
    final KatzCentralityPlugin instance = new KatzCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setFloatValue(KatzCentralityPlugin.ALPHA_PARAMETER_ID, 0.1f);
    parameters.setFloatValue(KatzCentralityPlugin.BETA_PARAMETER_ID, 1.0f);
    parameters.setIntegerValue(KatzCentralityPlugin.ITERATIONS_PARAMETER_ID, 100);
    parameters.setFloatValue(KatzCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
    parameters.setBooleanValue(KatzCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
    parameters.setBooleanValue(KatzCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId0), 1.137931f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId1), 1.3793104f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId2), 1.2758621f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId3), 1.3793104f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId4), 1.137931f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 23 with PluginParameters

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

the class KatzCentralityPluginNGTest method testNormalisedKatz.

@Test
public void testNormalisedKatz() throws Exception {
    final KatzCentralityPlugin instance = new KatzCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setFloatValue(KatzCentralityPlugin.ALPHA_PARAMETER_ID, 0.1f);
    parameters.setFloatValue(KatzCentralityPlugin.BETA_PARAMETER_ID, 1.0f);
    parameters.setIntegerValue(KatzCentralityPlugin.ITERATIONS_PARAMETER_ID, 100);
    parameters.setFloatValue(KatzCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
    parameters.setBooleanValue(KatzCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, true);
    parameters.setBooleanValue(KatzCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId0), 0.42875203f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId1), 0.4646652f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId2), 0.44779003f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId3), 0.4646652f);
    assertEquals(graph.getFloatValue(vertexKatzAttribute, vxId4), 0.42875203f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 24 with PluginParameters

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

the class PagerankCentralityPluginNGTest method testPagerank.

@Test
public void testPagerank() throws Exception {
    final PagerankCentralityPlugin instance = new PagerankCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(PagerankCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
    parameters.setFloatValue(PagerankCentralityPlugin.DAMPING_FACTOR_PARAMETER_ID, 0.85f);
    parameters.setIntegerValue(PagerankCentralityPlugin.ITERATIONS_PARAMETER_ID, 2);
    parameters.setFloatValue(PagerankCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
    parameters.setBooleanValue(PagerankCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId0), 0.0725f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId1), 0.134125f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId2), 0.1755625f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId3), 0.3094375f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId4), 0.308375f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 25 with PluginParameters

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

the class PagerankCentralityPluginNGTest method testNormalisedPagerank.

@Test
public void testNormalisedPagerank() throws Exception {
    final PagerankCentralityPlugin instance = new PagerankCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(PagerankCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
    parameters.setFloatValue(PagerankCentralityPlugin.DAMPING_FACTOR_PARAMETER_ID, 0.85f);
    parameters.setIntegerValue(PagerankCentralityPlugin.ITERATIONS_PARAMETER_ID, 2);
    parameters.setFloatValue(PagerankCentralityPlugin.EPSILON_PARAMETER_ID, 1E-8f);
    parameters.setBooleanValue(PagerankCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId0), 0.18089105f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId1), 0.39393282f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId2), 0.5371851f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId3), 1f);
    assertEquals(graph.getFloatValue(vertexPagerankAttribute, vxId4), 0.99632686f);
}
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