亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? graph.h

?? 學習跟蹤的好程序
?? H
字號:
/* graph.h */
/*
	This software library implements the maxflow algorithm
	described in

		An Experimental Comparison of Min-Cut/Max-Flow Algorithms
		for Energy Minimization in Vision.
		Yuri Boykov and Vladimir Kolmogorov.
		In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 
		September 2004

	This algorithm was developed by Yuri Boykov and Vladimir Kolmogorov
	at Siemens Corporate Research. To make it available for public use,
	it was later reimplemented by Vladimir Kolmogorov based on open publications.

	If you use this software for research purposes, you should cite
	the aforementioned paper in any resulting publication.
*/

/*
	Copyright 2001 Vladimir Kolmogorov (vnk@cs.cornell.edu), Yuri Boykov (yuri@csd.uwo.ca).

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


/*
	For description, example usage, discussion of graph representation
	and memory usage see README.TXT.
*/

#ifndef __GRAPH_H__
#define __GRAPH_H__

#include "block.h"

/*
	Nodes, arcs and pointers to nodes are
	added in blocks for memory and time efficiency.
	Below are numbers of items in blocks
*/
#define NODE_BLOCK_SIZE 512
#define ARC_BLOCK_SIZE 1024
#define NODEPTR_BLOCK_SIZE 128

class Graph
{
public:
	typedef enum
	{
		SOURCE	= 0,
		SINK	= 1
	} termtype; /* terminals */

	/* Type of edge weights.
	   Can be changed to char, int, float, double, ... */
	//typedef short captype;
	typedef float captype;

	/* Type of total flow */
	//typedef int flowtype;
	typedef float flowtype;

	typedef void * node_id;

	/* interface functions */

	/* Constructor. Optional argument is the pointer to the
	   function which will be called if an error occurs;
	   an error message is passed to this function. If this
	   argument is omitted, exit(1) will be called. */
	Graph(void (*err_function)(char *) = NULL);

	/* Destructor */
	~Graph();

	/* Adds a node to the graph */
	node_id add_node();

	/* Adds a bidirectional edge between 'from' and 'to'
	   with the weights 'cap' and 'rev_cap' */
	void add_edge(node_id from, node_id to, captype cap, captype rev_cap);

	/* Sets the weights of the edges 'SOURCE->i' and 'i->SINK'
	   Can be called at most once for each node before any call to 'add_tweights'.
	   Weights can be negative */
	void set_tweights(node_id i, captype cap_source, captype cap_sink);

	/* Adds new edges 'SOURCE->i' and 'i->SINK' with corresponding weights
	   Can be called multiple times for each node.
	   Weights can be negative */
	void add_tweights(node_id i, captype cap_source, captype cap_sink);

	/* After the maxflow is computed, this function returns to which
	   segment the node 'i' belongs (Graph::SOURCE or Graph::SINK) */
	termtype what_segment(node_id i);

	/* Computes the maxflow. Can be called only once. */
	flowtype maxflow();

/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
	
private:
	/* internal variables and functions */

	struct arc_forward_st;
	struct arc_reverse_st;

#define IS_ODD(a) ((int)(a) & 1)
#define MAKE_ODD(a)  ((arc_forward *) ((int)(a) | 1))
#define MAKE_EVEN(a) ((arc_forward *) ((int)(a) & (~1)))
#define MAKE_ODD_REV(a)  ((arc_reverse *) ((int)(a) | 1))
#define MAKE_EVEN_REV(a) ((arc_reverse *) ((int)(a) & (~1)))

	/* node structure */
	typedef struct node_st
	{
		/*
			Usually i->first_out is the first outgoing
			arc, and (i+1)->first_out-1 is the last outgoing arc.
			However, it is not always possible, since
			arcs are allocated in blocks, so arcs corresponding
			to two consecutive nodes may be in different blocks.

			If outgoing arcs for i are last in the arc block,
			then a different mechanism is used. i->first_out
			is odd in this case; the first outgoing arc
			is (a+1), and the last outgoing arc is
			((arc_forward *)(a->shift))-1, where
			a = (arc_forward *) (((char *)(i->first_out)) + 1);

			Similar mechanism is used for incoming arcs.
		*/
		arc_forward_st	*first_out;	/* first outcoming arc */
		arc_reverse_st	*first_in;	/* first incoming arc */

		arc_forward_st	*parent;	/* describes node's parent
									   if IS_ODD(parent) then MAKE_EVEN(parent) points to 'arc_reverse',
									   otherwise parent points to 'arc_forward' */

		node_st			*next;		/* pointer to the next active node
									   (or to itself if it is the last node in the list) */

		int				TS;			/* timestamp showing when DIST was computed */
		int				DIST;		/* distance to the terminal */
		short			is_sink;	/* flag showing whether the node is in the source or in the sink tree */

		captype			tr_cap;		/* if tr_cap > 0 then tr_cap is residual capacity of the arc SOURCE->node
									   otherwise         -tr_cap is residual capacity of the arc node->SINK */
	} node;

