- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我为我的 Debian 项目创建了一个依赖点图(见图)。依赖关系包括冗余边。我想要一个没有那些冗余边的更简单的图形。我可以自己计算这些,但这并不容易,因为我在 CMakeLists.txt 和 .cmake 扩展名中生成了 .dot 文件。
所以我想知道 dot 或 Graphviz 中是否有一个选项可以删除不需要的边。因此,例如,顶级 snapwebsites
项目依赖于 csspp
和 advgetopt
。由于 cspp
包已经依赖于 advgetopt
,因此不需要 snapwebsites
和 advgetopt
之间的边缘。
在有向图中,这意味着:
"snapwebsites" -> "advgetopt"; <-- "auto-remove" this one
"snapwebsites" -> "csspp";
"csspp" -> "advgetopt";
那么,有这样的选择吗?
最佳答案
根据@marapet 的回答,我创建了一个脚本,我想也许其他人会从副本中受益。它也在 Snap 中! C++ 作为 clean-dependencies.gvpr .
# Run with:
#
# /usr/bin/gvpr -o clean-dependencies.dot -f clean-dependencies.gvpr dependencies.dot
#
# Clean up the dependencies.svg from double dependencies
# In other words if A depends on B and C, and B also depends on C, we
# can remove the link between A amd C, it's not necessary in our file.
BEG_G {
edge_t direct_edges[int];
node_t children[int];
node_t n = fstnode($G);
while(n != NULL) {
// 1. extract the current node direct children
//
int direct_pos = 0;
edge_t e = fstout_sg($G, n);
while(e != NULL) {
direct_edges[direct_pos] = e;
children[direct_pos] = opp(e, n);
direct_pos = direct_pos + 1;
e = nxtout_sg($G, e);
}
// 2. find all of the grand children
// and see whether some are duplicates, if so delete the
// original (direct) edge
//
int child_pos = direct_pos;
int c = 0;
for(c = 0; c < child_pos; ++c) {
e = fstout_sg($G, children[c]);
while(e != NULL) {
node_t o = opp(e, children[c]);
int idx;
for(idx = 0; idx < direct_pos; ++idx) {
if(children[idx] == o) {
if(direct_edges[idx] != NULL) {
delete($G, direct_edges[idx]);
direct_edges[idx] = NULL;
}
break;
}
}
e = nxtout_sg($G, e);
}
}
n = nxtnode_sg($G, n);
}
}
END_G {
$O = $G;
}
有几件事我想提一下:gvpr 函数似乎不接受数组作为输入。此外,我首先尝试使用递归方法,并且局部变量被进一步调用粉碎(即在递归调用返回时,变量的值是来自子调用的值......所以变量是“本地”到函数,但仍然只有一个实例,没有堆栈!)
希望以后的版本能解决这些问题。
$ gvpr -V
gvpr version 2.38.0 (20140413.2041)
与尝试在 CMake 中执行相同的操作相比,修复我的图表已经是一种更简单的方法。
实际上我最后写了 a Python script做这项工作。很容易删除定义为 makefile 的树中的重复项。读取 .dot 数据并修复它要困难得多。但是,就我而言,我可以访问您可能没有的数据。
关于dependencies - 是否有自动删除点图中 "redundant"边的选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56948561/
我有三个数据框: df1: col1 col2 col3 name1 human experID1 name2 mouse experID2 name3 human
对于允许银行/电汇的支付系统,我需要将支付与相应的用户帐户可靠地关联起来。为此,用户应在与其帐户关联的转账中包含引用号。 我想用内置冗余(额外符号)生成这个数字,以便我可以检测和纠正最多 N 个以下(
我的术语可能有误,但有人可以解释为什么我们需要在类中包装 main 方法 吗?这对我来说似乎是多余的。然后你可以再次扩展这个类,完成一个 main 吗? package bears; import b
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit th
我正在将 Azure 移动服务用于生产移动应用程序。我正在查看 Azure 门户中的故障转移配置,但找不到任何相关信息。 有“流量管理器”,如 Azure documentation 中所述。 。但根
我为我的 Debian 项目创建了一个依赖点图(见图)。依赖关系包括冗余边。我想要一个没有那些冗余边的更简单的图形。我可以自己计算这些,但这并不容易,因为我在 CMakeLists.txt 和 .cm
以下内容已在 OS X 10.11.5 上使用 perl 5.24 进行了测试。 我编写了一个简短的程序 (perl-embed.pl) 来确定 Perl 在将字符串插入反引号时是否转义 shell
我为我的 Debian 项目创建了一个依赖点图(见图)。依赖关系包括冗余边。我想要一个没有那些冗余边的更简单的图形。我可以自己计算这些,但这并不容易,因为我在 CMakeLists.txt 和 .cm
我正在为一个 Web 应用程序项目设计一个数据库,我得出的结论是,我可能有一些查询,需要大量连接表才能进行一次检查。 我想知道将外键存储在某处以减少这些查询所需的联接数量有多糟糕? 举个我现在所拥有的
如果您认为自己有更好的标题,请随意改写标题。 如果你查看 bravo.js 的来源您会在第 807 行注意到以下内容。 module.declare = function main_module_de
我有一个通用函数,它返回 AnyListVM 的子类的新实例,基本上是这样实现的: public TListVM MakeListVM() where TListVM : An
我想了解用于纹理描述的非冗余局部二进制模式。原始LBP和非冗余LBP在纹理描述上有什么区别? 有人可以通过一个很好的例子来阐明上述主题吗? 最佳答案 非冗余局部二进制模式 (NRLBP) 描述符将 L
我正在构建一个数据库,其中包含自行车商店的大量商品。这家自行车店有许多相同的商品,例如 100 个尺寸为 4 且颜色为“红色”的车轮。我的问题是: 是向实体集添加“数量”字段并将所有相似项目放在一个实
这有点吓人。 我认为某处一定有一个设置可以解释为什么会发生这种情况。 在我们的解决方案中,大约有 50 个不同的项目。大多数情况下,这些库以命名空间 OurCompany 开头。 我们有 OurCom
为什么当警告级别处于 2 级或更高级别时,我会立即收到此琐碎代码示例的以下警告? public int Foo(int a) { if (a >= 0) throw new ArgumentE
这是我的代码: example = [1,-4,7,12] positiveSum :: [Int] -> Int positiveSum (x) = 0 positiveSum (x:xs) = r
为什么我在 Perl 中收到此错误“printf 中的冗余参数”?这表示格式字符串需要的值多于包含的值。我提供的格式字符串是否正确? 输入文件: Apollo 13 Ron
我已经习惯了elasticsearch很长一段时间了,但现在我试图找到的解决方案是列出给定搜索字符串的准确值。 我现在用java编写的代码: BoolQueryBuilder queryBuiler
我收到一条编译器警告,提示局部变量“newElement”是多余的。如何更有效地编写以下代码来消除我的代码中的此警告? Element newElement = new Element(left,el
我很好奇编译器如何处理下面的表达式: var collapsed = elements.GroupBy(elm => elm.OrderIdentifier).Select(group =>
我是一名优秀的程序员,十分优秀!