networkx / networkx-metis

NetworkX Addon to allow graph partitioning with METIS
Other
79 stars 21 forks source link

How to add constraints when graphs partition? #78

Open Tiatiaoooo opened 2 years ago

Tiatiaoooo commented 2 years ago

Hi, I want use nxmetis.partition(G, nparts, node_weight='weight', node_size='size', edge_weight='weight', tpwgts=None, ubvec=None, options=None, recursive=False) to do graph patition, but I don't know how to add constraints, the constrains are like '1. the number of persons in every partition must smaller than B2, and bigger than B1', '2. the diameter of every partition must smaller than D2, and bigger than D1', can I set tpwgts to fulfill my needs?