Hello everyone,
Hope you doing well. So I am going to go straight to the point. Have a problem which requires some algorithm and I don't know any algorithm that should work in this case. The problem is this. Having a bidirectional edges (for better understanding let it be rectangles). I need to find a group of the range for example from 4 - 6. If it's possible that it should always put 6 and if not then 5 and if not then 4 if there was no solution then don't group anything. So basically rectangles having connections with the rectangles that is close to each other. Each connection has it's own direction (top, bottom, left, right) basically 8 connections. So main problem is that I could connect it straight away in a single line. But the problem that sometimes there's left some rectangles in the middle of the group. I need that algorithm somehow manage to group rectangles in that order that all leftovers would be left on the bottom of the group.
Worth to mention that connection should be allowed always to the left if there is no such rectangle then go to the bottom first.
Also you can only connect modules that are certain distance to each other. So Basically there could be a connection between rectangles but the gap between them could be huge and then it should not connect those rectangles.
Made a bidirectional graph with weights and currently iterating just one time through it. Which leads like I said the leftovers in the middle sometimes.
So I am thinking of is there any kind of algorithm for it already? or maybe someone would have some insights how I can solve that?
Appreciate for any answers.
Thanks ;)
Top comments (1)
Anyone?