def to_funset(self):
        """
        Converts the list of logical networks to a set of `gringo.Fun`_ instances

        Returns
        -------
        set
            Representation of all networks as a set of `gringo.Fun`_ instances


        .. _gringo.Fun: http://potassco.sourceforge.net/gringo.html#Fun
        """
        fs = set((gringo.Fun("variable", [var]) for var in self.hg.nodes))

        formulas = set()
        for network in self:
            formulas = formulas.union(it.imap(lambda (_, f): f, network.formulas_iter()))

        formulas = pd.Series(list(formulas))

        for i, network in enumerate(self):
            for v, f in network.formulas_iter():
                fs.add(gringo.Fun("formula", [i, v, formulas[formulas == f].index[0]]))

        for formula_idx, formula in formulas.iteritems():
            for clause in formula:
                clause_idx = self.hg.clauses_idx[clause]
                fs.add(gringo.Fun("dnf", [formula_idx, clause_idx]))
                for variable, sign in clause:
                    fs.add(gringo.Fun("clause", [clause_idx, variable, sign]))

        return fs
def to_funset ( self ) : fs = set ( ( gringo . Fun ( "variable" , [ var ] ) for var in self . hg . nodes ) ) formulas = set ( ) for network in self : formulas = formulas . union ( it . imap ( lambda ( _ , f ) : f , network . formulas_iter ( ) ) ) formulas = pd . Series ( list ( formulas ) ) for i , network in enumerate ( self ) : for v , f in network . formulas_iter ( ) : fs . add ( gringo . Fun ( "formula" , [ i , v , formulas [ formulas == f ] . index [ 0 ] ] ) ) for formula_idx , formula in formulas . iteritems ( ) : for clause in formula : clause_idx = self . hg . clauses_idx [ clause ] fs . add ( gringo . Fun ( "dnf" , [ formula_idx , clause_idx ] ) ) for variable , sign in clause : fs . add ( gringo . Fun ( "clause" , [ clause_idx , variable , sign ] ) ) return fs
Converts the list of logical networks to a set of `gringo.Fun`_ instances

        Returns
        -------
        set
            Representation of all networks as a set of `gringo.Fun`_ instances


        .. _gringo.Fun: http://potassco.sourceforge.net/gringo.html#Fun