python/examples/transitive_closure.py
def transitive_closure(a: cb.Matrix):
    """
    Evaluates transitive closure for the provided
    adjacency matrix of the graph.

    :param a: Adjacency matrix of the graph
    :return: The transitive closure adjacency matrix
    """

    t = a.dup()                           # Duplicate matrix where to store result
    total = 0                             # Current number of values

    while total != t.nvals:
        total = t.nvals
        t.mxm(t, out=t, accumulate=True)  # t += t * t

    return t

    Evaluates transitive closure for the provided
    adjacency matrix of the graph.

    :param a: Adjacency matrix of the graph
    :return: The transitive closure adjacency matrix
    
Evaluates transitive closure for the provided
adjacency matrix of the graph.
Evaluates transitive closure for the provided adjacency matrix of the graph .
def transitive_closure(a: cb.Matrix):
    t = a.dup()                           
    total = 0                             
    while total != t.nvals:
        total = t.nvals
        t.mxm(t, out=t, accumulate=True)  
    return t
def transitive_closure ( a : cb . Matrix ) : t = a . dup ( ) total = 0 while total != t . nvals : total = t . nvals t . mxm ( t , out = t , accumulate = True ) return t
Evaluates transitive closure for the provided
adjacency matrix of the graph.
Evaluates transitive closure for the provided adjacency matrix of the graph .
"""
    Evaluates transitive closure for the provided
    adjacency matrix of the graph.

    :param a: Adjacency matrix of the graph
    :return: The transitive closure adjacency matrix
    """ # Duplicate matrix where to store result # Current number of values # t += t * t
The transitive closure adjacency matrix
The transitive closure adjacency matrix
a
cb.Matrix
Adjacency matrix of the graph
Adjacency matrix of the graph