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

Functions not found when calling KaHIP from python #136

Open
mtraube opened this issue Sep 15, 2023 · 2 comments
Open

Functions not found when calling KaHIP from python #136

mtraube opened this issue Sep 15, 2023 · 2 comments

Comments

@mtraube
Copy link

mtraube commented Sep 15, 2023

Hello there,

I have trouble understanding how to call different methods of kahip in python. When running

import kahip
#build adjacency array representation of the graph
xadj           = [0,2,5,7,9,12]
adjncy         = [1,4,0,2,4,1,3,2,4,0,1,3]
vwgt           = [1,1,1,1,1]
adjcwgt        = [1,1,1,1,1,1,1,1,1,1,1,1]
supress_output = 0
imbalance      = 0.03
nblocks        = 2
seed           = 0

# set mode
#const int FAST           = 0;
#const int ECO            = 1;
#const int STRONG         = 2;
#const int FASTSOCIAL     = 3;
#const int ECOSOCIAL      = 4;
#const int STRONGSOCIAL   = 5;
mode = 2

edgecut, blocks = kahip.node_separator(vwgt, xadj, adjcwgt,
                              adjncy,  nblocks, imbalance,
                              supress_output, seed, mode)

print(edgecut)
print(blocks)`

I get the error

AttributeError: module 'kahip' has no attribute 'node_separator

How do I call functions other than kaffpa through the python interface?

Best,
Matthias

@schulzchristian
Copy link
Member

schulzchristian commented Sep 19, 2023 via email

@schulzchristian
Copy link
Member

The problem is that the function is currently not implemented in the python wrapper (here is a link to the wrapper https://github.com/KaHIP/KaHIP/blob/fd4273cf132b1512d1242085f603e6b3952bf372/misc/pymodule/kahip.cpp). Adding this for the node separator function is not hard (almost the same as for the kaffpa function). If you need this urgently this should manageable, and I am happy to take a pull request. Otherwise, I can do it in October.

Please let me know.

Thanks
Christian

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

No branches or pull requests

2 participants