applied fftw patch from P.Martin
[swftools.git] / lib / graphcut.h
blob9b15a44cbe90ae069c58dcdd361581f044535d5e
1 /*
2 graphcut- a graphcut implementation based on the Boykov Kolmogorov algorithm
4 Part of the swftools package.
6 Copyright (c) 2007,2008,2009 Matthias Kramm <kramm@quiss.org>
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __graphcut_h__
22 #define __graphcut_h__
24 typedef signed int weight_t;
26 typedef struct _halfedge halfedge_t;
27 typedef struct _node node_t;
28 typedef struct _graph graph_t;
30 struct _halfedge {
31 node_t*node;
32 struct _halfedge*fwd;
33 weight_t weight;
34 weight_t init_weight;
35 char used;
36 halfedge_t*next;
39 struct _node {
40 halfedge_t*edges;
41 union {
42 int tmp;
43 int component;
44 int color;
46 int nr;
49 struct _graph {
50 node_t* nodes;
51 int num_nodes;
54 graph_t* graph_new(int num_nodes);
55 halfedge_t*graph_add_edge(node_t*from, node_t*to, weight_t forward_weight, weight_t backward_weight);
56 weight_t graph_maxflow(graph_t*graph, node_t*pos1, node_t*pos2);
57 int graph_find_components(graph_t*g);
58 void graph_delete(graph_t*);
60 #endif