	/* arc structures */
#define NEIGHBOR_NODE(i, shift) ((node *) ((char *)(i) + (shift)))
#define NEIGHBOR_NODE_REV(i, shift) ((node *) ((char *)(i) - (shift)))
	typedef struct arc_forward_st
	{
		int				shift;		/* node_to = NEIGHBOR_NODE(node_from, shift) */
		captype			r_cap;		/* residual capacity */
		captype			r_rev_cap;	/* residual capacity of the reverse arc*/
	} arc_forward;

	typedef struct arc_reverse_st
	{
		arc_forward		*sister;	/* reverse arc */
	} arc_reverse;

	/* 'pointer to node' structure */
	typedef struct nodeptr_st
	{
		node_st			*ptr;
		nodeptr_st		*next;
	} nodeptr;

	typedef struct node_block_st
	{
		node					*current;
		struct node_block_st	*next;
		node					nodes[NODE_BLOCK_SIZE];
	} node_block;

#define last_node LAST_NODE.LAST_NODE

	typedef struct arc_for_block_st
	{
		char					*start;		/* the actual start address of this block.
											   May be different from 'this' since 'this'
											   must be at an even address. */
		arc_forward				*current;
		struct arc_for_block_st	*next;
		arc_forward				arcs_for[ARC_BLOCK_SIZE]; /* all arcs must be at even addresses */
		union
		{
			arc_forward			dummy;
			node				*LAST_NODE;	/* used in graph consruction */
		}						LAST_NODE;
	} arc_for_block;

	typedef struct arc_rev_block_st
	{
		char					*start;		/* the actual start address of this block.
											   May be different from 'this' since 'this'
											   must be at an even address. */
		arc_reverse				*current;
		struct arc_rev_block_st	*next;
		arc_reverse				arcs_rev[ARC_BLOCK_SIZE]; /* all arcs must be at even addresses */
		union
		{
			arc_reverse			dummy;
			node				*LAST_NODE;	/* used in graph consruction */
		}						LAST_NODE;
	} arc_rev_block;

	node_block			*node_block_first;
	arc_for_block		*arc_for_block_first;
	arc_rev_block		*arc_rev_block_first;
	DBlock<nodeptr>		*nodeptr_block;

	void	(*error_function)(char *);	/* this function is called if a error occurs,
										   with a corresponding error message
										   (or exit(1) is called if it's NULL) */

	flowtype			flow;		/* total flow */

/***********************************************************************/

	node				*queue_first[2], *queue_last[2];	/* list of active nodes */
	nodeptr				*orphan_first, *orphan_last;		/* list of pointers to orphans */
	int					TIME;								/* monotonically increasing global counter */

/***********************************************************************/

	/* functions for processing active list */
	void set_active(node *i);
	node *next_active();

