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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations