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:

\[V_N=V\cup\{s,t\} \\
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的更多相关文章

  1. CF1249F Maximum Weight Subset

    CF1249F Maximum Weight Subset 洛谷评测传送门 题目描述 You are given a tree, which consists of nn vertices. Reca ...

  2. Codeforces 1249F Maximum Weight Subset (贪心)

    题意 在一颗有点权的树上,选若干个点,使得这些点两两距离大于k,且点权和最大 思路 贪心的取比较大的值即可 将所有点按照深度从大到小排序,如果当前点点权\(a[i]\)大于0,则将距离为k以内的所有点 ...

  3. PC端一些非经典兼容性问题小札

    IE10默认在input框中输入内容后会显示一个‘X’按钮,方便删除输入的所有内容. 在password输入框显示一个眼睛的按钮,去掉叉叉和眼睛的方法如下: ::-ms-clear { display ...

  4. Python小札

    在Python中,等号(=)是赋值语句,可以把任意数据类型赋值给变量,同一个变量可以反复赋值,而且可以是不同类型的变量如: a = 123 #a是整数 print(a) a = 'ABC' #a变为字 ...

  5. codeforces#1249F. Maximum Weight Subset(树上dp)

    题目链接: http://codeforces.com/contest/1249/problem/F 题意: 一棵树的每个节点有个权值,选择一个节点集,使得任意点对的距离大于$k$ 求最大节点集权值, ...

  6. Codeforces 1249 F. Maximum Weight Subset

    传送门 设 $f[x][i]$ 表示 $x$ 的子树中,离 $x$ 最近的选择的节点距离为 $i$ 的合法方案的最大价值 设 $val[x]$ 表示节点 $x$ 的价值,首先有 $f[x][0]=va ...

  7. 【CF1249F】Maximum Weight Subset(贪心)

    题意:给定一棵n个点带点权的树,要求从中选出一个点集,使得这些点两两之间距离都大于K,求最大点权和 n,K<=2e2,1<=a[i]<=1e5 思路:树形DP显然可做,极限是n方,然 ...

  8. F. Maximum Weight Subset(贪心or树形dp解法)

    题:https://codeforces.com/contest/1249/problem/F 题意:给一颗树,边权为1,节点有点权,问取到一个点集,俩俩之间路径超过k,是点权和最大 思路:贪心地取点 ...

  9. 2016 Multi-University Training Contest 9 solutions BY 金策工业综合大学

    A Poor King Tag: Reversed BFS Preprocessing is needed to calculate answers for all positions (states ...

  10. CF1082D:Maximum Diameter Graph (简单构造)

    Graph constructive problems are back! This time the graph you are asked to build should match the fo ...

随机推荐

  1. 如何安装旧版本的 R 包

    由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接. 我们在安装 R 包的时候,经常会发现某个最新的包与当前 R 的版本不兼容. > inst ...

  2. Microsoft R 和 Open Source R,哪一个才最适合你?

    由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接. R 是一个开源统计软件,在分析领域普及的非常快. 在过去几年中,无论业务规模如何,很多公司都采 ...

  3. 记一次 .NET 某药材管理系统 卡死分析

    一:背景 1. 讲故事 前段时间有位朋友找到我,说他们在查询报表的时候发现程序的稳定性会受到影响,但服务器的内存,CPU都是正常的,让我帮忙看下怎么回事,问了下程序的稳定性指的是什么?指的是卡死,那既 ...

  4. Dlang 并行化

    Dlang 并行化 好难受,dlang 生态太差,没办法,学了半天才明白. 我尽量以精炼的语言解释. 采用 定义,例子(代码),解释 的步骤讲解. 所以你可能看到很多代码,一点解释-- 我会省略一些 ...

  5. List 接口及其常用方法

    List 接口基本介绍 List接口是Collection接口的子接口,其主要特点如下: List中元素有序,是按照元素的插入顺序进行排序的.每个元素都有一个与之关联的整数型索引(索引从 0 开始), ...

  6. [随笔]记一此更新win10后mysql服务消失的问题

    十几天前系统自动更新 没在意 几天前用php连mysql的时候 报错 Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] 由于目标计算 ...

  7. CodeTON Round 5 (Div. 1 + Div. 2, Rated, Prizes!) A-E

    比赛链接 A 代码 #include <bits/stdc++.h> using namespace std; using ll = long long; bool solve() { i ...

  8. 向量数据库Faiss的搭建与使用

    向量数据库Faiss是Facebook AI研究院开发的一种高效的相似性搜索和聚类的库.它能够快速处理大规模数据,并且支持在高维空间中进行相似性搜索.本文将介绍如何搭建Faiss环境并提供一个简单的使 ...

  9. unity协程(IEnumerator)开始和结束

    快速阅览: 一.结束协程无效:协程方法需要单独存一份地址,在开始和结束不直接传入方法名,而是使用这份保存的地址进行开始和结束. 二.再次开启协程时少跑了几行代码:再次开始同一个方法名的协程时,不是从第 ...

  10. 通信原理知识点总结(XDU网信通原)

    因为感觉第2章和第7章内容特别乱,当时老师讲的时候好像也没有按照一个正确的顺序来讲,所以我就把这两部分的内容按照结构顺序整理了一下,这样更便于理解和记忆 第2章 无线信道传输特性 显示不全点链接看完整 ...