Ticket #5793: cliquer-2.patch

File cliquer-2.patch, 4.3 KB (added by ncohen, 12 years ago)

Second patch

  • new file sage/ext/cliquer.pxd

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1248031624 -7200
    # Node ID 48b4cef43b2e6e2414d7d40fe341578697f72bd7
    # Parent  9faa9ef48dee6bbbedc7fc544df1dfdf63f53234
    - ext/cliquer.pxi moved to ext/cliquer.pxd
    - Small fix in function  graph.clique_number for algorithm=networkx
    - One typo
    
    diff -r 9faa9ef48dee -r 48b4cef43b2e sage/ext/cliquer.pxd
    - +  
     1cdef extern from "cliquer/graph.h":
     2    struct graph_t:
     3       pass
     4
     5cdef extern from "cliquer/cliquer.h":
     6    struct clique_options:
     7       pass
     8
     9
     10cdef extern from "cliquer/reorder.h":
     11     cdef int *reorder_by_greedy_coloring(graph_t *g, bool weighted)
     12     cdef int *reorder_by_degree(graph_t *g, bool weighted)
     13
     14cdef extern from "cliquer/cliquer.h":
     15     bool clique_print_time(intlevel, int i, int n, int max, double cputime, double realtime, clique_options *opts)
     16
     17
     18cdef extern from "cliquer/cl.h":
     19     cdef int sage_clique_max(graph_t *g, int ** list)
     20     cdef int sage_all_clique_max(graph_t *g, int ** list)
     21     cdef int sage_clique_number(graph_t *g)
     22     cdef void parse_input(char *str,graph_t *g)
     23
     24cdef extern from "cliquer/graph.h":
     25     cdef graph_t * graph_new(int n)
     26
  • deleted file sage/ext/cliquer.pxi

    diff -r 9faa9ef48dee -r 48b4cef43b2e sage/ext/cliquer.pxi
    + -  
    1 cdef extern from "cliquer/graph.h":
    2     struct graph_t:
    3        pass
    4 
    5 cdef extern from "cliquer/cliquer.h":
    6     struct clique_options:
    7        pass
    8 
    9 
    10 cdef extern from "cliquer/reorder.h":
    11      cdef int *reorder_by_greedy_coloring(graph_t *g, bool weighted)
    12      cdef int *reorder_by_degree(graph_t *g, bool weighted)
    13 
    14 cdef extern from "cliquer/cliquer.h":
    15      bool clique_print_time(intlevel, int i, int n, int max, double cputime, double realtime, clique_options *opts)
    16 
    17 
    18 cdef extern from "cliquer/cl.h":
    19      cdef int sage_clique_max(graph_t *g, int ** list)
    20      cdef int sage_all_clique_max(graph_t *g, int ** list)
    21      cdef int sage_clique_number(graph_t *g)
    22      cdef void parse_input(char *str,graph_t *g)
    23 
    24 cdef extern from "cliquer/graph.h":
    25      cdef graph_t * graph_new(int n)
    26 
  • sage/graphs/cliquer.pyx

    diff -r 9faa9ef48dee -r 48b4cef43b2e sage/graphs/cliquer.pyx
    a b  
    1 include '../ext/cliquer.pxi'
     1include '../ext/cliquer.pxd'
    22
    33# computes the maximum clique of a graph and return the list of its members
    44
  • sage/graphs/graph.py

    diff -r 9faa9ef48dee -r 48b4cef43b2e sage/graphs/graph.py
    a b  
    92429242        """
    92439243        Returns the size of the largest clique of the graph (clique
    92449244        number). By default, the Cliquer algorithm is used
    9245         ( algorithm="Cliquer" ) but you can also chose the networkx
     9245        ( algorithm="cliquer" ) but you can also chose the networkx
    92469246        algorithm instead ( algorithm="networkx" )
    92479247       
    92489248        Currently only implemented for undirected graphs. Use
     
    92589258            sage: G.clique_number()
    92599259            3
    92609260        """
    9261         if algorithm=="networkx":
     9261        if algorithm=="cliquer":
     9262            from sage.graphs.cliquer import clique_number
     9263            return clique_number(self)       
     9264        elif algorithm=="networkx":
    92629265            import networkx.cliques
    9263             return networkx.cliques.graph_clique_number(self.networkx_graph(copy=False), cliques)
    9264        
    9265         from sage.graphs.cliquer import clique_number
    9266         return clique_number(self)
     9266            return networkx.cliques.graph_clique_number(self.networkx_graph(copy=False))
     9267        else:
     9268            raise NotImplementedError("Only 'networkx' and 'cliquer' are supported.")
    92679269
    92689270    def maximum_clique(self):
    92699271        """
     
    93029304
    93039305    def maximum_cliques(self):
    93049306        """
    9305         Returns the vertex set of *ALL* the maximum complete subgraphs.
     9307        Returns the vertex sets of *ALL* the maximum complete subgraphs.
    93069308       
    93079309        Currently only implemented for undirected graphs. Use
    93089310        to_undirected to convert a digraph to an undirected graph.