antvis / antvis/layout

antv-darge布局内initOrder方法应该调用 g.dfs,而不是g.dfsTree深度遍历布局

Open
#243 0 comments 0 reactions 0 assignees View on GitHub
layout/antv-dagre
Dominant language
TypeScript
Stars
276
Forks
60
PR merge metrics
No merged PRs in 30d

Description

![Image](https://github.com/user-attachments/assets/1388eef0-2f9b-4f8c-86dd-001afc96dd8e)

![Image](https://github.com/user-attachments/assets/afffbbcf-1ecb-496d-b0f2-96f0d8ec5d9d)

v5版本的ant-darge布局效果和0.8.5版本不一致,因为v5版本初始化节点内顺序的initOrder调用g.dfsTree方法,dfsTree方法依赖g.treeIndices,dag布局下g.treeIndices是没有数据的,导致布局的深度优先遍历,变成了广度优先遍历。

const data = {
nodes: [
{ id: 'B' },
{ id: 'C' },
{ id: 'D' },
{ id: 'E' },
{ id: 'F' },
{ id: 'A' },
],
edges: [
{ source: 'A', target: 'B' },
{ source: 'A', target: 'C' },
{ source: 'A', target: 'F' },
{ source: 'B', target: 'C' },
{ source: 'B', target: 'D' },
{ source: 'B', target: 'F' },
{ source: 'C', target: 'E' },
{ source: 'D', target: 'F' },
],
};

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.