How to divide a weighted cyclic graph into n graphs, breaking as few compounds as possible

Background for the question:

At the beginning of each new year at my daughter’s school, the director always talks about how difficult it is to divide the children into classes, because they have many requests about who they want to be in the classroom with, and the kindergarten also has some recommendations.

In my opinion, this is just a weighted cyclic graph with children as nodes and queries / recommendations as edges that need to be divided.

Question:

Imagine, if you want, a graph with loops and weighted edges, possibly disabled. I would like to divide this graph into n smaller graphs, with at least nodes in each and at most t nodes in each graph, while breaking as few edges as possible. I suggest that NP is hard to solve, so this could be an optimization problem.

  • Does this algorithm have a graph name?
  • Are there java libraries that can help me solve this problem?

Thanks Jesper

+4
source share
2 answers

A component of a graph is also a graph. Last year, I had to write code for stitching images that used a directional datastructure diagram that had 64,000 pixels, and it was not slow at all.image second image first enter image description here

, github.

, datastructur. Linkedlist , , , - , , - , , .: 1 5 == 100, node Connected c = new connected(1,5,100); : array[i].add(c) where i == 1.

: ​​ :. , , , :

`for(Connected c : array[i].get();
        int firstStudent = c.getFirst()
        int secondStudent = c.getSecond()
         int strength = c.getStrength();`

, .

: enter image description here

0

, .

( , ), . wiki

, , - ( ), .

, , . , .

0

Source: https://habr.com/ru/post/1688568/


All Articles