我正在使用具有dagre布局的cytoscape来生成我的图形,并且我想要包括额外的边缘(在下面用红色表示)以有效地“注释”图形。但是,这并不像我希望的那样工作,因为dagre布局在生成图形时会考虑所有边缘。
我知道我可以使用“预设”布局来实现这种行为,但是使用dagre布局有明显的好处,包括通过展开 - 折叠扩展来实现适当的扩展 - 折叠功能。
我也尝试在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();