0

I have a networkx graph and want to partition using metis based on constraints on the edges. Image of graph representation

As can be seen the edge weights is represented as a dictionary with happiness and stress as the keys. The objective function I want to pass is that each partition should be below a particular stress threshold(calculated by summing all the edge weights present in a partition) as well as the overall happiness is maximized. I currently don't know how to pass the objective/constraint to the partition function. Any leads/ examples as to how to do it would be helpful. Also if there are any other libraries which are useful in solving the problem please do let me know.

  • I think you need to think about the problem a little differently. You are actually, I think, aiming to *balance* both happiness and stress, is that right? For example - stress below threshold: this threshold will be something slightly higher than total stress of the graph / the number of partitions. Likewise you want to maximise happiness. You could maximise happiness in one partition by simply giving it every edge, but I think you actually want to *balance* the happiness. Please let me know if this makes sense, I will investigate. – Joe Todd Dec 03 '20 at 21:18
  • @JoeTodd in a way I want to balance both happiness and stress. The stress of every partition is to be below(or =) a certain threshold and the total happiness(sum of happiness of each partition) is to be maximized. Putting everything in one partition as you say will maximize happiness but most probably fail the threshold. The stress threshold is known beforehand and can also be passed as a constraint. If a partition is [1, 2, 3] stress is given by stress(1,2)+stress(2,3)+stress(1, 3) and same for happiness of a partition. Please do let me know if this clarifies enough or you want more details. – Rajamani Sarvesh Dec 03 '20 at 21:41
  • When you say stress(1,2) do you mean the sum of the stress of edges which cross from partition 1 to partition 2? – Joe Todd Dec 03 '20 at 21:44
  • @JoeTodd [1, 2, 3] refers to nodes 1, 2 and 3 put into a partition. stress(1, 2) here refers to that 1 and 2 are in same partition and the stress is given by the dictionary as seen in the picture. So objective is to divide these vertices into sets of partitions with stress of each partition below a threshold and total happiness maximized.(which is sum of each partition happiness). Sorry if my original statement of the problem was confusing. – Rajamani Sarvesh Dec 03 '20 at 21:49
  • I'm afraid I can't get networkx & nxmetis working on my machine. Seems there's some conflict in versions. However, what you are aiming to do is fairly common. I think it's called multi-constraint partitioning. See the METIS manual for more details. Sorry I can't be more help. – Joe Todd Dec 03 '20 at 22:07

0 Answers0