bliss: Source Code Documentation
0.73 (Debian 0.73-5)
|
The bliss C API. More...
#include <stdlib.h>
#include <stdio.h>
Classes | |
struct | bliss_stats_struct |
The C API version of the statistics returned by the bliss search algorithm. More... | |
Typedefs | |
typedef struct bliss_graph_struct | BlissGraph |
The true bliss graph is hiding behind this typedef. | |
typedef struct bliss_stats_struct | BlissStats |
The C API version of the statistics returned by the bliss search algorithm. | |
Functions | |
BlissGraph * | bliss_new (const unsigned int N) |
BlissGraph * | bliss_read_dimacs (FILE *fp) |
void | bliss_write_dimacs (BlissGraph *graph, FILE *fp) |
void | bliss_release (BlissGraph *graph) |
void | bliss_write_dot (BlissGraph *graph, FILE *fp) |
unsigned int | bliss_get_nof_vertices (BlissGraph *graph) |
unsigned int | bliss_add_vertex (BlissGraph *graph, unsigned int c) |
void | bliss_add_edge (BlissGraph *graph, unsigned int v1, unsigned int v2) |
int | bliss_cmp (BlissGraph *graph1, BlissGraph *graph2) |
unsigned int | bliss_hash (BlissGraph *graph) |
BlissGraph * | bliss_permute (BlissGraph *graph, const unsigned int *perm) |
void | bliss_find_automorphisms (BlissGraph *graph, void(*hook)(void *user_param, unsigned int N, const unsigned int *aut), void *hook_user_param, BlissStats *stats) |
const unsigned int * | bliss_find_canonical_labeling (BlissGraph *graph, void(*hook)(void *user_param, unsigned int N, const unsigned int *aut), void *hook_user_param, BlissStats *stats) |
The bliss C API.
This is the C language API to bliss. Note that this C API is only a subset of the C++ API; please consider using the C++ API whenever possible.
void bliss_add_edge | ( | BlissGraph * | graph, |
unsigned int | v1, | ||
unsigned int | v2 | ||
) |
Add a new undirected edge in the graph. v1 and v2 are vertex indices returned by bliss_add_vertex(). If duplicate edges are added, they will be ignored (however, they are not necessarily physically ignored immediately but may consume memory for a while so please try to avoid adding duplicate edges whenever possible).
unsigned int bliss_add_vertex | ( | BlissGraph * | graph, |
unsigned int | c | ||
) |
Add a new vertex with color c in the graph graph and return its index. The vertex indices are always in the range [0,bliss::bliss_get_nof_vertices(bliss)-1].
int bliss_cmp | ( | BlissGraph * | graph1, |
BlissGraph * | graph2 | ||
) |
Compare two graphs according to a total order. Return -1, 0, or 1 if the first graph was smaller than, equal to, or greater than, resp., the other graph. If 0 is returned, then the graphs have the same number vertices, the vertices in them are colored in the same way, and they contain the same edges; that is, the graphs are equal.
void bliss_find_automorphisms | ( | BlissGraph * | graph, |
void(*)(void *user_param, unsigned int N, const unsigned int *aut) | hook, | ||
void * | hook_user_param, | ||
BlissStats * | stats | ||
) |
Find a set of generators for the automorphism group of the graph. The hook function hook (if non-null) is called each time a new generator for the automorphism group is found. The first argument user_param for the hook function is the hook_user_param argument, the second argument N is the length of the automorphism (equal to bliss::bliss_get_nof_vertices(graph)) and the third argument aut is the automorphism (a bijection on {0,...,N-1}). The memory for the automorphism aut will be invalidated immediately after the return from the hook; if you want to use the automorphism later, you have to take a copy of it. Do not call bliss_* functions in the hook. If stats is non-null, then some search statistics are copied there.
const unsigned int* bliss_find_canonical_labeling | ( | BlissGraph * | graph, |
void(*)(void *user_param, unsigned int N, const unsigned int *aut) | hook, | ||
void * | hook_user_param, | ||
BlissStats * | stats | ||
) |
Otherwise the same as bliss_find_automorphisms() except that a canonical labeling for the graph (a bijection on {0,...,N-1}) is returned. The returned canonical labeling will remain valid only until the next call to a bliss_* function with the exception that bliss_permute() can be called without invalidating the labeling. To compute the canonical version of a graph, call this function and then bliss_permute() with the returned canonical labeling. Note that the computed canonical version may depend on the applied version of bliss.
unsigned int bliss_get_nof_vertices | ( | BlissGraph * | graph | ) |
Return the number of vertices in the graph.
unsigned int bliss_hash | ( | BlissGraph * | graph | ) |
Get a hash value for the graph.
BlissGraph* bliss_new | ( | const unsigned int | N | ) |
Create a new graph instance with N vertices and no edges. N can be zero and bliss_add_vertex() called afterwards to add new vertices on-the-fly.
BlissGraph* bliss_permute | ( | BlissGraph * | graph, |
const unsigned int * | perm | ||
) |
Permute the graph with the given permutation perm. Returns the permuted graph, the original graph is not modified. The argument perm should be an array of N=bliss::bliss_get_nof_vertices(graph) elements describing a bijection on {0,...,N-1}.
BlissGraph* bliss_read_dimacs | ( | FILE * | fp | ) |
Read an undirected graph from a file in the DIMACS format into a new bliss instance. Returns 0 if an error occurred. Note that in the DIMACS file the vertices are numbered from 1 to N while in the bliss C API they are from 0 to N-1. Thus the vertex n in the file corresponds to the vertex n-1 in the API.
void bliss_release | ( | BlissGraph * | graph | ) |
Release the graph. Note that the memory pointed by the arguments of hook functions for bliss_find_automorphisms() and bliss_find_canonical_labeling() is deallocated and thus should not be accessed after calling this function.
void bliss_write_dimacs | ( | BlissGraph * | graph, |
FILE * | fp | ||
) |
Output the graph in the file stream fp in the DIMACS format. See the User's Guide for the file format details. Note that in the DIMACS file the vertices are numbered from 1 to N while in bliss they are from 0 to N-1.
void bliss_write_dot | ( | BlissGraph * | graph, |
FILE * | fp | ||
) |
Print the graph in graphviz dot format.