简体   繁体   English

cytoscape.js复合节点忽略布局?

[英]cytoscape.js compound nodes ignoring layout?

It appears that compound nodes don't obey layouts if they have connections between other parents, but children do not have connections. 看来如果复合节点在其他父级之间具有连接,则它们不遵循布局,但是子级没有连接。 Best way to show is to modify their DAGRE example: 最好的显示方法是修改其DAGRE示例:

http://jsbin.com/gist/e52c2fbc0b09edd6ec46?html,output http://jsbin.com/gist/e52c2fbc0b09edd6ec46?html,输出

by replacing their data with this: 通过使用以下内容替换其数据:

elements: {
nodes: [
{"data":{"id":"SimpleTest"}},
{"data":{"id":"child1","parent":"SimpleTest"}},
{"data":{"id":"child2","parent":"SimpleTest"}},
{"data":{"id":"subParent1"}},
{"data":{"id":"terminal0_socket","parent":"subParent1"}},
{"data":{"id":"subParent2"}},                          
{"data":{"id":"terminal1_socket","parent":"subParent2"}},
{"data":{"id":"terminal0"}},
{"data":{"id":"terminal1"}}
],
edges: [
{"data":{"source":"SimpleTest","target":"subParent1"}},
{"data":{"source":"SimpleTest","target":"subParent2"}},
{"data":{"source":"terminal0_socket","target":"terminal0"}},
{"data":{"source":"terminal1_socket","target":"terminal1"}}
]
},

The links from the children to unparented nodes are honored by the layout, but the links between SimpleTest and the two sub-parents are not. 从子级到未父级节点的链接通过布局接受,但SimpleTest与两个子父级之间的链接不可用。

I've tried running the layout on just the parents by assigning classes and passing layout() the sub-Graph and then just running grid on the remaining nodes, but that doesn't appear to work either. 我尝试过通过分配类并向子图传递layout(),然后仅在其余节点上运行网格,而仅在父级上运行布局,但这似乎也不起作用。

Is there an example somewhere of how to handle this case? 是否存在处理该情况的示例? It appears in the two examples on their website (unless I'm mistaken) they're manually setting position for parents. 它出现在他们网站上的两个示例中(除非我弄错了),他们正在手动为父母设置位置。

The only workaround I can see is to add dummy links between children to get the layout to run, and then filter them from the graph / hide them afterwards, but I feel like there's a way to do this I'm not seeing... 我能看到的唯一解决方法是在子级之间添加虚拟链接以运行布局,然后从图形中过滤它们/之后将它们隐藏,但是我觉得有办法做到这一点我没有看到...

Thanks! 谢谢!

Compound graphs are not standard graphs, and so only layouts that explicitly state compound support can be expected to handle special compound cases. 复合图不是标准图,因此只有明确表示复合支持的布局才能处理特殊的复合情况。 Dagre is an external library and has no concept of compounds. Dagre是一个外部库,没有化合物的概念。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM