# 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
-
|
+
|
|
| 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 | |
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 | | |
diff -r 9faa9ef48dee -r 48b4cef43b2e sage/graphs/cliquer.pyx
a
|
b
|
|
1 | | include '../ext/cliquer.pxi' |
| 1 | include '../ext/cliquer.pxd' |
2 | 2 | |
3 | 3 | # computes the maximum clique of a graph and return the list of its members |
4 | 4 | |
diff -r 9faa9ef48dee -r 48b4cef43b2e sage/graphs/graph.py
a
|
b
|
|
9242 | 9242 | """ |
9243 | 9243 | Returns the size of the largest clique of the graph (clique |
9244 | 9244 | 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 |
9246 | 9246 | algorithm instead ( algorithm="networkx" ) |
9247 | 9247 | |
9248 | 9248 | Currently only implemented for undirected graphs. Use |
… |
… |
|
9258 | 9258 | sage: G.clique_number() |
9259 | 9259 | 3 |
9260 | 9260 | """ |
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": |
9262 | 9265 | 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.") |
9267 | 9269 | |
9268 | 9270 | def maximum_clique(self): |
9269 | 9271 | """ |
… |
… |
|
9302 | 9304 | |
9303 | 9305 | def maximum_cliques(self): |
9304 | 9306 | """ |
9305 | | Returns the vertex set of *ALL* the maximum complete subgraphs. |
| 9307 | Returns the vertex sets of *ALL* the maximum complete subgraphs. |
9306 | 9308 | |
9307 | 9309 | Currently only implemented for undirected graphs. Use |
9308 | 9310 | to_undirected to convert a digraph to an undirected graph. |