private void setupSinkSide(Set<Employee> emps) { for (Employee e : emps) { Vertex u = Vertex.vertexFromEmployee(e); RV.add(u); sink.addToNeighbors(u); u.addToNeighbors(sink); setCapacity(u, sink, 1); setFlow(u, sink, 0); V.add(u); } }
private void setupLRNeighbors() { List<Team> teams = pp.getTeams(); for (Team t : teams) { // System.out.println(t); Vertex u = Vertex.vertexFromEmployee(t.getEmployee(0)); Vertex v = Vertex.vertexFromEmployee(t.getEmployee(1)); u.addToNeighbors(v); v.addToNeighbors(u); setCapacity(u, v, 1); setFlow(u, v, 0); } }
private void setupSourceSide(Set<Employee> emps) { for (Employee e : emps) { Vertex u = Vertex.vertexFromEmployee(e); LV.add(u); source.addToNeighbors(u); u.addToNeighbors(source); setCapacity(source, u, 1); setFlow(source, u, 1); u.setExcess(1); // Prioritize friend for initial flow if (e.getId() == ProjectParams.FRIEND_ID) { V.addFirst(u); } else { V.add(u); } } source.setExcess(source.getExcess() - source.getNumNeighbors()); }