GephiSolver extends AbstractSolver<Node, Edge> { SolverResult solveWithGirvanNewman(final int numberOfClusters) { Log.debug("solve cluster with numberOfClusters = " + numberOfClusters); GirvanNewmanClusterer clusterer = new GirvanNewmanClusterer(); clusterer.setPreferredNumberOfClusters(numberOfClusters); clusterer.execute(graphModel); SolverResult solverResult = new SolverResult(getClustererResult(clusterer)); return solverResult; } GephiSolver(final UserSystem userSystem, final Map<EntityPair, Map<String, Score>> scores, final Integer numberOfClusters); @Override SolverResult solve();  }
@Test public void testSimpleModelSomeEdges() { UserSystem model = new UserSystem(); model.addNanoentity(createNanoentity("nanoentity1")); model.addNanoentity(createNanoentity("nanoentity2")); model.addNanoentity(createNanoentity("nanoentity3")); model.addNanoentity(createNanoentity("nanoentity4")); model.addNanoentity(createNanoentity("nanoentity5")); model.addNanoentity(createNanoentity("nanoentity6")); Set<CouplingInstance> entityCoupling = new HashSet<>(); entityCoupling.add(createInstance(model, new String[] { "nanoentity1", "nanoentity2", "nanoentity3" })); entityCoupling.add(createInstance(model, new String[] { "nanoentity4", "nanoentity5", "nanoentity6" })); Set<CouplingInstance> relationshipCoupling = createRelationship(model); when(couplingInstanceRepository.findByUserSystem(model)).thenReturn(entityCoupling); when(couplingInstanceRepository.findByUserSystemAndCriterion(model, identityCoupling.getName())).thenReturn(entityCoupling); when(couplingInstanceRepository.findByUserSystemAndCriterion(model, semanticCoupling.getName())).thenReturn(relationshipCoupling); final Scorer scorer = new Scorer(couplingInstanceRepository, nanoentityRepository); Map<EntityPair, Map<String, Score>> scores = scorer.getScores(model, (final String key) -> { return config.getPriorityForCouplingCriterion(key); }); GephiSolver solver = new GephiSolver(model, scores, null); SolverResult result = solver.solveWithGirvanNewman(2); assertThat(result.getServices(), hasSize(2)); for (Service context : result.getServices()) { assertThat(context.getNanoentities(), hasSize(3)); } }