由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - 算法问题
相关主题
mysql index优化求助 (转载)图像registration问题
请教一个搜索问题有没有办法针对某个方向做滤波
DAG question[转载] 我也问一道题
Efficient duplicate filtering for stream请教minimum set cover Problem
求教一个算法题.问一个NPC 的问题
问:关于调用节点和cpu数目的关系,谢谢 (转载)[合集] How about in-memory OS and Database?
有人set up过 多个node的Cassandra 么?哪里可以看到 #P-complete 问题的列表?
怎样判断两个时间序列的相似度@@ Hard drive problem - 大家帮忙看看还有办法吗?
相关话题的讨论汇总
话题: nodes话题: edges话题: weight话题: node话题: whose
进入CS版参与讨论
1 (共1页)
a***a
发帖数: 149
1
【 以下文字转载自 JobHunting 讨论区 】
发信人: tidybear (tidybear1), 信区: JobHunting
标 题: 算法问题
发信站: BBS 未名空间站 (Fri May 2 17:25:14 2008)
一个图,node有三种状态,0,1,-1,每个边有weight,现在找到状态为0的node,把它转
化为1或者-1,使得该图所有weight的总和最大。每条边weight=node1状态*node2状态*
weight。是不是贪婪算法?多谢.
m********7
发帖数: 37
2
m********7
发帖数: 37
3
No, greedy algorithm does not work.
As it exhibits the sub-structure property, you can use dynamic programming
technique to solve it in O(m) time, where m is the number of edges.
Give me email and I can send you the solution.
h*******e
发帖数: 225
4
h*******[email protected]. Thanks!

【在 m********7 的大作中提到】
: No, greedy algorithm does not work.
: As it exhibits the sub-structure property, you can use dynamic programming
: technique to solve it in O(m) time, where m is the number of edges.
: Give me email and I can send you the solution.

m********7
发帖数: 37
5
"现在找到状态为0的node", which implies that we can not re-set the node whose
values are 1 or -1, right? i.e., we are allowed to change the value 0?
t******r
发帖数: 209
6
yes, exactly.
my email is w********[email protected], thanks.
t******r
发帖数: 209
7
yes, exactly.
my email is w********[email protected], thanks.
m********7
发帖数: 37
8
Max sum of all edges
= max {sum of all edges whose two nodes are positive (1)
+ sum of all edges whose two nodes are negative (2)
- sum of all edges whose two nodes are positive and negative (3)}
As we are allowed to change all 0 nodes, then the problem is reduced to how
to find the max radius from all negative nodes. Acrossing the next edge,
all nodes will be positive. So we only consider (2) and (3).
For any negative node, u, we let d the distance between u to v where v is a
positive and all
c*****t
发帖数: 1879
9
I think that this problem is NPC (similar to hypergraph partitioning).
I don't quite understand you solution, but here is a possible counter
example for your algorithm:
+ -
\ /
0 0
\ /
0-0-0
/ \
0 0
/ \
+ -
All edges in the graph have the weight of 1. One of the optimal
solutions to this graph is to have all nodes to the left of the
center one as + and all the nodes to the right as -.

how
a

【在 m********7 的大作中提到】
: Max sum of all edges
: = max {sum of all edges whose two nodes are positive (1)
: + sum of all edges whose two nodes are negative (2)
: - sum of all edges whose two nodes are positive and negative (3)}
: As we are allowed to change all 0 nodes, then the problem is reduced to how
: to find the max radius from all negative nodes. Acrossing the next edge,
: all nodes will be positive. So we only consider (2) and (3).
: For any negative node, u, we let d the distance between u to v where v is a
: positive and all

m********7
发帖数: 37
10
If you use FFT, you can solve it also efficiently. It should be no worse
than DP method and more elegant.
m********7
发帖数: 37
11
If you use FFT, you can solve it also efficiently. It should be no worse
than DP method and more elegant.
h*******e
发帖数: 225
12
how to use FFT to solve it?

【在 m********7 的大作中提到】
: If you use FFT, you can solve it also efficiently. It should be no worse
: than DP method and more elegant.

1 (共1页)
进入CS版参与讨论
相关主题
@@ Hard drive problem - 大家帮忙看看还有办法吗?求教一个算法题.
请教背包问题。问:关于调用节点和cpu数目的关系,谢谢 (转载)
问高手一个分区的问题有人set up过 多个node的Cassandra 么?
算法好难阿,书能看懂,可是题都不会做怎样判断两个时间序列的相似度
mysql index优化求助 (转载)图像registration问题
请教一个搜索问题有没有办法针对某个方向做滤波
DAG question[转载] 我也问一道题
Efficient duplicate filtering for stream请教minimum set cover Problem
相关话题的讨论汇总
话题: nodes话题: edges话题: weight话题: node话题: whose