コード例 #1
0
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)
コード例 #2
0
ファイル: __init__.py プロジェクト: pcmoritz/pymetis
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)
コード例 #3
0
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
コード例 #4
0
ファイル: nested_dissection.py プロジェクト: darabbt/les
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