src/main/java/org/thegalactic/lattice/ConceptLattice.java
public static ConceptLattice idealLattice(DAGraph dag) {
        if (!dag.isAcyclic()) {
            return null;
        }
        // initialise the poset of ideals with the emptyset
        ConceptLattice conceptLattice = new ConceptLattice();
        conceptLattice.addNode(new Concept(true, false));
        // travel on graph according to a topological sort
        DAGraph graph = new DAGraph(dag);
        graph.transitiveClosure();
        // treatment of nodes according to a topological sort
        List<Node> sort = graph.topologicalSort();
        for (Node x : sort) {
            // computation of Jx
            TreeSet<Node> jxmoins = new TreeSet<Node>(graph.getPredecessorNodes(x));
            // storage of new ideals in a set
            TreeSet<Concept> toAdd = new TreeSet<Concept>();
            for (Object j1 : conceptLattice.getNodes()) {
                if (((Concept) j1).containsAllInA(jxmoins)) {
                    Concept newJ = new Concept(true, false);
                    newJ.addAllToA(((TreeSet) ((Concept) j1).getSetA()));
                    newJ.addToA(x);
                    toAdd.add(newJ);
                }
            }
            // addition of the new ideals in conceptLattice
            for (Concept newJ : toAdd) {
                conceptLattice.addNode(newJ);
            }
        }
        // computation of the inclusion relaton
        for (Object node1 : conceptLattice.getNodes()) {
            for (Object node2 : conceptLattice.getNodes()) {
                if (((Concept) node1).containsAllInA(((Concept) node2).getSetA())) {
                    conceptLattice.addEdge((Node) node2, (Node) node1);
                }
            }
        }
        conceptLattice.transitiveReduction();
        return conceptLattice;
    }
/**
     * Generate the lattice composed of all the antichains of this component
     * ordered with the inclusion relation.
     *
     * This treatment is performed in O(??) by implementation of Nourine
     * algorithm that consists in a sequence of doubling intervals of nodes.
     *
     * @param dag a directed acyclic graph
     *
     * @return the concept lattice
     */
Generate the lattice composed of all the antichains of this component
ordered with the inclusion relation.

This treatment is performed in O(??) by implementation of Nourine
algorithm that consists in a sequence of doubling intervals of nodes.

@param dag a directed acyclic graph

@return the concept lattice
Generate the lattice composed of all the antichains of this component ordered with the inclusion relation . This treatment is performed in O ( ?? ) by implementation of Nourine algorithm that consists in a sequence of doubling intervals of nodes . @param dag a directed acyclic graph @return the concept lattice
public static ConceptLattice idealLattice(DAGraph dag) {
        if (!dag.isAcyclic()) {
            return null;
        }
        ConceptLattice conceptLattice = new ConceptLattice();
        conceptLattice.addNode(new Concept(true, false));
        DAGraph graph = new DAGraph(dag);
        graph.transitiveClosure();
        List<Node> sort = graph.topologicalSort();
        for (Node x : sort) {
            TreeSet<Node> jxmoins = new TreeSet<Node>(graph.getPredecessorNodes(x));
            TreeSet<Concept> toAdd = new TreeSet<Concept>();
            for (Object j1 : conceptLattice.getNodes()) {
                if (((Concept) j1).containsAllInA(jxmoins)) {
                    Concept newJ = new Concept(true, false);
                    newJ.addAllToA(((TreeSet) ((Concept) j1).getSetA()));
                    newJ.addToA(x);
                    toAdd.add(newJ);
                }
            }
            for (Concept newJ : toAdd) {
                conceptLattice.addNode(newJ);
            }
        }
        for (Object node1 : conceptLattice.getNodes()) {
            for (Object node2 : conceptLattice.getNodes()) {
                if (((Concept) node1).containsAllInA(((Concept) node2).getSetA())) {
                    conceptLattice.addEdge((Node) node2, (Node) node1);
                }
            }
        }
        conceptLattice.transitiveReduction();
        return conceptLattice;
    }
public static ConceptLattice idealLattice ( DAGraph dag ) { if ( ! dag . isAcyclic ( ) ) { return null ; } ConceptLattice conceptLattice = new ConceptLattice ( ) ; conceptLattice . addNode ( new Concept ( true , false ) ) ; DAGraph graph = new DAGraph ( dag ) ; graph . transitiveClosure ( ) ; List < Node > sort = graph . topologicalSort ( ) ; for ( Node x : sort ) { TreeSet < Node > jxmoins = new TreeSet < Node > ( graph . getPredecessorNodes ( x ) ) ; TreeSet < Concept > toAdd = new TreeSet < Concept > ( ) ; for ( Object j1 : conceptLattice . getNodes ( ) ) { if ( ( ( Concept ) j1 ) . containsAllInA ( jxmoins ) ) { Concept newJ = new Concept ( true , false ) ; newJ . addAllToA ( ( ( TreeSet ) ( ( Concept ) j1 ) . getSetA ( ) ) ) ; newJ . addToA ( x ) ; toAdd . add ( newJ ) ; } } for ( Concept newJ : toAdd ) { conceptLattice . addNode ( newJ ) ; } } for ( Object node1 : conceptLattice . getNodes ( ) ) { for ( Object node2 : conceptLattice . getNodes ( ) ) { if ( ( ( Concept ) node1 ) . containsAllInA ( ( ( Concept ) node2 ) . getSetA ( ) ) ) { conceptLattice . addEdge ( ( Node ) node2 , ( Node ) node1 ) ; } } } conceptLattice . transitiveReduction ( ) ; return conceptLattice ; }
Generate the lattice composed of all the antichains of this component
 ordered with the inclusion relation.
Generate the lattice composed of all the antichains of this component ordered with the inclusion relation .
// initialise the poset of ideals with the emptyset // travel on graph according to a topological sort // treatment of nodes according to a topological sort // computation of Jx // storage of new ideals in a set // addition of the new ideals in conceptLattice // computation of the inclusion relaton