def nested_dissection(adjacency=None, xadj=None, adjncy=None): """This function computes fill reducing orderings of sparse matrices using the multilevel nested dissection algorithm. The input graph is given as either a Pythonic way as the `adjacency' parameter or in the direct C-like way that Metis likes as `xadj' and `adjncy'. It is an error to specify both graph inputs. """ xadj, adjncy = _prepare_graph(adjacency, xadj, adjncy) from pymetis._internal import edge_nd return edge_nd(xadj, adjncy)
def nested_dissection(adjacency=None, xadj=None, adjncy=None): """This function computes fill reducing orderings of sparse matrices using the multilevel nested dissection algorithm. The input graph is given as either a Pythonic way as the `adjacency' parameter or in the direct C-like way that Metis likes as `xadj' and `adjncy'. It is an error to specify both graph inputs. """ xadj, adncy = _prepare_graph(adjacency, xadj, adjncy) from pymetis._internal import edge_nd return edge_nd(xadj, adjncy)
def nd_ordering(g): xadj = [0] adjncy = [] adjacency = g.adjacency_list() for i in range(len(adjacency)): adj = adjacency[i] if adj: assert max(adj) < len(adjacency) adjncy += map(int, adj) xadj.append(len(adjncy)) (perm, iperm) = pymetis.edge_nd(xadj, adjncy) return perm