dagre布局上层某个节点连接到多个下层节点时,计算出的节点位置会有偏差
- Dominant language
- TypeScript
- Stars
- 276
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
### 复现方式
- 进入测试demo页面:https://observablehq.com/d/2db6b0cc5e97d8d6#cell-1668
- 修改 data6 图数据(下方复制粘贴)并保存
- 查看布局效果(节点1-3连接节点2-2、2-3会发生位置偏差,但节点1-3连接节点2-1、2-3的话就不会)

### 节点、边数据
```javascript
data6 = {
return {
nodes: [
{
id: "1",
data: {
name: "alps_file1"
}
},
{
id: "1-1",
data: {
name: "alps_file2"
}
},
{
id: "1-2",
data: {
name: "alps_file3"
}
},
{
id: "1-3",
data: {
name: "sql_file1"
}
},
{
id: "2-1",
data: {
name: "sql_file2"
}
},
{
id: "2-2",
data: {
name: "feature_etl_1"
}
},
{
id: "2-3",
data: {
name: "feature_etl_1"
}
}
],
edges: [
{
id: "e1",
data: {},
source: "1",
target: "1-1"
},
{
id: "e2",
data: {},
source: "1",
target: "1-2"
},
{
id: "e3",
data: {},
source: "1",
target: "1-3"
},
{
id: "e4",
data: {},
source: "1-1",
target: "2-1"
},
{
id: "e5",
data: {},
source: "1-2",
target: "2-2"
},
{
id: "e6",
data: {},
source: "1-3",
target: "2-3"
},
{
id: "7",
data: {},
source: "1-3",
target: "2-2"
}
]
};
}
```
Contributor guide
Research direction
Open the linked Observable test demo and reproduce the layout with the supplied data6 nodes and edges, comparing the cases where node 1-3 connects to nodes 2-2 and 2-3. Trace the layout entry point used by the demo and investigate the position calculation; done means the reproduced graph places the affected nodes without the reported offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100