亚洲欧美第一页_禁久久精品乱码_粉嫩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;
	/* Type of total flow */
	typedef int 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_st;

	/* node structure */
	typedef struct node_st
	{
		arc_st			*first;		/* first outcoming arc */

		arc_st			*parent;	/* node's parent */
		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 structure */
	typedef struct arc_st
	{
		node_st			*head;		/* node the arc points to */
		arc_st			*next;		/* next arc with the same originating node */
		arc_st			*sister;	/* reverse arc */

		captype			r_cap;		/* residual capacity */
	} arc;

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

	Block<node>			*node_block;
	Block<arc>			*arc_block;
	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 maxflow_init();
	void augment(arc *middle_arc);
	void process_source_orphan(node *i);
	void process_sink_orphan(node *i);
};

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产在线一| 中文字幕一区二区不卡| 一区二区三区影院| 9久草视频在线视频精品| 国产欧美在线观看一区| 成人a区在线观看| 亚洲一区在线观看视频| 精品人在线二区三区| 国产精品亚洲а∨天堂免在线| 国产精品毛片久久久久久| 欧美日韩精品电影| 久久99国产乱子伦精品免费| 日本一区二区三区在线观看| 国产精品―色哟哟| 国产精品第一页第二页第三页| 欧美精品日韩精品| 成人美女视频在线观看| 婷婷丁香激情综合| 国产精品入口麻豆原神| 亚洲欧美日韩国产中文在线| 日韩写真欧美这视频| 色婷婷综合久久久久中文一区二区 | 久久精品国产久精国产爱| 中文字幕一区三区| 亚洲欧美日韩精品久久久久| 石原莉奈一区二区三区在线观看| 精品一区二区三区蜜桃| 国产mv日韩mv欧美| 久久成人久久爱| 成人激情校园春色| 欧美日韩国产综合一区二区| 精品人伦一区二区色婷婷| 中文字幕在线播放不卡一区| 日韩中文字幕不卡| 成人白浆超碰人人人人| 777色狠狠一区二区三区| 在线视频你懂得一区二区三区| 国产精品乡下勾搭老头1| 欧美在线一二三| 久久免费电影网| 日韩欧美在线网站| 最新中文字幕一区二区三区| 美女视频一区二区三区| 麻豆精品视频在线| 欧洲色大大久久| 中文一区二区完整视频在线观看| 久久久国产精品午夜一区ai换脸| 亚洲一区欧美一区| 成人av资源在线观看| 精品国产青草久久久久福利| 欧美精品一区二区三| 一区二区三区四区视频精品免费| 国产福利精品导航| 色综合久久中文字幕综合网| 国产欧美日韩麻豆91| 日本不卡一区二区三区高清视频| 亚洲国产另类av| 蜜桃av一区二区三区电影| 91啪亚洲精品| 欧美精品v国产精品v日韩精品| 亚洲欧美偷拍三级| 粉嫩嫩av羞羞动漫久久久 | 色久综合一二码| 精品视频在线免费观看| 日韩一区二区三区四区五区六区| 亚洲一区二区影院| 欧美在线三级电影| 亚洲一区二区五区| 欧美亚洲国产怡红院影院| 日韩一级片网址| 久久av中文字幕片| 欧美成人a∨高清免费观看| 午夜成人在线视频| 在线不卡免费av| 香港成人在线视频| 成人aa视频在线观看| 国产欧美日韩另类一区| 高清av一区二区| 中文字幕中文在线不卡住| a亚洲天堂av| 亚洲一区二区三区在线播放 | 亚洲成人先锋电影| 欧美视频中文一区二区三区在线观看| 亚洲欧美乱综合| 欧美特级限制片免费在线观看| 天天色综合成人网| 日韩一级二级三级| 国产美女在线观看一区| 欧美午夜精品一区| 日韩电影在线观看网站| 精品91自产拍在线观看一区| 国产一区二区视频在线| 中文字幕一区二区三区在线观看| 国产电影精品久久禁18| 国产亚洲1区2区3区| 久久精品国产久精国产爱| 色视频一区二区| 亚洲香蕉伊在人在线观| 欧美视频一区二区| 日本一区中文字幕| 久久久精品日韩欧美| 99久久久无码国产精品| 精品国产1区2区3区| 成人黄色软件下载| 天堂蜜桃一区二区三区| 精品久久人人做人人爽| 91在线视频免费观看| 日韩电影在线免费看| 国产精品理伦片| 欧美一区二区三区日韩视频| 亚洲成人激情av| 精品少妇一区二区三区在线播放 | 日韩免费成人网| 午夜视频在线观看一区二区三区| 日韩一级片在线观看| 一本久久a久久免费精品不卡| 奇米一区二区三区av| 亚洲三级电影网站| 色综合久久久久久久久久久| 秋霞电影一区二区| 亚洲精品日产精品乱码不卡| 91网站最新网址| 国产一区二区伦理| 天堂久久久久va久久久久| 国产精品麻豆欧美日韩ww| 日韩欧美亚洲国产精品字幕久久久| 波多野结衣亚洲一区| 麻豆久久久久久| 视频一区国产视频| 一区二区三区四区在线| 国产精品传媒入口麻豆| 久久亚洲二区三区| 成人免费看的视频| 狠狠色狠狠色综合| 国产精品拍天天在线| 精品久久99ma| 欧美疯狂性受xxxxx喷水图片| 色偷偷成人一区二区三区91| 国产成人激情av| 国产福利一区二区三区视频| 蜜臀久久久久久久| 日本女优在线视频一区二区| 亚洲国产精品一区二区久久恐怖片| 亚洲欧洲日韩在线| 国产精品动漫网站| 1000精品久久久久久久久| 欧美国产日韩亚洲一区| 国产网站一区二区三区| 日本一区免费视频| 国产目拍亚洲精品99久久精品| 欧美成人精品高清在线播放| 日韩亚洲欧美一区| 日韩欧美激情在线| 久久久亚洲精品石原莉奈| 久久午夜色播影院免费高清 | 色婷婷一区二区| 色综合色综合色综合色综合色综合| 99这里只有精品| 91麻豆免费视频| 欧美精品在线一区二区三区| 欧美乱熟臀69xxxxxx| 日韩欧美美女一区二区三区| 久久综合999| 日韩一区日韩二区| 亚洲电影中文字幕在线观看| 日韩av电影天堂| 国产剧情一区二区三区| 成人免费看黄yyy456| 欧美午夜精品久久久久久孕妇| 欧美日韩国产电影| 精品国产露脸精彩对白| 欧美激情一区在线| 一区二区三区免费| 美女精品一区二区| 成人精品视频.| 欧美群妇大交群中文字幕| 日韩欧美黄色影院| 亚洲视频免费在线| 日本欧洲一区二区| 国产成人精品网址| 欧美日韩综合在线| 精品国产一区二区精华| 综合中文字幕亚洲| 蜜桃视频第一区免费观看| 成人高清伦理免费影院在线观看| 欧美日精品一区视频| 国产色综合一区| 午夜国产不卡在线观看视频| 国产毛片一区二区| 欧洲精品中文字幕| 国产精品视频一二三区| 日本免费新一区视频| 色综合天天做天天爱| 国产精品自在欧美一区| 色婷婷av一区二区三区大白胸| 日韩丝袜情趣美女图片| 一区二区日韩电影| 高清成人在线观看| 欧美videos大乳护士334| 亚洲精品日日夜夜|