-
Notifications
You must be signed in to change notification settings - Fork 21
How can I create METIS graph #65
Comments
Maybe there is another solution. I could overwrite your nxmetis.partition by mine and I put vwgt, vsize, adjwgt as function arguments. I am not sure if I can overwrite your partition function. |
vwgt = nx.get_node_attributes(G, 'node_weight')
adjwgt = nx.get_edge_attributes(G, 'edge_weight')
vwgt2 = [G.nodes[u].get('node_weight', 1) for u in G] # notice it is G.nodes, not G.node |
Thank you so much! I finally solved this problem with your help and self-experiments. create graph to feed into your partition function
|
And one exemplary node_property and edge_property is defined as a dictionary in networkx way: edge_property = { # nested dict, use index to search, each dict has pair, weight |
Hello, I read your source codes for partition and to use your nxmetis.partition for a graph with both edge & node weights, I need to let me graph support:
vwgt = [G.node[u].get(node_weight, 1) for u in G]
vsize = [G.node[u].get(node_size, 1) for u in G]
adjwgt = [G[u][v].get(edge_weight, 1) for u in G for v in G[u]]
However, networkx graph does not have memeber function 'get'. It seems I can only use METIS graph for input. However, I cannot find a convert function in network-metis which transfer networkx graph to METIS graph.
I have trouble installing METIS package by pip but the good news is that network-metis installation works well for me. So I hope to know how to get a METIS graph by your package.
Thanks!
The text was updated successfully, but these errors were encountered: