@antv/layout 0.3.12 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -32
- package/dist/3a54d760230d1933f953.worker.js +2 -0
- package/dist/3a54d760230d1933f953.worker.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/lib/Circular.d.ts +40 -0
- package/lib/Supervisor.d.ts +65 -0
- package/lib/index.d.ts +3 -3
- package/lib/registry.d.ts +3 -0
- package/lib/types.d.ts +128 -0
- package/lib/util/gpu.d.ts +22 -22
- package/lib/util/index.d.ts +6 -6
- package/lib/util/math.d.ts +3 -3
- package/lib/worker.d.ts +3 -0
- package/package.json +21 -95
- package/dist/layout.min.js +0 -3
- package/dist/layout.min.js.LICENSE.txt +0 -1
- package/dist/layout.min.js.map +0 -1
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -6
- package/es/index.js.map +0 -1
- package/es/layout/base.d.ts +0 -22
- package/es/layout/base.js +0 -51
- package/es/layout/base.js.map +0 -1
- package/es/layout/circular.d.ts +0 -80
- package/es/layout/circular.js +0 -314
- package/es/layout/circular.js.map +0 -1
- package/es/layout/comboCombined.d.ts +0 -54
- package/es/layout/comboCombined.js +0 -354
- package/es/layout/comboCombined.js.map +0 -1
- package/es/layout/comboForce.d.ts +0 -134
- package/es/layout/comboForce.js +0 -801
- package/es/layout/comboForce.js.map +0 -1
- package/es/layout/concentric.d.ts +0 -67
- package/es/layout/concentric.js +0 -219
- package/es/layout/concentric.js.map +0 -1
- package/es/layout/constants.d.ts +0 -12
- package/es/layout/constants.js +0 -22
- package/es/layout/constants.js.map +0 -1
- package/es/layout/dagre/graph.d.ts +0 -91
- package/es/layout/dagre/graph.js +0 -4
- package/es/layout/dagre/graph.js.map +0 -1
- package/es/layout/dagre/index.d.ts +0 -8
- package/es/layout/dagre/index.js +0 -31
- package/es/layout/dagre/index.js.map +0 -1
- package/es/layout/dagre/src/acyclic.d.ts +0 -6
- package/es/layout/dagre/src/acyclic.js +0 -52
- package/es/layout/dagre/src/acyclic.js.map +0 -1
- package/es/layout/dagre/src/add-border-segments.d.ts +0 -3
- package/es/layout/dagre/src/add-border-segments.js +0 -32
- package/es/layout/dagre/src/add-border-segments.js.map +0 -1
- package/es/layout/dagre/src/coordinate-system.d.ts +0 -6
- package/es/layout/dagre/src/coordinate-system.js +0 -69
- package/es/layout/dagre/src/coordinate-system.js.map +0 -1
- package/es/layout/dagre/src/data/list.d.ts +0 -12
- package/es/layout/dagre/src/data/list.js +0 -48
- package/es/layout/dagre/src/data/list.js.map +0 -1
- package/es/layout/dagre/src/debug.d.ts +0 -3
- package/es/layout/dagre/src/debug.js +0 -24
- package/es/layout/dagre/src/debug.js.map +0 -1
- package/es/layout/dagre/src/greedy-fas.d.ts +0 -3
- package/es/layout/dagre/src/greedy-fas.js +0 -114
- package/es/layout/dagre/src/greedy-fas.js.map +0 -1
- package/es/layout/dagre/src/layout.d.ts +0 -3
- package/es/layout/dagre/src/layout.js +0 -518
- package/es/layout/dagre/src/layout.js.map +0 -1
- package/es/layout/dagre/src/nesting-graph.d.ts +0 -6
- package/es/layout/dagre/src/nesting-graph.js +0 -117
- package/es/layout/dagre/src/nesting-graph.js.map +0 -1
- package/es/layout/dagre/src/normalize.d.ts +0 -6
- package/es/layout/dagre/src/normalize.js +0 -89
- package/es/layout/dagre/src/normalize.js.map +0 -1
- package/es/layout/dagre/src/order/add-subgraph-constraints.d.ts +0 -3
- package/es/layout/dagre/src/order/add-subgraph-constraints.js +0 -27
- package/es/layout/dagre/src/order/add-subgraph-constraints.js.map +0 -1
- package/es/layout/dagre/src/order/barycenter.d.ts +0 -11
- package/es/layout/dagre/src/order/barycenter.js +0 -24
- package/es/layout/dagre/src/order/barycenter.js.map +0 -1
- package/es/layout/dagre/src/order/build-layer-graph.d.ts +0 -3
- package/es/layout/dagre/src/order/build-layer-graph.js +0 -71
- package/es/layout/dagre/src/order/build-layer-graph.js.map +0 -1
- package/es/layout/dagre/src/order/cross-count.d.ts +0 -3
- package/es/layout/dagre/src/order/cross-count.js +0 -65
- package/es/layout/dagre/src/order/cross-count.js.map +0 -1
- package/es/layout/dagre/src/order/index.d.ts +0 -3
- package/es/layout/dagre/src/order/index.js +0 -91
- package/es/layout/dagre/src/order/index.js.map +0 -1
- package/es/layout/dagre/src/order/init-data-order.d.ts +0 -6
- package/es/layout/dagre/src/order/init-data-order.js +0 -25
- package/es/layout/dagre/src/order/init-data-order.js.map +0 -1
- package/es/layout/dagre/src/order/init-order.d.ts +0 -3
- package/es/layout/dagre/src/order/init-order.js +0 -52
- package/es/layout/dagre/src/order/init-order.js.map +0 -1
- package/es/layout/dagre/src/order/resolve-conflicts.d.ts +0 -19
- package/es/layout/dagre/src/order/resolve-conflicts.js +0 -93
- package/es/layout/dagre/src/order/resolve-conflicts.js.map +0 -1
- package/es/layout/dagre/src/order/sort-subgraph.d.ts +0 -7
- package/es/layout/dagre/src/order/sort-subgraph.js +0 -85
- package/es/layout/dagre/src/order/sort-subgraph.js.map +0 -1
- package/es/layout/dagre/src/order/sort.d.ts +0 -7
- package/es/layout/dagre/src/order/sort.js +0 -68
- package/es/layout/dagre/src/order/sort.js.map +0 -1
- package/es/layout/dagre/src/parent-dummy-chains.d.ts +0 -3
- package/es/layout/dagre/src/parent-dummy-chains.js +0 -81
- package/es/layout/dagre/src/parent-dummy-chains.js.map +0 -1
- package/es/layout/dagre/src/position/bk.d.ts +0 -23
- package/es/layout/dagre/src/position/bk.js +0 -370
- package/es/layout/dagre/src/position/bk.js.map +0 -1
- package/es/layout/dagre/src/position/index.d.ts +0 -3
- package/es/layout/dagre/src/position/index.js +0 -51
- package/es/layout/dagre/src/position/index.js.map +0 -1
- package/es/layout/dagre/src/rank/feasible-tree.d.ts +0 -9
- package/es/layout/dagre/src/rank/feasible-tree.js +0 -148
- package/es/layout/dagre/src/rank/feasible-tree.js.map +0 -1
- package/es/layout/dagre/src/rank/index.d.ts +0 -3
- package/es/layout/dagre/src/rank/index.js +0 -53
- package/es/layout/dagre/src/rank/index.js.map +0 -1
- package/es/layout/dagre/src/rank/network-simplex.d.ts +0 -9
- package/es/layout/dagre/src/rank/network-simplex.js +0 -195
- package/es/layout/dagre/src/rank/network-simplex.js.map +0 -1
- package/es/layout/dagre/src/rank/util.d.ts +0 -11
- package/es/layout/dagre/src/rank/util.js +0 -141
- package/es/layout/dagre/src/rank/util.js.map +0 -1
- package/es/layout/dagre/src/util.d.ts +0 -31
- package/es/layout/dagre/src/util.js +0 -261
- package/es/layout/dagre/src/util.js.map +0 -1
- package/es/layout/dagre.d.ts +0 -71
- package/es/layout/dagre.js +0 -433
- package/es/layout/dagre.js.map +0 -1
- package/es/layout/dagreCompound.d.ts +0 -121
- package/es/layout/dagreCompound.js +0 -391
- package/es/layout/dagreCompound.js.map +0 -1
- package/es/layout/er/core.d.ts +0 -1
- package/es/layout/er/core.js +0 -107
- package/es/layout/er/core.js.map +0 -1
- package/es/layout/er/forceGrid.d.ts +0 -8
- package/es/layout/er/forceGrid.js +0 -88
- package/es/layout/er/forceGrid.js.map +0 -1
- package/es/layout/er/grid.d.ts +0 -26
- package/es/layout/er/grid.js +0 -162
- package/es/layout/er/grid.js.map +0 -1
- package/es/layout/er/index.d.ts +0 -29
- package/es/layout/er/index.js +0 -54
- package/es/layout/er/index.js.map +0 -1
- package/es/layout/er/mysqlWorkbench.d.ts +0 -6
- package/es/layout/er/mysqlWorkbench.js +0 -324
- package/es/layout/er/mysqlWorkbench.js.map +0 -1
- package/es/layout/er/type.d.ts +0 -35
- package/es/layout/er/type.js +0 -2
- package/es/layout/er/type.js.map +0 -1
- package/es/layout/force/force-in-a-box.d.ts +0 -28
- package/es/layout/force/force-in-a-box.js +0 -330
- package/es/layout/force/force-in-a-box.js.map +0 -1
- package/es/layout/force/force.d.ts +0 -100
- package/es/layout/force/force.js +0 -340
- package/es/layout/force/force.js.map +0 -1
- package/es/layout/force/index.d.ts +0 -1
- package/es/layout/force/index.js +0 -2
- package/es/layout/force/index.js.map +0 -1
- package/es/layout/force2/ForceNBody.d.ts +0 -7
- package/es/layout/force2/ForceNBody.js +0 -94
- package/es/layout/force2/ForceNBody.js.map +0 -1
- package/es/layout/force2/index.d.ts +0 -119
- package/es/layout/force2/index.js +0 -608
- package/es/layout/force2/index.js.map +0 -1
- package/es/layout/forceAtlas2/body.d.ts +0 -33
- package/es/layout/forceAtlas2/body.js +0 -89
- package/es/layout/forceAtlas2/body.js.map +0 -1
- package/es/layout/forceAtlas2/index.d.ts +0 -115
- package/es/layout/forceAtlas2/index.js +0 -484
- package/es/layout/forceAtlas2/index.js.map +0 -1
- package/es/layout/forceAtlas2/quad.d.ts +0 -27
- package/es/layout/forceAtlas2/quad.js +0 -96
- package/es/layout/forceAtlas2/quad.js.map +0 -1
- package/es/layout/forceAtlas2/quadTree.d.ts +0 -20
- package/es/layout/forceAtlas2/quadTree.js +0 -103
- package/es/layout/forceAtlas2/quadTree.js.map +0 -1
- package/es/layout/fruchterman.d.ts +0 -73
- package/es/layout/fruchterman.js +0 -296
- package/es/layout/fruchterman.js.map +0 -1
- package/es/layout/gForce.d.ts +0 -96
- package/es/layout/gForce.js +0 -399
- package/es/layout/gForce.js.map +0 -1
- package/es/layout/gpu/fruchterman.d.ts +0 -57
- package/es/layout/gpu/fruchterman.js +0 -267
- package/es/layout/gpu/fruchterman.js.map +0 -1
- package/es/layout/gpu/fruchtermanShader.d.ts +0 -4
- package/es/layout/gpu/fruchtermanShader.js +0 -201
- package/es/layout/gpu/fruchtermanShader.js.map +0 -1
- package/es/layout/gpu/gForce.d.ts +0 -68
- package/es/layout/gpu/gForce.js +0 -330
- package/es/layout/gpu/gForce.js.map +0 -1
- package/es/layout/gpu/gForceShader.d.ts +0 -4
- package/es/layout/gpu/gForceShader.js +0 -218
- package/es/layout/gpu/gForceShader.js.map +0 -1
- package/es/layout/grid.d.ts +0 -83
- package/es/layout/grid.js +0 -317
- package/es/layout/grid.js.map +0 -1
- package/es/layout/index.d.ts +0 -22
- package/es/layout/index.js +0 -25
- package/es/layout/index.js.map +0 -1
- package/es/layout/layout.d.ts +0 -26
- package/es/layout/layout.js +0 -97
- package/es/layout/layout.js.map +0 -1
- package/es/layout/mds.d.ts +0 -39
- package/es/layout/mds.js +0 -122
- package/es/layout/mds.js.map +0 -1
- package/es/layout/radial/index.d.ts +0 -1
- package/es/layout/radial/index.js +0 -2
- package/es/layout/radial/index.js.map +0 -1
- package/es/layout/radial/mds.d.ts +0 -15
- package/es/layout/radial/mds.js +0 -38
- package/es/layout/radial/mds.js.map +0 -1
- package/es/layout/radial/radial.d.ts +0 -74
- package/es/layout/radial/radial.js +0 -420
- package/es/layout/radial/radial.js.map +0 -1
- package/es/layout/radial/radialNonoverlapForce.d.ts +0 -50
- package/es/layout/radial/radialNonoverlapForce.js +0 -123
- package/es/layout/radial/radialNonoverlapForce.js.map +0 -1
- package/es/layout/random.d.ts +0 -35
- package/es/layout/random.js +0 -62
- package/es/layout/random.js.map +0 -1
- package/es/layout/types.d.ts +0 -432
- package/es/layout/types.js +0 -2
- package/es/layout/types.js.map +0 -1
- package/es/registy/index.d.ts +0 -3
- package/es/registy/index.js +0 -41
- package/es/registy/index.js.map +0 -1
- package/es/util/array.d.ts +0 -1
- package/es/util/array.js +0 -2
- package/es/util/array.js.map +0 -1
- package/es/util/function.d.ts +0 -6
- package/es/util/function.js +0 -56
- package/es/util/function.js.map +0 -1
- package/es/util/gpu.d.ts +0 -52
- package/es/util/gpu.js +0 -239
- package/es/util/gpu.js.map +0 -1
- package/es/util/index.d.ts +0 -6
- package/es/util/index.js +0 -7
- package/es/util/index.js.map +0 -1
- package/es/util/math.d.ts +0 -48
- package/es/util/math.js +0 -276
- package/es/util/math.js.map +0 -1
- package/es/util/number.d.ts +0 -3
- package/es/util/number.js +0 -7
- package/es/util/number.js.map +0 -1
- package/es/util/object.d.ts +0 -2
- package/es/util/object.js +0 -25
- package/es/util/object.js.map +0 -1
- package/es/util/string.d.ts +0 -2
- package/es/util/string.js +0 -16
- package/es/util/string.js.map +0 -1
- package/lib/index.js +0 -24
- package/lib/index.js.map +0 -1
- package/lib/layout/base.d.ts +0 -22
- package/lib/layout/base.js +0 -56
- package/lib/layout/base.js.map +0 -1
- package/lib/layout/circular.d.ts +0 -80
- package/lib/layout/circular.js +0 -337
- package/lib/layout/circular.js.map +0 -1
- package/lib/layout/comboCombined.d.ts +0 -54
- package/lib/layout/comboCombined.js +0 -390
- package/lib/layout/comboCombined.js.map +0 -1
- package/lib/layout/comboForce.d.ts +0 -134
- package/lib/layout/comboForce.js +0 -826
- package/lib/layout/comboForce.js.map +0 -1
- package/lib/layout/concentric.d.ts +0 -67
- package/lib/layout/concentric.js +0 -243
- package/lib/layout/concentric.js.map +0 -1
- package/lib/layout/constants.d.ts +0 -12
- package/lib/layout/constants.js +0 -25
- package/lib/layout/constants.js.map +0 -1
- package/lib/layout/dagre/graph.d.ts +0 -91
- package/lib/layout/dagre/graph.js +0 -28
- package/lib/layout/dagre/graph.js.map +0 -1
- package/lib/layout/dagre/index.d.ts +0 -8
- package/lib/layout/dagre/index.js +0 -36
- package/lib/layout/dagre/index.js.map +0 -1
- package/lib/layout/dagre/src/acyclic.d.ts +0 -6
- package/lib/layout/dagre/src/acyclic.js +0 -57
- package/lib/layout/dagre/src/acyclic.js.map +0 -1
- package/lib/layout/dagre/src/add-border-segments.d.ts +0 -3
- package/lib/layout/dagre/src/add-border-segments.js +0 -34
- package/lib/layout/dagre/src/add-border-segments.js.map +0 -1
- package/lib/layout/dagre/src/coordinate-system.d.ts +0 -6
- package/lib/layout/dagre/src/coordinate-system.js +0 -71
- package/lib/layout/dagre/src/coordinate-system.js.map +0 -1
- package/lib/layout/dagre/src/data/list.d.ts +0 -12
- package/lib/layout/dagre/src/data/list.js +0 -52
- package/lib/layout/dagre/src/data/list.js.map +0 -1
- package/lib/layout/dagre/src/debug.d.ts +0 -3
- package/lib/layout/dagre/src/debug.js +0 -26
- package/lib/layout/dagre/src/debug.js.map +0 -1
- package/lib/layout/dagre/src/greedy-fas.d.ts +0 -3
- package/lib/layout/dagre/src/greedy-fas.js +0 -144
- package/lib/layout/dagre/src/greedy-fas.js.map +0 -1
- package/lib/layout/dagre/src/layout.d.ts +0 -3
- package/lib/layout/dagre/src/layout.js +0 -535
- package/lib/layout/dagre/src/layout.js.map +0 -1
- package/lib/layout/dagre/src/nesting-graph.d.ts +0 -6
- package/lib/layout/dagre/src/nesting-graph.js +0 -119
- package/lib/layout/dagre/src/nesting-graph.js.map +0 -1
- package/lib/layout/dagre/src/normalize.d.ts +0 -6
- package/lib/layout/dagre/src/normalize.js +0 -91
- package/lib/layout/dagre/src/normalize.js.map +0 -1
- package/lib/layout/dagre/src/order/add-subgraph-constraints.d.ts +0 -3
- package/lib/layout/dagre/src/order/add-subgraph-constraints.js +0 -29
- package/lib/layout/dagre/src/order/add-subgraph-constraints.js.map +0 -1
- package/lib/layout/dagre/src/order/barycenter.d.ts +0 -11
- package/lib/layout/dagre/src/order/barycenter.js +0 -26
- package/lib/layout/dagre/src/order/barycenter.js.map +0 -1
- package/lib/layout/dagre/src/order/build-layer-graph.d.ts +0 -3
- package/lib/layout/dagre/src/order/build-layer-graph.js +0 -73
- package/lib/layout/dagre/src/order/build-layer-graph.js.map +0 -1
- package/lib/layout/dagre/src/order/cross-count.d.ts +0 -3
- package/lib/layout/dagre/src/order/cross-count.js +0 -67
- package/lib/layout/dagre/src/order/cross-count.js.map +0 -1
- package/lib/layout/dagre/src/order/index.d.ts +0 -3
- package/lib/layout/dagre/src/order/index.js +0 -96
- package/lib/layout/dagre/src/order/index.js.map +0 -1
- package/lib/layout/dagre/src/order/init-data-order.d.ts +0 -6
- package/lib/layout/dagre/src/order/init-data-order.js +0 -27
- package/lib/layout/dagre/src/order/init-data-order.js.map +0 -1
- package/lib/layout/dagre/src/order/init-order.d.ts +0 -3
- package/lib/layout/dagre/src/order/init-order.js +0 -54
- package/lib/layout/dagre/src/order/init-order.js.map +0 -1
- package/lib/layout/dagre/src/order/resolve-conflicts.d.ts +0 -19
- package/lib/layout/dagre/src/order/resolve-conflicts.js +0 -98
- package/lib/layout/dagre/src/order/resolve-conflicts.js.map +0 -1
- package/lib/layout/dagre/src/order/sort-subgraph.d.ts +0 -7
- package/lib/layout/dagre/src/order/sort-subgraph.js +0 -90
- package/lib/layout/dagre/src/order/sort-subgraph.js.map +0 -1
- package/lib/layout/dagre/src/order/sort.d.ts +0 -7
- package/lib/layout/dagre/src/order/sort.js +0 -70
- package/lib/layout/dagre/src/order/sort.js.map +0 -1
- package/lib/layout/dagre/src/parent-dummy-chains.d.ts +0 -3
- package/lib/layout/dagre/src/parent-dummy-chains.js +0 -83
- package/lib/layout/dagre/src/parent-dummy-chains.js.map +0 -1
- package/lib/layout/dagre/src/position/bk.d.ts +0 -23
- package/lib/layout/dagre/src/position/bk.js +0 -409
- package/lib/layout/dagre/src/position/bk.js.map +0 -1
- package/lib/layout/dagre/src/position/index.d.ts +0 -3
- package/lib/layout/dagre/src/position/index.js +0 -64
- package/lib/layout/dagre/src/position/index.js.map +0 -1
- package/lib/layout/dagre/src/rank/feasible-tree.d.ts +0 -9
- package/lib/layout/dagre/src/rank/feasible-tree.js +0 -152
- package/lib/layout/dagre/src/rank/feasible-tree.js.map +0 -1
- package/lib/layout/dagre/src/rank/index.d.ts +0 -3
- package/lib/layout/dagre/src/rank/index.js +0 -58
- package/lib/layout/dagre/src/rank/index.js.map +0 -1
- package/lib/layout/dagre/src/rank/network-simplex.d.ts +0 -9
- package/lib/layout/dagre/src/rank/network-simplex.js +0 -205
- package/lib/layout/dagre/src/rank/network-simplex.js.map +0 -1
- package/lib/layout/dagre/src/rank/util.d.ts +0 -11
- package/lib/layout/dagre/src/rank/util.js +0 -146
- package/lib/layout/dagre/src/rank/util.js.map +0 -1
- package/lib/layout/dagre/src/util.d.ts +0 -31
- package/lib/layout/dagre/src/util.js +0 -280
- package/lib/layout/dagre/src/util.js.map +0 -1
- package/lib/layout/dagre.d.ts +0 -71
- package/lib/layout/dagre.js +0 -462
- package/lib/layout/dagre.js.map +0 -1
- package/lib/layout/dagreCompound.d.ts +0 -121
- package/lib/layout/dagreCompound.js +0 -429
- package/lib/layout/dagreCompound.js.map +0 -1
- package/lib/layout/er/core.d.ts +0 -1
- package/lib/layout/er/core.js +0 -147
- package/lib/layout/er/core.js.map +0 -1
- package/lib/layout/er/forceGrid.d.ts +0 -8
- package/lib/layout/er/forceGrid.js +0 -97
- package/lib/layout/er/forceGrid.js.map +0 -1
- package/lib/layout/er/grid.d.ts +0 -26
- package/lib/layout/er/grid.js +0 -177
- package/lib/layout/er/grid.js.map +0 -1
- package/lib/layout/er/index.d.ts +0 -29
- package/lib/layout/er/index.js +0 -80
- package/lib/layout/er/index.js.map +0 -1
- package/lib/layout/er/mysqlWorkbench.d.ts +0 -6
- package/lib/layout/er/mysqlWorkbench.js +0 -326
- package/lib/layout/er/mysqlWorkbench.js.map +0 -1
- package/lib/layout/er/type.d.ts +0 -35
- package/lib/layout/er/type.js +0 -3
- package/lib/layout/er/type.js.map +0 -1
- package/lib/layout/force/force-in-a-box.d.ts +0 -28
- package/lib/layout/force/force-in-a-box.js +0 -357
- package/lib/layout/force/force-in-a-box.js.map +0 -1
- package/lib/layout/force/force.d.ts +0 -100
- package/lib/layout/force/force.js +0 -388
- package/lib/layout/force/force.js.map +0 -1
- package/lib/layout/force/index.d.ts +0 -1
- package/lib/layout/force/index.js +0 -18
- package/lib/layout/force/index.js.map +0 -1
- package/lib/layout/force2/ForceNBody.d.ts +0 -7
- package/lib/layout/force2/ForceNBody.js +0 -98
- package/lib/layout/force2/ForceNBody.js.map +0 -1
- package/lib/layout/force2/index.d.ts +0 -119
- package/lib/layout/force2/index.js +0 -643
- package/lib/layout/force2/index.js.map +0 -1
- package/lib/layout/forceAtlas2/body.d.ts +0 -33
- package/lib/layout/forceAtlas2/body.js +0 -93
- package/lib/layout/forceAtlas2/body.js.map +0 -1
- package/lib/layout/forceAtlas2/index.d.ts +0 -115
- package/lib/layout/forceAtlas2/index.js +0 -509
- package/lib/layout/forceAtlas2/index.js.map +0 -1
- package/lib/layout/forceAtlas2/quad.d.ts +0 -27
- package/lib/layout/forceAtlas2/quad.js +0 -100
- package/lib/layout/forceAtlas2/quad.js.map +0 -1
- package/lib/layout/forceAtlas2/quadTree.d.ts +0 -20
- package/lib/layout/forceAtlas2/quadTree.js +0 -107
- package/lib/layout/forceAtlas2/quadTree.js.map +0 -1
- package/lib/layout/fruchterman.d.ts +0 -73
- package/lib/layout/fruchterman.js +0 -320
- package/lib/layout/fruchterman.js.map +0 -1
- package/lib/layout/gForce.d.ts +0 -96
- package/lib/layout/gForce.js +0 -421
- package/lib/layout/gForce.js.map +0 -1
- package/lib/layout/gpu/fruchterman.d.ts +0 -57
- package/lib/layout/gpu/fruchterman.js +0 -361
- package/lib/layout/gpu/fruchterman.js.map +0 -1
- package/lib/layout/gpu/fruchtermanShader.d.ts +0 -4
- package/lib/layout/gpu/fruchtermanShader.js +0 -8
- package/lib/layout/gpu/fruchtermanShader.js.map +0 -1
- package/lib/layout/gpu/gForce.d.ts +0 -68
- package/lib/layout/gpu/gForce.js +0 -415
- package/lib/layout/gpu/gForce.js.map +0 -1
- package/lib/layout/gpu/gForceShader.d.ts +0 -4
- package/lib/layout/gpu/gForceShader.js +0 -8
- package/lib/layout/gpu/gForceShader.js.map +0 -1
- package/lib/layout/grid.d.ts +0 -83
- package/lib/layout/grid.js +0 -339
- package/lib/layout/grid.js.map +0 -1
- package/lib/layout/index.d.ts +0 -22
- package/lib/layout/index.js +0 -59
- package/lib/layout/index.js.map +0 -1
- package/lib/layout/layout.d.ts +0 -26
- package/lib/layout/layout.js +0 -102
- package/lib/layout/layout.js.map +0 -1
- package/lib/layout/mds.d.ts +0 -39
- package/lib/layout/mds.js +0 -144
- package/lib/layout/mds.js.map +0 -1
- package/lib/layout/radial/index.d.ts +0 -1
- package/lib/layout/radial/index.js +0 -18
- package/lib/layout/radial/index.js.map +0 -1
- package/lib/layout/radial/mds.d.ts +0 -15
- package/lib/layout/radial/mds.js +0 -42
- package/lib/layout/radial/mds.js.map +0 -1
- package/lib/layout/radial/radial.d.ts +0 -74
- package/lib/layout/radial/radial.js +0 -445
- package/lib/layout/radial/radial.js.map +0 -1
- package/lib/layout/radial/radialNonoverlapForce.d.ts +0 -50
- package/lib/layout/radial/radialNonoverlapForce.js +0 -127
- package/lib/layout/radial/radialNonoverlapForce.js.map +0 -1
- package/lib/layout/random.d.ts +0 -35
- package/lib/layout/random.js +0 -84
- package/lib/layout/random.js.map +0 -1
- package/lib/layout/types.d.ts +0 -432
- package/lib/layout/types.js +0 -3
- package/lib/layout/types.js.map +0 -1
- package/lib/registy/index.d.ts +0 -3
- package/lib/registy/index.js +0 -65
- package/lib/registy/index.js.map +0 -1
- package/lib/util/array.js +0 -5
- package/lib/util/array.js.map +0 -1
- package/lib/util/function.js +0 -65
- package/lib/util/function.js.map +0 -1
- package/lib/util/gpu.js +0 -250
- package/lib/util/gpu.js.map +0 -1
- package/lib/util/index.js +0 -23
- package/lib/util/index.js.map +0 -1
- package/lib/util/math.js +0 -289
- package/lib/util/math.js.map +0 -1
- package/lib/util/number.js +0 -13
- package/lib/util/number.js.map +0 -1
- package/lib/util/object.js +0 -43
- package/lib/util/object.js.map +0 -1
- package/lib/util/string.js +0 -20
- package/lib/util/string.js.map +0 -1
- package/src/index.ts +0 -7
- package/src/layout/base.ts +0 -57
- package/src/layout/circular.ts +0 -370
- package/src/layout/comboCombined.ts +0 -397
- package/src/layout/comboForce.ts +0 -873
- package/src/layout/concentric.ts +0 -289
- package/src/layout/constants.ts +0 -22
- package/src/layout/dagre/graph.ts +0 -104
- package/src/layout/dagre/index.ts +0 -31
- package/src/layout/dagre/src/acyclic.ts +0 -58
- package/src/layout/dagre/src/add-border-segments.ts +0 -47
- package/src/layout/dagre/src/coordinate-system.ts +0 -77
- package/src/layout/dagre/src/data/list.ts +0 -60
- package/src/layout/dagre/src/debug.ts +0 -30
- package/src/layout/dagre/src/greedy-fas.ts +0 -144
- package/src/layout/dagre/src/layout.ts +0 -579
- package/src/layout/dagre/src/nesting-graph.ts +0 -143
- package/src/layout/dagre/src/normalize.ts +0 -96
- package/src/layout/dagre/src/order/add-subgraph-constraints.ts +0 -29
- package/src/layout/dagre/src/order/barycenter.ts +0 -26
- package/src/layout/dagre/src/order/build-layer-graph.ts +0 -82
- package/src/layout/dagre/src/order/cross-count.ts +0 -77
- package/src/layout/dagre/src/order/index.ts +0 -105
- package/src/layout/dagre/src/order/init-data-order.ts +0 -27
- package/src/layout/dagre/src/order/init-order.ts +0 -56
- package/src/layout/dagre/src/order/resolve-conflicts.ts +0 -152
- package/src/layout/dagre/src/order/sort-subgraph.ts +0 -105
- package/src/layout/dagre/src/order/sort.ts +0 -76
- package/src/layout/dagre/src/parent-dummy-chains.ts +0 -102
- package/src/layout/dagre/src/position/bk.ts +0 -493
- package/src/layout/dagre/src/position/index.ts +0 -82
- package/src/layout/dagre/src/rank/feasible-tree.ts +0 -165
- package/src/layout/dagre/src/rank/index.ts +0 -54
- package/src/layout/dagre/src/rank/network-simplex.ts +0 -225
- package/src/layout/dagre/src/rank/util.ts +0 -166
- package/src/layout/dagre/src/util.ts +0 -309
- package/src/layout/dagre.ts +0 -460
- package/src/layout/dagreCompound.ts +0 -518
- package/src/layout/er/core.ts +0 -117
- package/src/layout/er/forceGrid.ts +0 -95
- package/src/layout/er/grid.ts +0 -185
- package/src/layout/er/index.ts +0 -68
- package/src/layout/er/mysqlWorkbench.ts +0 -345
- package/src/layout/er/type.ts +0 -39
- package/src/layout/force/force-in-a-box.ts +0 -400
- package/src/layout/force/force.ts +0 -391
- package/src/layout/force/index.ts +0 -1
- package/src/layout/force2/ForceNBody.ts +0 -128
- package/src/layout/force2/index.ts +0 -741
- package/src/layout/forceAtlas2/body.ts +0 -115
- package/src/layout/forceAtlas2/index.ts +0 -556
- package/src/layout/forceAtlas2/quad.ts +0 -115
- package/src/layout/forceAtlas2/quadTree.ts +0 -107
- package/src/layout/fruchterman.ts +0 -361
- package/src/layout/gForce.ts +0 -488
- package/src/layout/gpu/fruchterman.ts +0 -314
- package/src/layout/gpu/fruchtermanShader.ts +0 -203
- package/src/layout/gpu/gForce.ts +0 -407
- package/src/layout/gpu/gForceShader.ts +0 -220
- package/src/layout/grid.ts +0 -404
- package/src/layout/index.ts +0 -47
- package/src/layout/layout.ts +0 -110
- package/src/layout/mds.ts +0 -140
- package/src/layout/radial/index.ts +0 -1
- package/src/layout/radial/mds.ts +0 -51
- package/src/layout/radial/radial.ts +0 -500
- package/src/layout/radial/radialNonoverlapForce.ts +0 -189
- package/src/layout/random.ts +0 -75
- package/src/layout/types.ts +0 -496
- package/src/registy/index.ts +0 -43
- package/src/util/array.ts +0 -1
- package/src/util/function.ts +0 -64
- package/src/util/gpu.ts +0 -256
- package/src/util/index.ts +0 -6
- package/src/util/math.ts +0 -294
- package/src/util/number.ts +0 -8
- package/src/util/object.ts +0 -28
- package/src/util/string.ts +0 -18
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// "use strict";
|
|
2
|
-
// var rankUtil = require("./util");
|
|
3
|
-
// var longestPath = rankUtil.longestPathWithLayer;
|
|
4
|
-
// var feasibleTree = require("./feasible-tree").feasibleTreeWithLayer;
|
|
5
|
-
// var networkSimplex = require("./network-simplex");
|
|
6
|
-
import { longestPath, longestPathWithLayer } from './util';
|
|
7
|
-
import { feasibleTreeWithLayer as feasibleTree } from './feasible-tree';
|
|
8
|
-
import networkSimplex from './network-simplex';
|
|
9
|
-
/*
|
|
10
|
-
* Assigns a rank to each node in the input graph that respects the "minlen"
|
|
11
|
-
* constraint specified on edges between nodes.
|
|
12
|
-
*
|
|
13
|
-
* This basic structure is derived from Gansner, et al., "A Technique for
|
|
14
|
-
* Drawing Directed Graphs."
|
|
15
|
-
*
|
|
16
|
-
* Pre-conditions:
|
|
17
|
-
*
|
|
18
|
-
* 1. Graph must be a connected DAG
|
|
19
|
-
* 2. Graph nodes must be objects
|
|
20
|
-
* 3. Graph edges must have "weight" and "minlen" attributes
|
|
21
|
-
*
|
|
22
|
-
* Post-conditions:
|
|
23
|
-
*
|
|
24
|
-
* 1. Graph nodes will have a "rank" attribute based on the results of the
|
|
25
|
-
* algorithm. Ranks can start at any index (including negative), we'll
|
|
26
|
-
* fix them up later.
|
|
27
|
-
*/
|
|
28
|
-
const rank = (g) => {
|
|
29
|
-
switch (g.graph().ranker) {
|
|
30
|
-
case "network-simplex":
|
|
31
|
-
networkSimplexRanker(g);
|
|
32
|
-
break;
|
|
33
|
-
case "tight-tree":
|
|
34
|
-
tightTreeRanker(g);
|
|
35
|
-
break;
|
|
36
|
-
case "longest-path":
|
|
37
|
-
longestPathRanker(g);
|
|
38
|
-
break;
|
|
39
|
-
// default: networkSimplexRanker(g);
|
|
40
|
-
default: tightTreeRanker(g);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
// A fast and simple ranker, but results are far from optimal.
|
|
44
|
-
const longestPathRanker = longestPath;
|
|
45
|
-
const tightTreeRanker = (g) => {
|
|
46
|
-
longestPathWithLayer(g);
|
|
47
|
-
feasibleTree(g);
|
|
48
|
-
};
|
|
49
|
-
const networkSimplexRanker = (g) => {
|
|
50
|
-
networkSimplex(g);
|
|
51
|
-
};
|
|
52
|
-
export default rank;
|
|
53
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/layout/dagre/src/rank/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAEhB,oCAAoC;AACpC,mDAAmD;AACnD,uEAAuE;AACvE,qDAAqD;AAErD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,qBAAqB,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,IAAI,GAAG,CAAC,CAAQ,EAAE,EAAE;IACxB,QAAO,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE;QACzB,KAAK,iBAAiB;YAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM;QACvD,KAAK,YAAY;YAAE,eAAe,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM;QAC7C,KAAK,cAAc;YAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM;QACjD,oCAAoC;QACpC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;KAC3B;AACH,CAAC,CAAC;AAEF,8DAA8D;AAC9D,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,MAAM,eAAe,GAAG,CAAC,CAAQ,EAAE,EAAE;IACnC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACxB,YAAY,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,CAAQ,EAAE,EAAE;IACxC,cAAc,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Edge, Graph } from '../../graph';
|
|
2
|
-
declare const networkSimplex: (og: Graph) => void;
|
|
3
|
-
export declare const initCutValues: (t: Graph, g: Graph) => void;
|
|
4
|
-
export declare const calcCutValue: (t: Graph, g: Graph, child: string) => number;
|
|
5
|
-
export declare const initLowLimValues: (tree: Graph, root?: string) => void;
|
|
6
|
-
export declare const leaveEdge: (tree: Graph) => import("@antv/graphlib/lib/Graph").DefaultEdgeType<string, Partial<import("../../graph").EdgeConfig & Edge & import("../../graph").GraphEdge>> | undefined;
|
|
7
|
-
export declare const enterEdge: (t: Graph, g: Graph, edge: any) => import("@antv/graphlib/lib/Graph").DefaultEdgeType<string, Partial<import("../../graph").EdgeConfig & Edge & import("../../graph").GraphEdge>>;
|
|
8
|
-
export declare const exchangeEdges: (t: Graph, g: Graph, e: Edge, f: Edge) => void;
|
|
9
|
-
export default networkSimplex;
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { feasibleTree } from './feasible-tree';
|
|
2
|
-
import { slack, longestPath as initRank } from './util';
|
|
3
|
-
import { minBy, simplify } from '../util';
|
|
4
|
-
import { algorithm } from '@antv/graphlib';
|
|
5
|
-
const { preorder, postorder } = algorithm;
|
|
6
|
-
/*
|
|
7
|
-
* The network simplex algorithm assigns ranks to each node in the input graph
|
|
8
|
-
* and iteratively improves the ranking to reduce the length of edges.
|
|
9
|
-
*
|
|
10
|
-
* Preconditions:
|
|
11
|
-
*
|
|
12
|
-
* 1. The input graph must be a DAG.
|
|
13
|
-
* 2. All nodes in the graph must have an object value.
|
|
14
|
-
* 3. All edges in the graph must have "minlen" and "weight" attributes.
|
|
15
|
-
*
|
|
16
|
-
* Postconditions:
|
|
17
|
-
*
|
|
18
|
-
* 1. All nodes in the graph will have an assigned "rank" attribute that has
|
|
19
|
-
* been optimized by the network simplex algorithm. Ranks start at 0.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* A rough sketch of the algorithm is as follows:
|
|
23
|
-
*
|
|
24
|
-
* 1. Assign initial ranks to each node. We use the longest path algorithm,
|
|
25
|
-
* which assigns ranks to the lowest position possible. In general this
|
|
26
|
-
* leads to very wide bottom ranks and unnecessarily long edges.
|
|
27
|
-
* 2. Construct a feasible tight tree. A tight tree is one such that all
|
|
28
|
-
* edges in the tree have no slack (difference between length of edge
|
|
29
|
-
* and minlen for the edge). This by itself greatly improves the assigned
|
|
30
|
-
* rankings by shorting edges.
|
|
31
|
-
* 3. Iteratively find edges that have negative cut values. Generally a
|
|
32
|
-
* negative cut value indicates that the edge could be removed and a new
|
|
33
|
-
* tree edge could be added to produce a more compact graph.
|
|
34
|
-
*
|
|
35
|
-
* Much of the algorithms here are derived from Gansner, et al., "A Technique
|
|
36
|
-
* for Drawing Directed Graphs." The structure of the file roughly follows the
|
|
37
|
-
* structure of the overall algorithm.
|
|
38
|
-
*/
|
|
39
|
-
const networkSimplex = (og) => {
|
|
40
|
-
const g = simplify(og);
|
|
41
|
-
initRank(g);
|
|
42
|
-
const t = feasibleTree(g);
|
|
43
|
-
initLowLimValues(t);
|
|
44
|
-
initCutValues(t, g);
|
|
45
|
-
let e;
|
|
46
|
-
let f;
|
|
47
|
-
while ((e = leaveEdge(t))) {
|
|
48
|
-
f = enterEdge(t, g, e);
|
|
49
|
-
exchangeEdges(t, g, e, f);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
/*
|
|
53
|
-
* Initializes cut values for all edges in the tree.
|
|
54
|
-
*/
|
|
55
|
-
export const initCutValues = (t, g) => {
|
|
56
|
-
let vs = postorder(t, t.nodes());
|
|
57
|
-
vs = vs === null || vs === void 0 ? void 0 : vs.slice(0, (vs === null || vs === void 0 ? void 0 : vs.length) - 1);
|
|
58
|
-
vs === null || vs === void 0 ? void 0 : vs.forEach((v) => {
|
|
59
|
-
assignCutValue(t, g, v);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const assignCutValue = (t, g, child) => {
|
|
63
|
-
const childLab = t.node(child);
|
|
64
|
-
const parent = childLab.parent;
|
|
65
|
-
t.edgeFromArgs(child, parent).cutvalue = calcCutValue(t, g, child);
|
|
66
|
-
};
|
|
67
|
-
/*
|
|
68
|
-
* Given the tight tree, its graph, and a child in the graph calculate and
|
|
69
|
-
* return the cut value for the edge between the child and its parent.
|
|
70
|
-
*/
|
|
71
|
-
export const calcCutValue = (t, g, child) => {
|
|
72
|
-
var _a;
|
|
73
|
-
const childLab = t.node(child);
|
|
74
|
-
const parent = childLab.parent;
|
|
75
|
-
// True if the child is on the tail end of the edge in the directed graph
|
|
76
|
-
let childIsTail = true;
|
|
77
|
-
// The graph's view of the tree edge we're inspecting
|
|
78
|
-
let graphEdge = g.edgeFromArgs(child, parent);
|
|
79
|
-
// The accumulated cut value for the edge between this node and its parent
|
|
80
|
-
let cutValue = 0;
|
|
81
|
-
if (!graphEdge) {
|
|
82
|
-
childIsTail = false;
|
|
83
|
-
graphEdge = g.edgeFromArgs(parent, child);
|
|
84
|
-
}
|
|
85
|
-
cutValue = graphEdge.weight;
|
|
86
|
-
(_a = g.nodeEdges(child)) === null || _a === void 0 ? void 0 : _a.forEach((e) => {
|
|
87
|
-
const isOutEdge = e.v === child;
|
|
88
|
-
const other = isOutEdge ? e.w : e.v;
|
|
89
|
-
if (other !== parent) {
|
|
90
|
-
const pointsToHead = isOutEdge === childIsTail;
|
|
91
|
-
const otherWeight = g.edge(e).weight;
|
|
92
|
-
cutValue += pointsToHead ? otherWeight : -otherWeight;
|
|
93
|
-
if (isTreeEdge(t, child, other)) {
|
|
94
|
-
const otherCutValue = t.edgeFromArgs(child, other).cutvalue;
|
|
95
|
-
cutValue += pointsToHead ? -otherCutValue : otherCutValue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return cutValue;
|
|
100
|
-
};
|
|
101
|
-
export const initLowLimValues = (tree, root = tree.nodes()[0]) => {
|
|
102
|
-
dfsAssignLowLim(tree, {}, 1, root);
|
|
103
|
-
};
|
|
104
|
-
const dfsAssignLowLim = (tree, visited, nextLim, v, parent) => {
|
|
105
|
-
var _a;
|
|
106
|
-
const low = nextLim;
|
|
107
|
-
let useNextLim = nextLim;
|
|
108
|
-
const label = tree.node(v);
|
|
109
|
-
visited[v] = true;
|
|
110
|
-
(_a = tree.neighbors(v)) === null || _a === void 0 ? void 0 : _a.forEach((w) => {
|
|
111
|
-
if (!visited[w]) {
|
|
112
|
-
useNextLim = dfsAssignLowLim(tree, visited, useNextLim, w, v);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
label.low = low;
|
|
116
|
-
label.lim = useNextLim++;
|
|
117
|
-
if (parent) {
|
|
118
|
-
label.parent = parent;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
// TODO should be able to remove this when we incrementally update low lim
|
|
122
|
-
delete label.parent;
|
|
123
|
-
}
|
|
124
|
-
return useNextLim;
|
|
125
|
-
};
|
|
126
|
-
export const leaveEdge = (tree) => {
|
|
127
|
-
return tree.edges().find((e) => {
|
|
128
|
-
return tree.edge(e).cutvalue < 0;
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
export const enterEdge = (t, g, edge) => {
|
|
132
|
-
let v = edge.v;
|
|
133
|
-
let w = edge.w;
|
|
134
|
-
// For the rest of this function we assume that v is the tail and w is the
|
|
135
|
-
// head, so if we don't have this edge in the graph we should flip it to
|
|
136
|
-
// match the correct orientation.
|
|
137
|
-
if (!g.hasEdge(v, w)) {
|
|
138
|
-
v = edge.w;
|
|
139
|
-
w = edge.v;
|
|
140
|
-
}
|
|
141
|
-
const vLabel = t.node(v);
|
|
142
|
-
const wLabel = t.node(w);
|
|
143
|
-
let tailLabel = vLabel;
|
|
144
|
-
let flip = false;
|
|
145
|
-
// If the root is in the tail of the edge then we need to flip the logic that
|
|
146
|
-
// checks for the head and tail nodes in the candidates function below.
|
|
147
|
-
if (vLabel.lim > wLabel.lim) {
|
|
148
|
-
tailLabel = wLabel;
|
|
149
|
-
flip = true;
|
|
150
|
-
}
|
|
151
|
-
const candidates = g.edges().filter((edge) => {
|
|
152
|
-
return flip === isDescendant(t, t.node(edge.v), tailLabel) &&
|
|
153
|
-
flip !== isDescendant(t, t.node(edge.w), tailLabel);
|
|
154
|
-
});
|
|
155
|
-
return minBy(candidates, (edge) => { return slack(g, edge); });
|
|
156
|
-
};
|
|
157
|
-
export const exchangeEdges = (t, g, e, f) => {
|
|
158
|
-
const v = e.v;
|
|
159
|
-
const w = e.w;
|
|
160
|
-
t.removeEdge(v, w);
|
|
161
|
-
t.setEdge(f.v, f.w, {});
|
|
162
|
-
initLowLimValues(t);
|
|
163
|
-
initCutValues(t, g);
|
|
164
|
-
updateRanks(t, g);
|
|
165
|
-
};
|
|
166
|
-
const updateRanks = (t, g) => {
|
|
167
|
-
const root = t.nodes().find((v) => { var _a; return !((_a = g.node(v)) === null || _a === void 0 ? void 0 : _a.parent); });
|
|
168
|
-
let vs = preorder(t, root);
|
|
169
|
-
vs = vs === null || vs === void 0 ? void 0 : vs.slice(1);
|
|
170
|
-
vs === null || vs === void 0 ? void 0 : vs.forEach((v) => {
|
|
171
|
-
const parent = t.node(v).parent;
|
|
172
|
-
let edge = g.edgeFromArgs(v, parent);
|
|
173
|
-
let flipped = false;
|
|
174
|
-
if (!edge) {
|
|
175
|
-
edge = g.edgeFromArgs(parent, v);
|
|
176
|
-
flipped = true;
|
|
177
|
-
}
|
|
178
|
-
g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
/*
|
|
182
|
-
* Returns true if the edge is in the tree.
|
|
183
|
-
*/
|
|
184
|
-
const isTreeEdge = (tree, u, v) => {
|
|
185
|
-
return tree.hasEdge(u, v);
|
|
186
|
-
};
|
|
187
|
-
/*
|
|
188
|
-
* Returns true if the specified node is descendant of the root node per the
|
|
189
|
-
* assigned low and lim attributes in the tree.
|
|
190
|
-
*/
|
|
191
|
-
const isDescendant = (tree, vLabel, rootLabel) => {
|
|
192
|
-
return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
|
|
193
|
-
};
|
|
194
|
-
export default networkSimplex;
|
|
195
|
-
//# sourceMappingURL=network-simplex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network-simplex.js","sourceRoot":"","sources":["../../../../../src/layout/dagre/src/rank/network-simplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC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AG,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC;AACpE,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Edge, Graph } from "../../graph";
|
|
2
|
-
declare const longestPath: (g: Graph) => void;
|
|
3
|
-
declare const longestPathWithLayer: (g: Graph) => void;
|
|
4
|
-
declare const slack: (g: Graph, e: Edge) => number;
|
|
5
|
-
export { longestPath, longestPathWithLayer, slack };
|
|
6
|
-
declare const _default: {
|
|
7
|
-
longestPath: (g: Graph) => void;
|
|
8
|
-
longestPathWithLayer: (g: Graph) => void;
|
|
9
|
-
slack: (g: Graph, e: Edge) => number;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Initializes ranks for the input graph using the longest path algorithm. This
|
|
3
|
-
* algorithm scales well and is fast in practice, it yields rather poor
|
|
4
|
-
* solutions. Nodes are pushed to the lowest layer possible, leaving the bottom
|
|
5
|
-
* ranks wide and leaving edges longer than necessary. However, due to its
|
|
6
|
-
* speed, this algorithm is good for getting an initial ranking that can be fed
|
|
7
|
-
* into other algorithms.
|
|
8
|
-
*
|
|
9
|
-
* This algorithm does not normalize layers because it will be used by other
|
|
10
|
-
* algorithms in most cases. If using this algorithm directly, be sure to
|
|
11
|
-
* run normalize at the end.
|
|
12
|
-
*
|
|
13
|
-
* Pre-conditions:
|
|
14
|
-
*
|
|
15
|
-
* 1. Input graph is a DAG.
|
|
16
|
-
* 2. Input graph node labels can be assigned properties.
|
|
17
|
-
*
|
|
18
|
-
* Post-conditions:
|
|
19
|
-
*
|
|
20
|
-
* 1. Each node will be assign an (unnormalized) "rank" property.
|
|
21
|
-
*/
|
|
22
|
-
const longestPath = (g) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const visited = {};
|
|
25
|
-
const dfs = (v) => {
|
|
26
|
-
var _a;
|
|
27
|
-
const label = g.node(v);
|
|
28
|
-
if (!label)
|
|
29
|
-
return 0;
|
|
30
|
-
if (visited[v]) {
|
|
31
|
-
return label.rank;
|
|
32
|
-
}
|
|
33
|
-
visited[v] = true;
|
|
34
|
-
let rank;
|
|
35
|
-
(_a = g.outEdges(v)) === null || _a === void 0 ? void 0 : _a.forEach((edgeObj) => {
|
|
36
|
-
const wRank = dfs(edgeObj.w);
|
|
37
|
-
const minLen = g.edge(edgeObj).minlen;
|
|
38
|
-
const r = wRank - minLen;
|
|
39
|
-
if (r) {
|
|
40
|
-
if (rank === undefined || r < rank) {
|
|
41
|
-
rank = r;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
if (!rank) {
|
|
46
|
-
rank = 0;
|
|
47
|
-
}
|
|
48
|
-
label.rank = rank;
|
|
49
|
-
return rank;
|
|
50
|
-
};
|
|
51
|
-
(_a = g.sources()) === null || _a === void 0 ? void 0 : _a.forEach((source) => dfs(source));
|
|
52
|
-
};
|
|
53
|
-
const longestPathWithLayer = (g) => {
|
|
54
|
-
var _a;
|
|
55
|
-
// 用longest path,找出最深的点
|
|
56
|
-
const visited = {};
|
|
57
|
-
let minRank;
|
|
58
|
-
const dfs = (v) => {
|
|
59
|
-
var _a;
|
|
60
|
-
const label = g.node(v);
|
|
61
|
-
if (!label)
|
|
62
|
-
return 0;
|
|
63
|
-
if (visited[v]) {
|
|
64
|
-
return label.rank;
|
|
65
|
-
}
|
|
66
|
-
visited[v] = true;
|
|
67
|
-
let rank;
|
|
68
|
-
(_a = g.outEdges(v)) === null || _a === void 0 ? void 0 : _a.forEach((edgeObj) => {
|
|
69
|
-
const wRank = dfs(edgeObj.w);
|
|
70
|
-
const minLen = g.edge(edgeObj).minlen;
|
|
71
|
-
const r = wRank - minLen;
|
|
72
|
-
if (r) {
|
|
73
|
-
if (rank === undefined || r < rank) {
|
|
74
|
-
rank = r;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
if (!rank) {
|
|
79
|
-
rank = 0;
|
|
80
|
-
}
|
|
81
|
-
if (minRank === undefined || rank < minRank) {
|
|
82
|
-
minRank = rank;
|
|
83
|
-
}
|
|
84
|
-
label.rank = rank;
|
|
85
|
-
return rank;
|
|
86
|
-
};
|
|
87
|
-
(_a = g.sources()) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
|
|
88
|
-
if (g.node(source))
|
|
89
|
-
dfs(source);
|
|
90
|
-
});
|
|
91
|
-
if (minRank === undefined) {
|
|
92
|
-
minRank = 0;
|
|
93
|
-
}
|
|
94
|
-
// minRank += 1; // NOTE: 最小的层级是dummy root,+1
|
|
95
|
-
// forward一遍,赋值层级
|
|
96
|
-
const forwardVisited = {};
|
|
97
|
-
const dfsForward = (v, nextRank) => {
|
|
98
|
-
var _a;
|
|
99
|
-
const label = g.node(v);
|
|
100
|
-
const currRank = (!isNaN(label.layer) ? label.layer : nextRank);
|
|
101
|
-
// 没有指定,取最大值
|
|
102
|
-
if (label.rank === undefined || label.rank < currRank) {
|
|
103
|
-
label.rank = currRank;
|
|
104
|
-
}
|
|
105
|
-
if (forwardVisited[v])
|
|
106
|
-
return;
|
|
107
|
-
forwardVisited[v] = true;
|
|
108
|
-
// DFS遍历子节点
|
|
109
|
-
(_a = g.outEdges(v)) === null || _a === void 0 ? void 0 : _a.map((e) => {
|
|
110
|
-
dfsForward(e.w, currRank + g.edge(e).minlen);
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
// 指定层级的,更新下游
|
|
114
|
-
g.nodes().forEach((n) => {
|
|
115
|
-
const label = g.node(n);
|
|
116
|
-
if (!label)
|
|
117
|
-
return;
|
|
118
|
-
if (!isNaN(label.layer)) {
|
|
119
|
-
dfsForward(n, label.layer); // 默认的dummy root所在层的rank是-1
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
label.rank -= minRank;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
/*
|
|
127
|
-
* Returns the amount of slack for the given edge. The slack is defined as the
|
|
128
|
-
* difference between the length of the edge and its minimum length.
|
|
129
|
-
*/
|
|
130
|
-
const slack = (g, e) => {
|
|
131
|
-
return (g.node(e.w).rank -
|
|
132
|
-
g.node(e.v).rank -
|
|
133
|
-
g.edge(e).minlen);
|
|
134
|
-
};
|
|
135
|
-
export { longestPath, longestPathWithLayer, slack };
|
|
136
|
-
export default {
|
|
137
|
-
longestPath,
|
|
138
|
-
longestPathWithLayer,
|
|
139
|
-
slack,
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../../src/layout/dagre/src/rank/util.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAE,EAAE;;IAC/B,MAAM,OAAO,GAA4B,EAAE,CAAC;IAE5C,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE;;QACxB,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;QACzB,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,CAAC;QACrB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YACd,OAAO,KAAK,CAAC,IAAK,CAAC;SACpB;QACD,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAElB,IAAI,IAAY,CAAC;QAEjB,MAAA,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,OAAO,CACpB,CAAC,OAAO,EAAE,EAAE;YACV,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAE,CAAC,MAAO,CAAC;YACxC,MAAM,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;YACzB,IAAI,CAAC,EAAE;gBACL,I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AAC,EAAE,EAAE;YACvB,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,MAAO,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,aAAa;IACb,CAAC,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;QACzB,IAAG,CAAC,KAAK;YAAE,OAAO;QAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAe,CAAC,EAAE;YACjC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC,2BAA2B;SAClE;aAAM;YACJ,KAAK,CAAC,IAAe,IAAI,OAAO,CAAC;SACnC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,KAAK,GAAG,CAAC,CAAQ,EAAE,CAAO,EAAE,EAAE;IAClC,OAAO,CACJ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,IAAe;QAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,IAAe;QAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,MAAiB,CAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEpD,eAAe;IACb,WAAW;IACX,oBAAoB;IACpB,KAAK;CACN,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Graph, Node } from "../graph";
|
|
2
|
-
export declare const addDummyNode: (g: Graph, type: string, attrs: Node<Record<string, any>>, name: string) => string;
|
|
3
|
-
export declare const simplify: (g: Graph) => Graph;
|
|
4
|
-
export declare const asNonCompoundGraph: (g: Graph) => Graph;
|
|
5
|
-
export declare const zipObject: <T = any>(keys: string[], values: T[]) => Record<string, T>;
|
|
6
|
-
export declare const successorWeights: (g: Graph) => Record<string, Record<string, number>>;
|
|
7
|
-
export declare const predecessorWeights: (g: Graph) => Record<string, Record<string, number>>;
|
|
8
|
-
export declare const intersectRect: (rect: {
|
|
9
|
-
x?: number;
|
|
10
|
-
y?: number;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
}, point: {
|
|
14
|
-
x?: number;
|
|
15
|
-
y?: number;
|
|
16
|
-
}) => {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
};
|
|
20
|
-
export declare const buildLayerMatrix: (g: Graph) => string[][];
|
|
21
|
-
export declare const normalizeRanks: (g: Graph) => void;
|
|
22
|
-
export declare const removeEmptyRanks: (g: Graph) => void;
|
|
23
|
-
export declare const addBorderNode: (g: Graph, prefix: string, rank?: number, order?: number) => string;
|
|
24
|
-
export declare const maxRank: (g: Graph) => number;
|
|
25
|
-
export declare const partition: <T = any>(collection: T[], fn: (val: T) => boolean) => {
|
|
26
|
-
lhs: T[];
|
|
27
|
-
rhs: T[];
|
|
28
|
-
};
|
|
29
|
-
export declare const time: (name: string, fn: () => void) => void;
|
|
30
|
-
export declare const notime: (name: string, fn: () => void) => void;
|
|
31
|
-
export declare const minBy: <T = any>(array: T[], func: (param: T) => number) => T;
|