Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support partition weights and constraints #45

Open
ChenNie99 opened this issue Aug 22, 2022 · 5 comments
Open

Support partition weights and constraints #45

ChenNie99 opened this issue Aug 22, 2022 · 5 comments

Comments

@ChenNie99
Copy link

The PyMetis provides a 'part_graph' like this:

def part_graph(nparts, adjacency=None, xadj=None, adjncy=None,
        vweights=None, eweights=None, recursive=None, contiguous=None, options=None):

And I notice the original METIS in C provides the k-way partition function like this:

int METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, idx_t *adjncy, 
          idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, idx_t *nparts, 
          real_t *tpwgts, real_t *ubvec, idx_t *options, idx_t *objval, idx_t *part)

According to the manual, the parameter 'tpwgts' specifies the weights for each partition, but seems missing in current API.

@inducer inducer changed the title Missing parameter 'tpwgts' in the API? Support partition weights and constraints Aug 22, 2022
@inducer
Copy link
Owner

inducer commented Aug 22, 2022

Indeed, there's no current support for that:

// pymetis does not currently support partition weights and constraints.
idx_t ncon = 1;
real_t * tpwgts = NULL;
real_t * pubvec = NULL;

PRs welcome.

@Huangbuffer
Copy link

Huangbuffer commented Oct 5, 2022

I checked the newest code, maybe you have added the function & params into it ?
but The usage method of node constrain(vweights) is not exist?

@inducer
Copy link
Owner

inducer commented Oct 5, 2022

Yep, I think I merged a PR that did that.

@Huangbuffer
Copy link

yes,Here's another question:
does this code "idx_t ncon = 1; " means "len(vweights)==len(xadj)"?

so if I want to give every node two or more weights, what should I do with the input list in python?

@inducer
Copy link
Owner

inducer commented Oct 16, 2022

That feature isn't currently exposed, but I would welcome a PR that does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants