2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
9 * @author Sebastian Hack
10 * @brief Implements bipartite matchings.
12 #ifndef FIRM_ADT_BIPARTITE_H
13 #define FIRM_ADT_BIPARTITE_H
21 * @defgroup bipartite Bipartite Matching
22 * Solved bipartite matching problem.
23 * (Variant with only 0/1 costs)
27 /** internal representation of bipartite matching problem */
28 typedef struct bipartite_t bipartite_t;
30 /** Create new bipartite matching problem with @p n_left elements on left side
31 * and @p n_right elements on right side */
32 FIRM_API bipartite_t *bipartite_new(int n_left, int n_right);
33 /** Free memory occupied by bipartite matching problem */
34 FIRM_API void bipartite_free(bipartite_t *gr);
35 /** Add edge from @p i (on the left side) to @p j (on the right side) */
36 FIRM_API void bipartite_add(bipartite_t *gr, int i, int j);
37 /** Remove edge from @p i (on the left side) to @p j (on the right side) */
38 FIRM_API void bipartite_remv(bipartite_t *gr, int i, int j);
39 /** Return 1 if edge from @p i (on the left side) to @p j (on the right side)
40 * exists, 0 otherwise */
41 FIRM_API int bipartite_adj(const bipartite_t *gr, int i, int j);
42 /** Solve bipartite matching problem */
43 FIRM_API void bipartite_matching(const bipartite_t *gr, int *matching);
46 * Dumps a bipartite graph to a file stream.
48 FIRM_API void bipartite_dump_f(FILE *f, const bipartite_t *gr);
51 * Dumps a bipartite graph to file name.
53 FIRM_API void bipartite_dump(const char *name, const bipartite_t *gr);
59 #endif /* _BIPARTITE_H */