File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
src/layout/dagre/src/rank Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11# ChangeLog
22
3+ ### 0.3.4
4+
5+ - perf: improve the performance of dagre with layers;
6+
37### 0.3.3
48
59- fix: dagre layer failed when the layer number begin with 0;
Original file line number Diff line number Diff line change 11{
22 "name" : " @antv/layout" ,
3- "version" : " 0.3.3 " ,
3+ "version" : " 0.3.4 " ,
44 "description" : " graph layout algorithm" ,
55 "main" : " lib/index.js" ,
66 "module" : " es/index.js" ,
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ const longestPathWithLayer = (g: Graph) => {
107107 // minRank += 1; // NOTE: 最小的层级是dummy root,+1
108108
109109 // forward一遍,赋值层级
110+ const forwardVisited : Record < string , boolean > = { } ;
110111 const dfsForward = ( v : string , nextRank : number ) => {
111112 const label = g . node ( v ) ! ;
112113
@@ -119,6 +120,9 @@ const longestPathWithLayer = (g: Graph) => {
119120 label . rank = currRank ;
120121 }
121122
123+ if ( forwardVisited [ v ] ) return ;
124+ forwardVisited [ v ] = true ;
125+
122126 // DFS遍历子节点
123127 g . outEdges ( v ) ?. map ( ( e ) => {
124128 dfsForward ( e . w , currRank + g . edge ( e ) ! . minlen ! ) ;
You can’t perform that action at this time.
0 commit comments