小札 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 ...
随机推荐
- DB事物
1.事物概念:一组逻辑操作单元 始数据从一种状态变换到另一种状态事物处理:所有事物 都作为一个工作单元来执行 , 即使出现了故障 都不能改变这种执行方式, commint提交之后 这些修改就永久的保存 ...
- Kubernetes(k8s)使用ingress发布服务
目录 一.系统环境 二.前言 三.Kubernetes ingress简介 四.Ingress vs NodePort vs LoadBalancer 五.安装部署Nginx Ingress Cont ...
- CKS 考试题整理 (01)-NetworkPolicy
Task 创建一个名为 pod-restriction 的 NetworkPolicy 来限制对在 namespace dev-team 中运行的 Pod products-service 的访问. ...
- JavaWeb中Servlet、web应用和web站点的路径细节("/"究竟代表着什么)
JavaWeb中Servlet.web应用和web站点的路径细节("/"究竟代表着什么) 1 开门见山 新建一个tomcat web项目,配置tomcat的虚拟目录,取默认值(/项 ...
- 记一次 .NET 在线客服系统同时支持 SQL Server 和 MySQL 没卡死分析
前段时间我发表了一系列文章,开始介绍基于 .net core 的在线客服系统开发过程. 有很多朋友一直提出希望能够支持 MySQL 数据库,考虑到已经有朋友在用 SQL Server,我在升级的过程中 ...
- CF1794C Scoring Subsequences题解
文中 \(a\) 为题目中给的 \(a\). 如果我们要求 \(a_1, a_2, a_3, \dots, a_m\) 的结果, 那么我们可以把 \(a\) 数组从后往前依次除以 \(i\),\(i\ ...
- CF961E Tufurama题解
我们维护一个存储下标数据的树状数组,先将 \(1\sim n\) 插入树状数组. 用 \(a\) 表示原数组,\(b\) 表示按照 \(a_i\) 排序后的数组. 我们从 \(1\) 开始统计,直到 ...
- 【Python】Beautiful Soup
简介 Beautiful Soup 对象 我全部使用soup表示: Beautiful Soup 简介: 简单来说,Beautiful Soup是python的一个库,最主要的功能是从网页抓取数据. ...
- TreeMap运行错误
Exception in thread "main" java.lang.ClassCastException: Day16_TreeMap.Star cannot be cast ...
- Abaqus添加初始缺陷
主要介绍通过施加节点位移的方法 步骤一: 复制model,新建Step,static linear perturbation Tools->Analytical Field 定义场函数,例如:A ...