【问题标题】:Using the edge weight for force directed layout (CoSE) in cytoscape.js在 cytoscape.js 中使用边缘权重进行力导向布局 (CoSE)
【发布时间】:2016-07-20 04:49:01
【问题描述】:
  1. 我不确定在使用 cytoscape.js 中的 CoSE 插件生成力导向布局时如何最好地利用边缘权重(例如,两个相互作用的蛋白质之间的相互作用强度)。有人可以提供任何指示。应该是“idealEdgeLength”还是“edgeElasticity”?

  2. (EDIT) 下图显示了我目前得到的 (A) 和我正在努力实现的 (B)。下面还有我用来生成布局的参数。

谢谢, 数据。

PS: Click to view 显示当前(标记为“A”)和预期(标记为“B”)布局的图。以下是“A”的布局选项。

    var options = {
        name: 'cose',
        // Called on `layoutready`
        ready: function () { },
        // Called on `layoutstop`
        stop: function () { },
        // Whether to animate while running the layout
        animate: true,
        // Number of iterations between consecutive screen positions update (0 -> only updated on the end)
        refresh: 20,
        // Whether to fit the network view after when done
        fit: true,
        // Padding on fit
        padding: 30,
        // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
        boundingBox: undefined,
        componentSpacing: 100,
        // Whether to randomize node positions on the beginning
        randomize: true,
        // Whether to use the JS console to print debug messages
        debug: false,
        // Node repulsion (non overlapping) multiplier
        nodeRepulsion: 400000,
        // Node repulsion (overlapping) multiplier
        nodeOverlap: 10,
        // Ideal edge (non nested) length
        idealEdgeLength: 10,
        // Divisor to compute edge forces
        edgeElasticity: 100,
        // Nesting factor (multiplier) to compute ideal edge length for nested edges
        nestingFactor: 5,
        // Gravity force (constant)
        gravity: 80,
        // Maximum number of iterations to perform
        numIter: 10000,
        // Initial temperature (maximum node displacement)
        initialTemp: 100,
        // Cooling factor (how the temperature is reduced between consecutive iterations
        coolingFactor: 0.95,
        // Lower temperature threshold (below this point the layout will end)
        minTemp: 1.0
    };

【问题讨论】:

    标签: cytoscape.js


    【解决方案1】:

    您可以为一些关键的 CoSE 布局设置指定函数而不是静态数字。这些函数采用边缘(或节点,在某些情况下),因此您可以根据边缘属性定制布局。

    所以你可以这样做:

          idealEdgeLength: function (edge) {
            // Default is: 10
            // Instead, base it on "weight"
            return edge.data().weight * .5
          },
    
          edgeElasticity: function (edge) {
            // Default is: 100
            // Instead, base it on "weight"
            return edge.data().weight * 4
          },
    

    您必须尝试与布局引擎一起使用的范围以及您期望作为输入的权重范围,但这种方法应该可以正常工作。

    【讨论】:

      【解决方案2】:

      理想边长指定了一个类似默认值,而弹性指定了决定最终长度的力之一。一般来说,对于物理模拟布局,您需要尝试不同的值并评估特定图表的结果。

      【讨论】:

      • 谢谢,马克斯。我对问题添加了编辑。如果您能提供一些关于我相对于 cose 布局所缺少的内容的输入,那将非常有帮助。
      • 除非它是图形结构所固有的,否则您不会在物理布局中获得聚类。您可以尝试在特定子图上运行单独的 CoSE 实例。
      猜你喜欢
      • 1970-01-01
      • 2019-04-24
      • 2016-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多