Graph 如何在Sigma.js中设置不同类型的边?

Graph 如何在Sigma.js中设置不同类型的边?,graph,sigma.js,Graph,Sigma.js,如何在Sigma.js中设置不同类型的边?我想设置不同类型的边(实心、虚线、虚线等)。这个问题的答案可以在Sigma.js源代码中找到。如果您查看sigma.js-[version num]/examples/plugin-customEdgeShapes.html,它将向您展示如何在创建边缘时设置边缘的type属性 g.edges.push({ id: 'e' + i, source: 'n' + (Math.random() * N | 0), target: 'n'

如何在Sigma.js中设置不同类型的边?我想设置不同类型的边(实心、虚线、虚线等)。

这个问题的答案可以在Sigma.js源代码中找到。如果您查看sigma.js-[version num]/examples/plugin-customEdgeShapes.html,它将向您展示如何在创建边缘时设置边缘的type属性

g.edges.push({
    id: 'e' + i,
    source: 'n' + (Math.random() * N | 0),
    target: 'n' + (Math.random() * N | 0),
    type: [
      'line',
      'curve',
      'arrow',
      'curvedArrow',
      'dashed',
      'dotted',
      'parallel',
      'tapered'
    ][Math.round(Math.random()*8)],
    size: Math.random()
  });
他们在代码中随机选择一种类型,但您可以定义其中任何一种类型以获得所需的样式。(在浏览器中打开plugin-customEdgeShapes.html以快速查看样式。)