Visualize distance matrix as a graph

后端 未结 4 742
一生所求
一生所求 2020-12-15 02:14

I am doing a clustering task and I have a distance matrix. I wish to visualize this distance matrix as a 2D graph. Please let me know if there is any way to do it online or

4条回答
  •  悲&欢浪女
    2020-12-15 02:42

    You can use d3js Force Directed Graph and configure distance between nodes. d3js force layout has some clustering capability to separate nodes with similar distances. Here's an example with values as distance between nodes:

    http://vida.io/documents/SyT7DREdQmGSpsBkK

    Another way to visualize is to use same distance between nodes but different line thickness. In that case, you'd want to calculate stroke-width based on values:

    .style("stroke-width", function(d) { return Math.sqrt(d.value / 50); });
    

提交回复
热议问题