var nodes = [
{id: 1001, label: "A"},
{id: 1002, label: "B"},
{id: 1003, label: "C"},
{id: 1004, label: "D"},
{id: 1005, label: "E"},
{id: 1006, label: "F"},
{id: 1007, label: "G"},
{id: 1008, label: "H"},
{id: 1009, label: "I"}
];
var edges = [
{from:1002,to:1001,id:"10021001"},//B>A
{from:1003,to:1002,id:"10031002"},//C>B
{from:1004,to:1003,id:"10021001"},//D>C
{from:1005,to:1003,id:"10021001"},//E>C
{from:1006,to:1002,id:"10021001"},//F>B
{from:1007,to:1004,id:"10021001"},//G>D
{from:1008,to:1007,id:"10021001"},//H>G
{from:1009,to:1007,id:"10021001"} //I>G
]
graph LR
B-->A
C-->B
F-->B
D-->C
E-->C
G-->D
H-->G
I-->G
当删除 D 时,G、H、I 及连接线都要清除,数据是这样的
var nodes = [
{id: 1001, label: "A"},
{id: 1002, label: "B"},
{id: 1003, label: "C"},
{id: 1005, label: "E"},
{id: 1006, label: "F"}
];
var edges = [
{from:1002,to:1001,id:"10021001"},//B>A
{from:1003,to:1002,id:"10031002"},//C>B
{from:1005,to:1003,id:"10021001"},//E>C
{from:1006,to:1002,id:"10021001"}//F>B
]
graph LR
B-->A
C-->B
F-->B
E-->C
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.