我可以在 cytoscape dagre 布局中添加 "cosmetic" 条边吗?
Can I add "cosmetic" edges to a cytoscape dagre layout?
我正在使用带有 dagre 布局的 cytoscape 来生成我的图形,我想包括额外的边(下面用红色表示)以有效地 "annotate" 图形。但是,这并不像我希望的那样工作,因为 dagre 布局在生成图形时考虑了所有边。
我知道我可以使用 "preset" 布局来实现此行为,但是使用 dagre 布局有明显的好处,包括通过 expand-collapse 扩展的适当 expand-collapse 功能。
我也试过在 dagre 布局中使用 "edgeWeight" 选项但没有效果。有人有什么建议吗?谢谢!
我通过在渲染布局之前过滤掉边缘解决了这个问题:
var processedElements = this.cy
.elements()
// Filter out edges we don't want contributing to the layout of
// of the graph
.filter(el => !el.hasClass("unbundled-bezier-1"))
var layout = processedElements.layout({
name: "dagre",
rankDir: "LR"
})
layout.run();
我正在使用带有 dagre 布局的 cytoscape 来生成我的图形,我想包括额外的边(下面用红色表示)以有效地 "annotate" 图形。但是,这并不像我希望的那样工作,因为 dagre 布局在生成图形时考虑了所有边。
我知道我可以使用 "preset" 布局来实现此行为,但是使用 dagre 布局有明显的好处,包括通过 expand-collapse 扩展的适当 expand-collapse 功能。
我也试过在 dagre 布局中使用 "edgeWeight" 选项但没有效果。有人有什么建议吗?谢谢!
我通过在渲染布局之前过滤掉边缘解决了这个问题:
var processedElements = this.cy
.elements()
// Filter out edges we don't want contributing to the layout of
// of the graph
.filter(el => !el.hasClass("unbundled-bezier-1"))
var layout = processedElements.layout({
name: "dagre",
rankDir: "LR"
})
layout.run();