anyone interested to discuss about the last question in ACM this year? <Tunnels
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 20 楼,当前显示第 20 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:房间 (等级:2 - 初出茅庐,发帖:21) 发表:2007-10-16 01:15:55  20楼 
这样可以么?for each node v perform a maximal flow between v and 0 to obtain the minimal cut (=mc); set the key of v to mc and insert it into a Fibonacci heap h; end while(true) v = h.extract_min(); (based on the key) remove v and all edges incident on v; if(node 1 is disconnected from node 0) return v.key; end end
I have revised the solution.
for each node, store a number which is initialized to be the number of edges incident on that node. For node 0 (which represents outside), the number is infinity. we denote the number as node.mc.


changed = true;
while(changed)
{
changed = false;
for_each(node n in the graph except node 0)
{
sort n's adjacent nodes based on mc (from large to small).
k = 0; k1 = 0; prev_node = null;
for_each(node adj_n in the sorted adjacent nodes n)
{
if(adj_n.mc + k < n.mc)
{
n.mc = k + adj_n.mc;
changed = true;
}
k1 += number of edges between adj_n and n;
if(prev_node.mc > adj_n.mc)
{
k = k1;
}
prev_node = adj_n;
}
}
}

return node1.mc;
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 20 楼,当前显示第 20 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码