Try to stack like nodes
This commit is contained in:
@@ -58,6 +58,11 @@ class GraphNode {
|
||||
if (this.groups.size && !intersects(this.groups, node.groups)) {
|
||||
node.addAffinity(this, d => d <= 2 ? -INF : 0);
|
||||
}
|
||||
|
||||
// Try to stack nodes with the same label
|
||||
if (node.label == this.label) {
|
||||
this.addAffinity(node, (d, v) => v[0] == 0 ? 200 : 500);
|
||||
}
|
||||
}
|
||||
|
||||
for (let to of this.links) {
|
||||
|
||||
@@ -61,6 +61,10 @@ class Layout {
|
||||
let nodes = this.nodesFromGraphNodes(subgraph);
|
||||
this.groups_.push(new LayoutGroup(null, this.nodesByPos_, nodes));
|
||||
}
|
||||
for (let labelGroup of this.graph_.nodesByLabel.values()) {
|
||||
let nodes = this.nodesFromGraphNodes(labelGroup);
|
||||
this.groups_.push(new LayoutGroup(null, this.nodesByPos_, nodes));
|
||||
}
|
||||
}
|
||||
|
||||
resolveLinks() {
|
||||
|
||||
Reference in New Issue
Block a user