我可以在cytoscape dagre布局中添加“美化”边缘吗?

问题描述 投票:1回答:1

我正在使用具有dagre布局的cytoscape来生成我的图形,并且我想要包括额外的边缘(在下面用红色表示)以有效地“注释”图形。但是,这并不像我希望的那样工作,因为dagre布局在生成图形时会考虑所有边缘。

我知道我可以使用“预设”布局来实现这种行为,但是使用dagre布局有明显的好处,包括通过展开 - 折叠扩展来实现适当的扩展 - 折叠功能。

我也尝试在dagre布局中使用“edgeWeight”选项无效。有没有人有任何建议?谢谢!

cytoscape.js
1个回答
0
投票

我通过在渲染布局之前过滤掉边缘来解决这个问题:

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();
© www.soinside.com 2019 - 2024. All rights reserved.