小札 Maximum Weight Closure of a Graph
1. Introduction
Define a closure of a directed graph \(G=(V,E)\) as an induced set of vertexes of \(G\), where the out-tended edges in \(E\) start at some vertex in the closure of \(G\) and end at some vertex in the closure, too. More formally, closure is defined as a set of vertexes \(V'\subseteq V\), such that \(\forall u\in V',s.t.\forall\left<u,v\right>\in E,v\in V'\).
For the Maximum Weight Closure of a Graph, we define it as, with starting out endowing vertexes in \(V'\) costs called \(w_u\), the maximum value of \(\sum\limits_{u\in V'}w_u\).
2. Construction of Algorithm
Add a source \(s\) and a sink \(t\) to the original graph, endow the origin edges in \(E\) with capacities that \(+\infty\), and connect \(s\) with points with positive costs with the points' costs as capacities on them while \(t\) connects to those with negative costs with the minus points' costs as capacities on them, where \(+\infty\) is defined as any number greater or equal to \(\sum |w_i|\).
More formally, as explained & illustrated:
E_N=E\cup\left\{\left<s,v\right>\mid v\in V,w_v\geqslant0\right\}\cup\left\{\left<v,t\right>\mid v\in V,w_v<0\right\} \\
\begin{cases}
c(u,v)=+\infty,\left<u,v\right>\in E \\
\displaystyle
c(s,v)=w_v,w_v\geqslant0 \\
\displaystyle
c(v,t)=-w_v,w_v<0
\end{cases}
\]
Which make it easy to understand the answer would be \(\text{min-cut}(G_N=\{V_N,E_N\})\).
[1] Referenced to 最小割模型在信息学竞赛中的应用 by 胡伯涛 Amber.
小札 Maximum Weight Closure of a Graph的更多相关文章
- CF1249F Maximum Weight Subset
CF1249F Maximum Weight Subset 洛谷评测传送门 题目描述 You are given a tree, which consists of nn vertices. Reca ...
- Codeforces 1249F Maximum Weight Subset (贪心)
题意 在一颗有点权的树上,选若干个点,使得这些点两两距离大于k,且点权和最大 思路 贪心的取比较大的值即可 将所有点按照深度从大到小排序,如果当前点点权\(a[i]\)大于0,则将距离为k以内的所有点 ...
- PC端一些非经典兼容性问题小札
IE10默认在input框中输入内容后会显示一个‘X’按钮,方便删除输入的所有内容. 在password输入框显示一个眼睛的按钮,去掉叉叉和眼睛的方法如下: ::-ms-clear { display ...
- Python小札
在Python中,等号(=)是赋值语句,可以把任意数据类型赋值给变量,同一个变量可以反复赋值,而且可以是不同类型的变量如: a = 123 #a是整数 print(a) a = 'ABC' #a变为字 ...
- codeforces#1249F. Maximum Weight Subset(树上dp)
题目链接: http://codeforces.com/contest/1249/problem/F 题意: 一棵树的每个节点有个权值,选择一个节点集,使得任意点对的距离大于$k$ 求最大节点集权值, ...
- Codeforces 1249 F. Maximum Weight Subset
传送门 设 $f[x][i]$ 表示 $x$ 的子树中,离 $x$ 最近的选择的节点距离为 $i$ 的合法方案的最大价值 设 $val[x]$ 表示节点 $x$ 的价值,首先有 $f[x][0]=va ...
- 【CF1249F】Maximum Weight Subset(贪心)
题意:给定一棵n个点带点权的树,要求从中选出一个点集,使得这些点两两之间距离都大于K,求最大点权和 n,K<=2e2,1<=a[i]<=1e5 思路:树形DP显然可做,极限是n方,然 ...
- F. Maximum Weight Subset(贪心or树形dp解法)
题:https://codeforces.com/contest/1249/problem/F 题意:给一颗树,边权为1,节点有点权,问取到一个点集,俩俩之间路径超过k,是点权和最大 思路:贪心地取点 ...
- 2016 Multi-University Training Contest 9 solutions BY 金策工业综合大学
A Poor King Tag: Reversed BFS Preprocessing is needed to calculate answers for all positions (states ...
- CF1082D:Maximum Diameter Graph (简单构造)
Graph constructive problems are back! This time the graph you are asked to build should match the fo ...
随机推荐
- MySQL之视图,索引,存储过程,触发器--实操
一.视图 什么是视图? 视图是一个虚拟表,其内容由查询定义. 同真实的表一样,视图包含系列带有名称的列和行数据. 行和列数据来自定义视图的查询所引用的表,并且在引用视图时动态生成. 简单的来说视图是由 ...
- Redis系列15:使用Stream实现消息队列(精讲)
Redis系列1:深刻理解高性能Redis的本质 Redis系列2:数据持久化提高可用性 Redis系列3:高可用之主从架构 Redis系列4:高可用之Sentinel(哨兵模式) Redis系列5: ...
- 前端vue uni-app基于uQRCode封装简单快速实用全端二维码生成插件
快速实现基于uQRCode封装简单快速实用全端二维码生成插件; 下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=12677 效果图 ...
- Java有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?
代码如下: public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out. ...
- Dapr 发布模糊测试报告|Dapr 完成模糊测试审核
Dapr 团队最近在博客上发布了 Dapr 完成模糊测试审核[1]的文章,该审计是 CNCF 通过模糊测试改善[2]开源云原生项目安全状况的计划的一部分.该审计由 Ada Logics[3] 于 20 ...
- 生成CSV文件的方法*(LIST集合为数据和生成的文件名)
/** * 生成csv文件 * @param pointsList 组织实体 * filename 生成的文件名 * list 要生成的数据 * @return */ public void Poin ...
- Flutter系列文章-Flutter基础
Flutter是Google推出的一种新的移动应用开发框架,允许开发者使用一套代码库同时开发Android和iOS应用.它的设计理念.框架结构.以及对Widget的使用,都让开发者能更有效率地创建高质 ...
- 信奥赛题1001:Hello,World!
这个题实在是太简单的了,无法比喻,直接付代码! //c++ #include<bits/stdc++.h> using namespace std; int main() { cout&l ...
- Linux Crontab 使用单行命令需要注意使用命令的绝对路径
crontab 中不支持||的写法,但是支持&&所以用 xxx ; [ $? -ne 0] && xxx的格式就没有问题. crontab 中环境变量与shell中不一 ...
- 写一段python下载商品图片的代码
以下是一个简单的Python代码示例,用于下载商品图片: import requests import os def download_image(url, save_path): response ...