2 * Copyright (c) 2016, S. Gilles <sgilles@math.umd.edu>
4 * Permission to use, copy, modify, and/or distribute this software
5 * for any purpose with or without fee is hereby granted, provided
6 * that the above copyright notice and this permission notice appear
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* A rational number */
28 /* The structure for a vertex */
30 /* A textual identifier for this vertex */
33 /* Whether this vertex is `fat' or not. Expected to be 1, 2, or 3. */
36 /* Drawing data: coordinates in `internal coordinates */
41 /* The cluster algebra structure */
43 /* How many vertices there actually are in the quiver */
46 /* How many vertices we have allocated memory for */
52 /* Edges - e_{ij} (fatness included, so E^t is not necessarily -E) */
55 /* For detecting if quiver_mutate() creates an edge too high */
56 unsigned int edge_weight_threshold
;
59 /* Add an arrow of weight a/b from i -> j, affecting e(i,j) and e(j,i) */
61 quiver_add_to_edge(struct quiver
*q
, size_t i
, size_t j
, int_fast8_t a
,
62 uint_fast8_t b
, const char **out_errstr
);
64 /* Add a vertex with a name and weight */
66 quiver_add_vertex(struct quiver
*q
, size_t *out_i
, const char *name
,
67 uint_fast16_t fatness
, int x
, int y
, const char **out_errstr
);
69 /* Increase or decrease the fatness of a vertex, readjusting edges as well */
71 quiver_adjust_fatness(struct quiver
*q
, size_t i
, int_fast8_t fatness
, const
74 /* Delete a vertex (and all associated edges) */
76 quiver_delete_vertex(struct quiver
*q
, size_t i
, const char **out_errstr
);
78 /* Read quiver from file */
80 quiver_load_from_file(struct quiver
*q
, FILE *f
, const char **out_errstr
);
84 quiver_rename_vertex(struct quiver
*q
, size_t i
, const char *new_name
, const char **out_errstr
);
86 /* Serialize the quiver */
88 quiver_save_to_file(struct quiver
*q
, FILE *f
, const char **out_errstr
);
90 /* Set threshold: if quiver_mutate() creates an edge above, warn_out is set */
92 quiver_set_warning_threshold(struct quiver
*q
, unsigned int warn_threshold
,
95 /* Mutate the quiver at vertex k, setting warn_out if threshold is broken */
97 quiver_mutate(struct quiver
*q
, size_t k
, int *out_warn
, const