	void prepare_graph();
	void maxflow_init();
	void augment(node *s_start, node *t_start, captype *cap_middle, captype *rev_cap_middle);
	void process_source_orphan(node *i);
	void process_sink_orphan(node *i);
};

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜视频在线观看一区二区三区 | 国产精品久久久久四虎| 91论坛在线播放| 久久精品国产99久久6| 韩国v欧美v日本v亚洲v| 亚洲精品视频在线看| 久久午夜国产精品| 欧美日韩一区精品| 91在线观看污| 成人深夜在线观看| 国产呦萝稀缺另类资源| 三级不卡在线观看| 一区二区三区国产精品| 国产清纯美女被跳蛋高潮一区二区久久w | www.亚洲免费av| 看电视剧不卡顿的网站| 亚洲第一综合色| 亚洲欧美激情插| 国产精品国产三级国产a | 久久蜜臀中文字幕| 欧美一区二区三区播放老司机| 日本乱人伦一区| 99riav久久精品riav| 成人久久久精品乱码一区二区三区| 激情综合色播五月| 男人操女人的视频在线观看欧美 | 激情综合网激情| 奇米一区二区三区| 三级影片在线观看欧美日韩一区二区 | 亚洲视频在线观看一区| 国产欧美综合在线| 欧美xfplay| 欧美一区二区三区免费视频| 欧美色图一区二区三区| 在线观看网站黄不卡| 色婷婷久久久综合中文字幕| 91美女片黄在线| 95精品视频在线| 久久精品视频在线免费观看| 久久久影视传媒| 久久久久国色av免费看影院| 久久精品免费在线观看| 国产午夜亚洲精品理论片色戒| 精品理论电影在线观看| 久久久综合激的五月天| 久久久午夜电影| 国产精品伦理一区二区| 国产精品乱子久久久久| 亚洲人成网站影音先锋播放| 一区二区日韩av| 亚洲一区日韩精品中文字幕| 亚洲高清久久久| 男人的j进女人的j一区| 激情综合色播激情啊| 丁香啪啪综合成人亚洲小说| 不卡av在线网| 欧美在线|欧美| 欧美一级黄色片| 日韩美女一区二区三区| 国产片一区二区| 亚洲精品视频一区| 午夜精品视频一区| 久久精品国产色蜜蜜麻豆| 国产精品一区二区三区乱码| 福利91精品一区二区三区| 一本到一区二区三区| 欧美日精品一区视频| 日韩精品专区在线| 国产精品夫妻自拍| 亚洲成a人v欧美综合天堂下载 | 蜜桃精品在线观看| 7777精品伊人久久久大香线蕉 | 久久久精品人体av艺术| 国产精品久99| 一区二区三区四区精品在线视频 | 狠狠色2019综合网| 9人人澡人人爽人人精品| 欧美日韩中文精品| 精品久久久久一区二区国产| 国产精品久久免费看| 日韩精品91亚洲二区在线观看| 国产一区二区在线视频| 欧美亚洲动漫精品| 国产丝袜美腿一区二区三区| 亚洲图片一区二区| 国产91高潮流白浆在线麻豆| 欧美高清一级片在线| 国产欧美日韩另类视频免费观看| 一级女性全黄久久生活片免费| 精品一区二区三区蜜桃| 色域天天综合网| 久久这里只有精品首页| 亚洲一级片在线观看| 国产白丝精品91爽爽久久| 欧美日韩国产精品成人| 国产精品白丝在线| 久久国产精品99精品国产| 欧美性生活久久| 国产精品天天摸av网| 美女性感视频久久| 欧美视频三区在线播放| 欧美国产精品中文字幕| 久久精品999| 91久久奴性调教| 国产精品视频一二三区| 精品一区二区免费视频| 欧美日韩成人综合天天影院| 成人免费在线视频| 国产一区二区三区不卡在线观看| 欧美日韩国产一区| 国产乱对白刺激视频不卡| 在线不卡的av| 夜夜嗨av一区二区三区网页| 成人av免费在线观看| 久久精品综合网| 精品在线免费视频| 日韩一区二区在线观看视频| 亚洲国产色一区| 一本大道久久精品懂色aⅴ| 国产精品网站在线| 成人亚洲一区二区一| 久久综合久久鬼色| 看电视剧不卡顿的网站| 欧美一级日韩一级| 美女视频网站久久| 99久久综合国产精品| 国产日产精品1区| 精品一区二区三区免费视频| 欧美一二三区精品| 蜜臂av日日欢夜夜爽一区| 欧美日韩国产三级| 午夜精品免费在线| 56国语精品自产拍在线观看| 亚洲国产日日夜夜| 欧美精品成人一区二区三区四区| 一区二区三区高清在线| 91麻豆免费在线观看| 亚洲精品国产品国语在线app| 91麻豆精东视频| 亚洲免费av高清| 欧美在线免费播放| 五月天激情小说综合| 91精品在线免费| 美女视频网站黄色亚洲| 精品国产电影一区二区| 国产黄色91视频| 国产精品女人毛片| 91色视频在线| 亚洲福利一区二区三区| 91精品国产欧美一区二区18| 欧美色爱综合网| 亚洲电影视频在线| 日韩欧美资源站| 激情综合色播激情啊| 欧美激情在线观看视频免费| 国产69精品久久久久毛片| 亚洲色欲色欲www| 欧美性受极品xxxx喷水| 美国十次综合导航| 国产欧美日韩亚州综合| 91丨porny丨国产| 天天综合网 天天综合色| 精品久久国产老人久久综合| 高清国产一区二区三区| 综合av第一页| 在线不卡一区二区| 国产精品一区二区x88av| 亚洲欧美经典视频| 日韩一二三区视频| 成人国产精品免费观看| 亚洲一区二区偷拍精品| www国产精品av| 91丝袜美腿高跟国产极品老师| 日韩经典一区二区| 国产精品麻豆99久久久久久| 欧美日韩精品一区二区三区 | 欧美大片免费久久精品三p| 国产高清在线观看免费不卡| 亚洲精品中文在线影院| 精品欧美久久久| 成人高清免费在线播放| 午夜亚洲国产au精品一区二区| 久久精品亚洲乱码伦伦中文 | 成人国产一区二区三区精品| 亚洲成av人片在线观看无码| 久久理论电影网| 欧美视频在线观看一区| 国产98色在线|日韩| 亚洲午夜私人影院| 久久综合久久久久88| 欧美午夜片在线看| 国产a久久麻豆| 青娱乐精品视频在线| 最新日韩av在线| 欧美岛国在线观看| 欧美三级视频在线播放| 成人av网址在线观看| 激情综合网天天干| 午夜精品一区在线观看| 亚洲欧美视频一区|