use of org.eclipse.elk.alg.force.ComponentsProcessor in project elk by eclipse.
the class ForceImportTest method testDoNotSeparateConnectedComponents.
/**
* Ensure that a single {@link FGraph} is imported if connected components shall not be split.
*/
@Test
public void testDoNotSeparateConnectedComponents() {
ComponentsProcessor cp = new ComponentsProcessor();
FGraph graph = createTwoComponentsGraph();
graph.setProperty(ForceOptions.SEPARATE_CONNECTED_COMPONENTS, false);
List<FGraph> graphs = cp.split(graph);
assertThat(graphs.size(), is(1));
FGraph fGraph = graphs.get(0);
assertThat(fGraph.getNodes().size(), is(6));
assertThat(fGraph.getEdges().size(), is(4));
assertThat(fGraph.getLabels().size(), is(4));
}
use of org.eclipse.elk.alg.force.ComponentsProcessor in project elk by eclipse.
the class ForceImportTest method testSeparateConnectedComponents.
/**
* Ensure that connected components are split when desired.
*
* Also verifies that the split graphs have the correct number of nodes, edges, and labels.
*/
@Test
public void testSeparateConnectedComponents() {
ComponentsProcessor cp = new ComponentsProcessor();
FGraph graph = createTwoComponentsGraph();
graph.setProperty(ForceOptions.SEPARATE_CONNECTED_COMPONENTS, true);
List<FGraph> graphs = cp.split(graph);
assertThat(graphs.size(), is(2));
graphs.forEach(g -> checkSimpleGraph(g));
}
Aggregations