src/main/java/org/thegalactic/dgraph/ConcreteDGraph.java
public int transitiveClosure() {
        int size = 0;
        // mark each node to false
        TreeMap<Node<N>, Boolean> mark = new TreeMap<Node<N>, Boolean>();
        for (Node<N> node : this.nodes) {
            mark.put(node, Boolean.FALSE);
        }
        // treatment of nodes
        for (Node<N> x : this.nodes) {
            ArrayList<Node<N>> list = new ArrayList<Node<N>>();
            list.add(x);
            while (!list.isEmpty()) {
                Node<N> y = list.remove(0);
                for (Node<N> z : this.getSuccessorNodes(y)) {
                    // treatment of y when not marked
                    if (!mark.get(z)) {
                        mark.put(z, Boolean.TRUE);
                        this.addEdge(x, z);
                        size++;
                        list.add(z);
                    }
                }
            }
            for (Node<N> y : this.getSuccessorNodes(x)) {
                mark.put(y, Boolean.FALSE);
            }
        }
        return size;
    }
/**
     * Computes the transitive closure of this component.
     *
     * This treatment is performed in O(nm+m_c), where n corresponds to the
     * number of nodes, m to the number of edges, and m_c to the number of edges
     * in the closure. This treatment improves the Roy-Warshall algorithm that
     * directly implements the definition in O(logm n^3).
     *
     * This treatment is overlapped in class {@link DAGraph} with a more
     * efficient algorithm dedicated to directed acyclic graph.
     *
     * @return the number of added edges
     */
Computes the transitive closure of this component.
This treatment is performed in O(nm+m_c), where n corresponds to the
number of nodes, m to the number of edges, and m_c to the number of edges
in the closure. This treatment improves the Roy-Warshall algorithm that
directly implements the definition in O(logm n^3).

This treatment is overlapped in class  DAGraph with a more
efficient algorithm dedicated to directed acyclic graph.

@return the number of added edges
Computes the transitive closure of this component . This treatment is performed in O ( nm + m_c ) where n corresponds to the number of nodes m to the number of edges and m_c to the number of edges in the closure . This treatment improves the Roy - Warshall algorithm that directly implements the definition in O ( logm n^3 ) . This treatment is overlapped in class DAGraph with a more efficient algorithm dedicated to directed acyclic graph . @return the number of added edges
public int transitiveClosure() {
        int size = 0;
        TreeMap<Node<N>, Boolean> mark = new TreeMap<Node<N>, Boolean>();
        for (Node<N> node : this.nodes) {
            mark.put(node, Boolean.FALSE);
        }
        for (Node<N> x : this.nodes) {
            ArrayList<Node<N>> list = new ArrayList<Node<N>>();
            list.add(x);
            while (!list.isEmpty()) {
                Node<N> y = list.remove(0);
                for (Node<N> z : this.getSuccessorNodes(y)) {
                    if (!mark.get(z)) {
                        mark.put(z, Boolean.TRUE);
                        this.addEdge(x, z);
                        size++;
                        list.add(z);
                    }
                }
            }
            for (Node<N> y : this.getSuccessorNodes(x)) {
                mark.put(y, Boolean.FALSE);
            }
        }
        return size;
    }
public int transitiveClosure ( ) { int size = 0 ; TreeMap < Node < N > , Boolean > mark = new TreeMap < Node < N > , Boolean > ( ) ; for ( Node < N > node : this . nodes ) { mark . put ( node , Boolean . FALSE ) ; } for ( Node < N > x : this . nodes ) { ArrayList < Node < N > > list = new ArrayList < Node < N > > ( ) ; list . add ( x ) ; while ( ! list . isEmpty ( ) ) { Node < N > y = list . remove ( 0 ) ; for ( Node < N > z : this . getSuccessorNodes ( y ) ) { if ( ! mark . get ( z ) ) { mark . put ( z , Boolean . TRUE ) ; this . addEdge ( x , z ) ; size ++ ; list . add ( z ) ; } } } for ( Node < N > y : this . getSuccessorNodes ( x ) ) { mark . put ( y , Boolean . FALSE ) ; } } return size ; }
Computes the transitive closure of this component.
Computes the transitive closure of this component .
// mark each node to false // treatment of nodes // treatment of y when not marked