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. 利用jira及confluence的API进行批量操作(查找/更新/导出/备份/删除等)

    前言: 近期因为某些原因需要批量替换掉 jira 和 confluence中的特定关键字,而且在替换前还希望进行备份(以便后续恢复)和导出(方便查看)atlassian官方的api介绍文档太简陋,很多 ...

  2. 如何同步更新 Github 上 Fork 的项目?

    Github Fork 过程概述 在 Github 上有很多优秀的开源项目,相信每一位热衷于技术的朋友都会在 Github 上 Fork 一些感兴趣的项目,然后在本地修改并提交.本文以 Galaxy ...

  3. Godot 4.0 遮罩一个2D物体,使其部分显示

    本文针对Godot 4.0. 我也查到了Godot 3.5如何实现遮罩,见这个链接 https://ask.godotengine.org/3031/how-do-i-mask-a-sprite 由于 ...

  4. 【Rust-book】第五章 使用结构体来组织相关联的数据

    第五章 使用结构体来组织相关联的数据 结构,或者结构体,是一种自定义数据类型,它允许我们命名多个相关的值并将它们组成一个有机的结合体. 可以把结构体视作对象中的数据属性 1 对比元组和结构体之间的异同 ...

  5. 聊聊Zookeeper的Session会话超时重连

    概述 简单地说,ZooKeeper的连接与会话就是客户端通过实例化ZooKeeper对象来实现客户端与服务器创建并保持TCP连接的过程.本质上,Session就是一个TCP 长连接. 会话 Sessi ...

  6. LLE算法的应用场景和案例:详解LLE算法在实际问题中的效果和表现

    目录 引言 随着深度学习技术的不断发展,神经网络模型在人工智能领域的应用越来越广泛.其中,LLE(Largely Element-wise Linear) 神经网络是一种常用的神经网络模型,其基本思想 ...

  7. "Process finished with exit code 1" 进程结束

    问题描述 :  springboot     程序运行出现以下情况 没有错误日志  返回运行结束 状态码  1     状态码为 1 的时候表示程序不是异常终止 连接到目标VM, 地址: ''127. ...

  8. 2023-07-15:给你一个 非递减 的正整数数组 nums 和整数 K, 判断该数组是否可以被分成一个或几个 长度至少 为 K 的 不相交的递增子序列。 输入:nums = [1,2,2,3,3,

    2023-07-15:给你一个 非递减 的正整数数组 nums 和整数 K, 判断该数组是否可以被分成一个或几个 长度至少 为 K 的 不相交的递增子序列. 输入:nums = [1,2,2,3,3, ...

  9. PerfView 洞察C#托管堆内存 "黑洞现象"

    一:背景 1. 讲故事 首先声明的是这个 黑洞 是我定义的术语,它是用来表示 内存吞噬 的一种现象,何为 内存吞噬,我们来看一张图. 从上面的 卦象图 来看,GCHeap 的 Allocated=85 ...

  10. shell 代码风格

    以终为始 initramfs_cgz=/srv/initrd/osimage/$os/$os_arch/${os_version%-iso}/$(date +"%Y%m%d").0 ...