@neo4j-nvl/base 1.2.2 → 2.0.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/CHANGELOG.md +31 -1
- package/dist/base.mjs +1 -1
- package/dist/types/index.d.ts +21 -20
- package/dist/types/layouts/animatedlayout/AnimatedLayout.d.ts +2 -2
- package/dist/types/layouts/d3forcelayout/constants.d.ts +0 -1
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +3 -3
- package/dist/types/layouts/forcedirectedlayout/PhysLayout.d.ts +275 -0
- package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.d.ts +62 -0
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.d.ts +56 -0
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.d.ts +143 -0
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.test.d.ts +1 -0
- package/dist/types/layouts/forcedirectedlayout/{physlayout/solarmerger → clustering}/types.d.ts +11 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-fragment.d.ts +2 -0
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-repulsive-fragment.d.ts +2 -0
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-update-fragment.d.ts +2 -0
- package/dist/types/layouts/forcedirectedlayout/shaders/sim-vertex.d.ts +2 -0
- package/dist/types/layouts/freeLayout/FreeLayout.d.ts +2 -4
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +2 -6
- package/dist/types/layouts/hierarchicallayout/HierarchicalLayout.d.ts +5 -0
- package/dist/types/modules/ExternalCallbackHandler.d.ts +4 -10
- package/dist/types/modules/NvlController.d.ts +85 -5
- package/dist/types/modules/Shader.d.ts +1 -1
- package/dist/types/modules/dataset.d.ts +4 -2
- package/dist/types/modules/state/types.d.ts +118 -25
- package/dist/types/renderers/ClusterOverlay.d.ts +73 -0
- package/dist/types/renderers/ClusterOverlay.test.d.ts +1 -0
- package/dist/types/renderers/domrenderer/shared/ImageCache.d.ts +1 -0
- package/dist/types/renderers/domrenderer/shared/types.d.ts +1 -2
- package/dist/types/renderers/webglrenderer/Controller.d.ts +27 -6
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.d.ts +14 -0
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.test.d.ts +1 -0
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +43 -3
- package/dist/types/renderers/webglrenderer/node-animation-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-animation-vertex.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-fragment-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-vertex-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-fragment-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-glsl-utils.d.ts +1 -0
- package/dist/types/renderers/webglrenderer/rel-vertex-arrow.d.ts +2 -0
- package/dist/types/renderers/webglrenderer/rel-vertex-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-vertex.d.ts +1 -1
- package/dist/types/types/graph-element.d.ts +9 -1
- package/dist/types/types/nvl-window-functions.d.ts +2 -2
- package/dist/types/utils/canvasManagement.d.ts +1 -1
- package/dist/types/utils/clusterGeometry.d.ts +14 -0
- package/dist/types/utils/clusterGeometry.test.d.ts +1 -0
- package/dist/types/utils/clusterHitRegions.d.ts +42 -0
- package/dist/types/utils/clusterHitRegions.test.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +6 -0
- package/dist/types/utils/geometry.d.ts +44 -1
- package/dist/types/utils/hittest.d.ts +30 -4
- package/dist/types/utils/jsDriverResultTransformer.d.ts +11 -9
- package/dist/types/utils/layoutSeeding.d.ts +7 -0
- package/dist/types/utils/layoutSeeding.test.d.ts +1 -0
- package/dist/types/utils/webWorkerUtils.d.ts +1 -1
- package/dist/types/utils/zoomFunctions.d.ts +9 -2
- package/package.json +3 -3
- package/dist/types/layouts/forcedirectedlayout/ForceCytoLayout.d.ts +0 -22
- package/dist/types/layouts/forcedirectedlayout/cosebilkentlayout/CoseBilkentLayout.d.ts +0 -33
- package/dist/types/layouts/forcedirectedlayout/physlayout/PhysLayout.d.ts +0 -174
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-fragment.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-update-fragment.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/sim-vertex.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/workaround-fragment.d.ts +0 -2
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/SolarMerger.d.ts +0 -21
- package/dist/types/layouts/forcedirectedlayout/physlayout/solarmerger/solar-placer.d.ts +0 -2
- /package/dist/types/layouts/forcedirectedlayout/{physlayout/PhysLayout.test.d.ts → PhysLayout.test.d.ts} +0 -0
- /package/dist/types/layouts/forcedirectedlayout/{physlayout/solarmerger/SolarMerger.bench.d.ts → clustering/ClusterByMerger.test.d.ts} +0 -0
- /package/dist/types/layouts/forcedirectedlayout/{physlayout/solarmerger/SolarMerger.test.d.ts → clustering/SolarMerger.bench.d.ts} +0 -0
- /package/dist/types/layouts/forcedirectedlayout/{physlayout/solarmerger/solar-placer.test.d.ts → clustering/SolarMerger.test.d.ts} +0 -0
- /package/dist/types/layouts/forcedirectedlayout/{physlayout/glwrapper.d.ts → glwrapper.d.ts} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CoarsenedGraph, type Sun } from '../layouts/forcedirectedlayout/clustering/types';
|
|
2
|
+
import type { Cluster, ClusterId } from '../modules/state/types';
|
|
3
|
+
import type { Node } from '../types/graph-element';
|
|
4
|
+
import { type ClusterMemberDisk } from './clusterGeometry';
|
|
5
|
+
import { type Point } from './geometry';
|
|
6
|
+
/**
|
|
7
|
+
* A fitted cluster hull region used for decoration and hit-testing.
|
|
8
|
+
*/
|
|
9
|
+
export type ClusterHitRegion = Cluster & {
|
|
10
|
+
/** Convex hull used for picking / decoration. */
|
|
11
|
+
hull: Point[];
|
|
12
|
+
/** Layout sun original id (e.g. `synth-sun:${id}`). */
|
|
13
|
+
sunOriginalId: string;
|
|
14
|
+
};
|
|
15
|
+
export type MultiMemberCluster = {
|
|
16
|
+
sun: Sun;
|
|
17
|
+
nodeIds: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns each multi-member first-level sun system in a coarsening hierarchy.
|
|
21
|
+
* @param firstSubGraphLevel - `subGraphs[1]` from the current layout coarsening hierarchy.
|
|
22
|
+
* @returns Suns paired with their original member node ids.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getMultiMemberClusters: (firstSubGraphLevel: CoarsenedGraph) => MultiMemberCluster[];
|
|
25
|
+
/**
|
|
26
|
+
* Collects member disks with usable positions for hull fitting.
|
|
27
|
+
* @param nodeIds - Member node ids.
|
|
28
|
+
* @param idToPosition - Node id to position map.
|
|
29
|
+
* @param idToItem - Node id to graph node map.
|
|
30
|
+
* @returns Member disks for {@link fitClusterHull}.
|
|
31
|
+
*/
|
|
32
|
+
export declare const collectMemberDisks: (nodeIds: string[], idToPosition: Readonly<Record<string, Point>>, idToItem: Record<string, Node>) => ClusterMemberDisk[];
|
|
33
|
+
/**
|
|
34
|
+
* Builds hit regions for {@link ClusteringOptions.clusterBy} multi-member clusters.
|
|
35
|
+
* Structural {@link SolarMerger} suns are skipped, as they have no entry in `clusterIdsBySun`.
|
|
36
|
+
* @param subGraphs - Layout coarsening hierarchy.
|
|
37
|
+
* @param idToPosition - Node id to position map.
|
|
38
|
+
* @param idToItem - Node id to graph node map.
|
|
39
|
+
* @param clusterIdsBySun - Cluster id per synthetic cluster sun, keyed by sun `originalId`.
|
|
40
|
+
* @returns Fitted cluster hit regions.
|
|
41
|
+
*/
|
|
42
|
+
export declare const buildClusterByHitRegions: (subGraphs: CoarsenedGraph[], idToPosition: Readonly<Record<string, Point>>, idToItem: Record<string, Node>, clusterIdsBySun: ReadonlyMap<string, ClusterId>) => ClusterHitRegion[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,12 @@ export declare const MinRelLength = 100;
|
|
|
5
5
|
export declare const Gravity = 25;
|
|
6
6
|
export declare const SimulationStopVelocity = 0.25;
|
|
7
7
|
export declare const MappingEnd = 999999;
|
|
8
|
+
export declare const LayoutStepIntervalMs = 13;
|
|
9
|
+
export declare const MaxLayoutStepsPerFrame = 20;
|
|
10
|
+
export declare const DefaultMaxFps = 30;
|
|
11
|
+
export declare const DefaultMinFps = 3;
|
|
12
|
+
export declare const MinAllowedFps = 1;
|
|
13
|
+
export declare const MaxAllowedFps = 120;
|
|
8
14
|
export declare const ActiveAnimDuration = 1000;
|
|
9
15
|
export declare const DefaultNodeSize = 25;
|
|
10
16
|
export declare const DefaultNodeColor = "#FFDF81";
|
|
@@ -8,11 +8,11 @@ export interface Point {
|
|
|
8
8
|
/** The y coordinate of the point. */
|
|
9
9
|
y: number;
|
|
10
10
|
}
|
|
11
|
-
export declare const isPointDefined: (point: Point | Node) => boolean;
|
|
12
11
|
/**
|
|
13
12
|
* Returns true when value is a finite number (not NaN or Infinity).
|
|
14
13
|
*/
|
|
15
14
|
export declare const isValidFiniteNumber: (value: unknown) => value is number;
|
|
15
|
+
export declare const isPointDefined: (point: Point | Node | null | undefined) => point is Point;
|
|
16
16
|
/**
|
|
17
17
|
* This function checks if the coordinates are defined.
|
|
18
18
|
* @param from - The {@link Node} the edge starts from.
|
|
@@ -126,3 +126,46 @@ export declare const getIntersection: (p0: Point, p1: Point, p2: Point, p3: Poin
|
|
|
126
126
|
* @returns The distance between the point and the curve.
|
|
127
127
|
*/
|
|
128
128
|
export declare const getDistanceToQuadratic: (fromCoordinates: Point, toCoordinates: Point, control: Point, point: Point) => number;
|
|
129
|
+
/**
|
|
130
|
+
* Converts a polar coordinate (radius + angle around a centre) to a cartesian point.
|
|
131
|
+
* @param centre - The centre of the circle.
|
|
132
|
+
* @param radius - The radius of the circle.
|
|
133
|
+
* @param angle - The angle around the circle, in radians.
|
|
134
|
+
* @returns The point at that angle and radius from the centre.
|
|
135
|
+
*/
|
|
136
|
+
export declare const pointOnCircle: (centre: Point, radius: number, angle: number) => Point;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the point halfway between two points.
|
|
139
|
+
* @param a - The first point.
|
|
140
|
+
* @param b - The second point.
|
|
141
|
+
* @returns The midpoint of the segment from a to b.
|
|
142
|
+
*/
|
|
143
|
+
export declare const getMidPoint: (a: Point, b: Point) => Point;
|
|
144
|
+
/**
|
|
145
|
+
* Places child points evenly spaced around a circle centred on a point.
|
|
146
|
+
* @param centre - The centre of the circle.
|
|
147
|
+
* @param radius - The radius of the circle.
|
|
148
|
+
* @param noOfChildren - The number of points to place around the circle.
|
|
149
|
+
* @returns The evenly spaced points.
|
|
150
|
+
*/
|
|
151
|
+
export declare const calculateCirclePositions: (centre: Point, radius: number, noOfChildren: number) => Point[];
|
|
152
|
+
/**
|
|
153
|
+
* Andrew's monotone-chain convex hull.
|
|
154
|
+
* @param points - The points to get the convex hull of.
|
|
155
|
+
* @returns The convex hull of the points.
|
|
156
|
+
*/
|
|
157
|
+
export declare const getConvexHull: (points: Point[]) => Point[];
|
|
158
|
+
/**
|
|
159
|
+
* Returns true when the point lies inside or on the boundary of a convex polygon.
|
|
160
|
+
* Works for both clockwise and counter-clockwise vertex order.
|
|
161
|
+
* @param point - The point to test.
|
|
162
|
+
* @param polygon - Convex polygon vertices in order around the boundary.
|
|
163
|
+
* @returns True when the point is inside or on the polygon.
|
|
164
|
+
*/
|
|
165
|
+
export declare const isPointInConvexPolygon: (point: Point, polygon: Point[]) => boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Absolute area of a simple polygon via the shoelace formula.
|
|
168
|
+
* @param polygon - Polygon vertices in order around the boundary.
|
|
169
|
+
* @returns The absolute area of the polygon.
|
|
170
|
+
*/
|
|
171
|
+
export declare const getPolygonArea: (polygon: Point[]) => number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { NvlState } from '../modules/state/types';
|
|
1
|
+
import type { Cluster, NvlState } from '../modules/state/types';
|
|
2
2
|
import type { Node, Relationship } from '../types/graph-element';
|
|
3
|
+
import type { ClusterHitRegion } from './clusterHitRegions';
|
|
3
4
|
import type { Point } from './geometry';
|
|
4
5
|
/**
|
|
5
6
|
* A node that has been hit by a pointer event
|
|
@@ -34,7 +35,18 @@ export interface HitTargetRelationship {
|
|
|
34
35
|
distance: number;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
|
-
* A
|
|
38
|
+
* A {@link ClusteringOptions.clusterBy} cluster hull that has been hit by a pointer event
|
|
39
|
+
*/
|
|
40
|
+
export interface HitTargetCluster {
|
|
41
|
+
/** The cluster that was hit */
|
|
42
|
+
data: Cluster;
|
|
43
|
+
/** The coordinates of the pointer event */
|
|
44
|
+
pointerCoordinates: Point;
|
|
45
|
+
/** The convex hull used for the hit test */
|
|
46
|
+
hull: Point[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A collection of nodes, relationships and clusters that have been hit by a pointer event
|
|
38
50
|
* Part of the result of a {@link NVL}.{@link NVL.getHits} call
|
|
39
51
|
*/
|
|
40
52
|
export type HitTargets = {
|
|
@@ -42,15 +54,29 @@ export type HitTargets = {
|
|
|
42
54
|
nodes: HitTargetNode[];
|
|
43
55
|
/** The relationships that have been hit by the pointer event. */
|
|
44
56
|
relationships: HitTargetRelationship[];
|
|
57
|
+
/** The cluster hulls that have been hit by the pointer event. */
|
|
58
|
+
clusters: HitTargetCluster[];
|
|
45
59
|
};
|
|
46
|
-
export
|
|
60
|
+
export type HitTestTarget = 'node' | 'relationship' | 'cluster';
|
|
61
|
+
/**
|
|
62
|
+
* Finds all cluster hulls that contain the given point.
|
|
63
|
+
* Overlapping hulls are returned smallest-first (most specific).
|
|
64
|
+
* @param x - X coordinate.
|
|
65
|
+
* @param y - Y coordinate.
|
|
66
|
+
* @param regions - Fitted cluster hit regions.
|
|
67
|
+
* @returns Cluster hits sorted by ascending hull area.
|
|
68
|
+
*/
|
|
69
|
+
export declare const hitClusterTest: (x: number, y: number, regions: ClusterHitRegion[]) => HitTargetCluster[];
|
|
70
|
+
export declare const hitTest: (x: number, y: number, state: NvlState, targets?: HitTestTarget[], options?: {
|
|
47
71
|
hitNodeMarginWidth?: number;
|
|
72
|
+
clusterRegions?: ClusterHitRegion[];
|
|
48
73
|
}) => HitTargets;
|
|
49
74
|
export declare const hitTestCanvas: (x: number, y: number, parentHandler: {
|
|
50
75
|
getCanvasNodesAt: (c: Point, m: number) => HitTargetNode[];
|
|
51
76
|
getCanvasRelsAt: (c: Point) => HitTargetRelationship[];
|
|
52
|
-
}, targets?:
|
|
77
|
+
}, targets?: readonly HitTestTarget[], options?: {
|
|
53
78
|
hitNodeMarginWidth?: number;
|
|
79
|
+
clusterRegions?: ClusterHitRegion[];
|
|
54
80
|
}) => HitTargets;
|
|
55
81
|
export declare const hitTestBox: (x1: number, y1: number, x2: number, y2: number, state: NvlState, targets?: string[]) => {
|
|
56
82
|
nodes: Node[];
|
|
@@ -16,17 +16,19 @@ export declare const recordCollector: (graphElements: NestedGraphElements[]) =>
|
|
|
16
16
|
* @example
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
|
-
* import neo4j from
|
|
20
|
-
* import { nvlResultTransformer, NVL } from
|
|
19
|
+
* import * as neo4j from 'neo4j-driver'
|
|
20
|
+
* import { nvlResultTransformer, NVL } from '@neo4j-nvl/base'
|
|
21
21
|
*
|
|
22
|
-
* const
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
22
|
+
* const run = async () => {
|
|
23
|
+
* const driver = neo4j.driver('{uri}', neo4j.auth.basic('{user}', '{password}'))
|
|
24
|
+
* const nvlGraph = await driver.executeQuery(
|
|
25
|
+
* 'MATCH (a)-[r]-(b) RETURN a,r,b LIMIT 25',
|
|
26
|
+
* {},
|
|
27
|
+
* { resultTransformer: nvlResultTransformer }
|
|
28
|
+
* )
|
|
28
29
|
*
|
|
29
|
-
*
|
|
30
|
+
* const nvl = new NVL(document.getElementById('viz'), nvlGraph.nodes, nvlGraph.relationships)
|
|
31
|
+
* }
|
|
30
32
|
* ```
|
|
31
33
|
*
|
|
32
34
|
* @see {@link https://neo4j.com/docs/api/javascript-driver/current/class/lib6/result-transformers.js~ResultTransformers.html|ResultTransformers on Neo4j JS Driver API Docs}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Point } from './geometry';
|
|
2
|
+
export type SeedingMethod = 'box' | 'circle';
|
|
3
|
+
export declare const getCircleSeedRadius: (nodeCount: number, seedSpacing: number) => number;
|
|
4
|
+
export declare const getBoxStartSize: (nodeCount: number) => number;
|
|
5
|
+
export declare const getCirclePositionsForNodeCount: (nodeCount: number, center: Point, radius: number) => Point[];
|
|
6
|
+
export declare const getBoxPositionsForNodeCount: (nodeCount: number, center: Point) => Point[];
|
|
7
|
+
export declare const getSeedPositions: (nodeCount: number, seedingMethod: SeedingMethod, center?: Point) => Point[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Node } from '../index';
|
|
2
2
|
import type { Point } from './geometry';
|
|
3
|
+
/**
|
|
4
|
+
* Gets padding for fitting nodes, which is twice the largest node radius.
|
|
5
|
+
* @param maxNodeRadius - The largest node radius.
|
|
6
|
+
* @returns The padding for fitting nodes.
|
|
7
|
+
*/
|
|
8
|
+
declare const getFitNodesPadding: (maxNodeRadius?: number) => number;
|
|
3
9
|
declare const getExtremeLimits: (nodePositions: Point[]) => Point[];
|
|
4
10
|
declare const getMaxDistance: (extremeLimits?: Point[]) => number;
|
|
5
11
|
/**
|
|
@@ -40,7 +46,8 @@ declare const createZoomTarget: (zoomX: number, zoomY: number, minZoom?: number,
|
|
|
40
46
|
* @param nodePositions - The node positions.
|
|
41
47
|
* @param containerWidth - The width of the container NVL is displayed in.
|
|
42
48
|
* @param containerHeight - The height of the container NVL is displayed in.
|
|
43
|
-
* @param maxNodeRadius - The maximum node radius, which is added as margin to the scene
|
|
49
|
+
* @param maxNodeRadius - The maximum node radius, which is added as margin to the scene
|
|
50
|
+
* (defaults to 2 * {@link DefaultNodeSize}).
|
|
44
51
|
* @returns The zoom and pan targets.
|
|
45
52
|
*/
|
|
46
53
|
declare const getZoomTargetForNodePositions: (nodePositions: Point[], containerWidth: number, containerHeight: number, maxNodeRadius?: number) => {
|
|
@@ -55,4 +62,4 @@ declare const getFlexibleZoomLimit: (nodePositions: Point[], rect: HTMLCanvasEle
|
|
|
55
62
|
declare const getNewZoomWithinLimits: (newZoom: number, oldZoom: number, minZoom: number, maxZoom: number) => number;
|
|
56
63
|
declare const isZoomOutAtLimit: (newZoom: number, oldZoom: number, zoomOutLimit: number) => boolean;
|
|
57
64
|
declare const getDynamicZoom: (nodePositions: Point[] & Node[], minZoom: number, maxZoom: number, rect: HTMLCanvasElement, newZoom: number, currentZoom: number) => number;
|
|
58
|
-
export { getFlexibleZoomLimit, getZoomTargetForNodePositions, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
|
65
|
+
export { getFitNodesPadding, getFlexibleZoomLimit, getZoomTargetForNodePositions, isZoomOutAtLimit, getNewZoomWithinLimits, getExtremeLimits, getMaxDistance, getPositionBoundaries, getZoomLevel, createZoomTarget, getDynamicZoom };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"description": "Base library for the Neo4j Visualization Library",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"postpack": "rm LICENSE.txt && rm CHANGELOG.md"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@neo4j-nvl/layout-workers": "
|
|
33
|
+
"@neo4j-nvl/layout-workers": "2.0.0",
|
|
34
34
|
"@segment/analytics-next": "1.81.1",
|
|
35
35
|
"color-string": "1.9.1",
|
|
36
36
|
"d3-force": "3.0.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"glsl-inject-defines": "1.0.3",
|
|
39
39
|
"lodash": "4.18.1",
|
|
40
40
|
"loglevel": "1.9.2",
|
|
41
|
-
"mobx": "
|
|
41
|
+
"mobx": "6.15.0",
|
|
42
42
|
"node-pid-controller": "1.0.1",
|
|
43
43
|
"resizelistener": "1.1.0",
|
|
44
44
|
"tinycolor2": "1.6.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const ForceDirectedLayoutType = "forceDirected";
|
|
2
|
-
export declare const CoseBilkentType = "coseBilkent";
|
|
3
|
-
export declare class ForceCytoLayout {
|
|
4
|
-
private readonly physLayout;
|
|
5
|
-
private readonly coseBilkentLayout;
|
|
6
|
-
private readonly state;
|
|
7
|
-
private currentLayoutType;
|
|
8
|
-
private enableCytoscape;
|
|
9
|
-
private currentLayout;
|
|
10
|
-
constructor(config: any);
|
|
11
|
-
setOptions(options: any): void;
|
|
12
|
-
private getLayout;
|
|
13
|
-
private setLayout;
|
|
14
|
-
copyLayoutPositions(nodeList: any, prevLayout: any, nextLayout: any): void;
|
|
15
|
-
update(refreshPositions?: boolean): void;
|
|
16
|
-
getShouldUpdate(): boolean;
|
|
17
|
-
getComputing(): boolean;
|
|
18
|
-
updateNodes(positionList: any): void;
|
|
19
|
-
getNodePositions(data: any): import("../..").Node[];
|
|
20
|
-
terminateUpdate(): void;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { NvlState } from '../../../modules/state/types';
|
|
2
|
-
import type { Node, Relationship } from '../../../types/graph-element';
|
|
3
|
-
import AnimatedLayout from '../../animatedlayout/AnimatedLayout';
|
|
4
|
-
type LayoutData = {
|
|
5
|
-
elements: {
|
|
6
|
-
group: string;
|
|
7
|
-
data: {
|
|
8
|
-
id: string;
|
|
9
|
-
};
|
|
10
|
-
}[];
|
|
11
|
-
spacingFactor: number;
|
|
12
|
-
};
|
|
13
|
-
export declare class CoseBilkentLayout extends AnimatedLayout {
|
|
14
|
-
private stateDisposers;
|
|
15
|
-
cytoCompleteCallback: () => void;
|
|
16
|
-
computing: boolean;
|
|
17
|
-
pendingLayoutData: LayoutData;
|
|
18
|
-
worker: SharedWorker;
|
|
19
|
-
private workersDisabled;
|
|
20
|
-
constructor(config: {
|
|
21
|
-
state: NvlState;
|
|
22
|
-
cytoCompleteCallback?: () => void;
|
|
23
|
-
animationCompleteCallback?: () => void;
|
|
24
|
-
});
|
|
25
|
-
setOptions(): void;
|
|
26
|
-
update(refreshPositions?: boolean, updateMobXNodes?: Node[], updateMobXRelationships?: Relationship[]): void;
|
|
27
|
-
getShouldUpdate(): boolean;
|
|
28
|
-
getComputing(): boolean;
|
|
29
|
-
layout(nodes: Node[], relationships: Relationship[]): void;
|
|
30
|
-
terminateUpdate(): void;
|
|
31
|
-
destroy(): void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import type { ForceDirectedOptions, NvlState } from '../../../modules/state/types';
|
|
2
|
-
import type { Node, Relationship } from '../../../types/graph-element';
|
|
3
|
-
import type { Point } from '../../../utils/geometry';
|
|
4
|
-
export declare class PhysLayout {
|
|
5
|
-
private physVbo;
|
|
6
|
-
private physSmallVbo;
|
|
7
|
-
private physProjection;
|
|
8
|
-
private physSmallProjection;
|
|
9
|
-
private gl;
|
|
10
|
-
private useReadpixelWorkaround;
|
|
11
|
-
private averageNodeSize;
|
|
12
|
-
private shouldUpdate;
|
|
13
|
-
private iterationCount;
|
|
14
|
-
private lastSpeedValues;
|
|
15
|
-
private rollingAvgGraphSpeed;
|
|
16
|
-
private nodeVariation;
|
|
17
|
-
private nodeCenterPoint;
|
|
18
|
-
private peakIterationMultiplier;
|
|
19
|
-
private stateDisposers;
|
|
20
|
-
private state;
|
|
21
|
-
private dpr;
|
|
22
|
-
private intelWorkaround;
|
|
23
|
-
private simulationStopVelocitySquared;
|
|
24
|
-
private gravity;
|
|
25
|
-
private force;
|
|
26
|
-
private nodeIdToIndex;
|
|
27
|
-
private nodeIndexToId;
|
|
28
|
-
private flatRelationshipKeys;
|
|
29
|
-
private numNodes;
|
|
30
|
-
private solarMerger;
|
|
31
|
-
private subGraphs;
|
|
32
|
-
private nodeSortMap;
|
|
33
|
-
private firstUpdate;
|
|
34
|
-
private curPhysData;
|
|
35
|
-
private apprxRepForceShader;
|
|
36
|
-
private levelsClusterTexture;
|
|
37
|
-
private levelsFinestIndexTexture;
|
|
38
|
-
private initalLevelTexture;
|
|
39
|
-
private levelsData;
|
|
40
|
-
private collisionDetectionMultiplier;
|
|
41
|
-
private physShader;
|
|
42
|
-
private physData;
|
|
43
|
-
private workaroundData;
|
|
44
|
-
private pinData;
|
|
45
|
-
private updateData;
|
|
46
|
-
private updateShader;
|
|
47
|
-
private workaroundShader;
|
|
48
|
-
private physPositions;
|
|
49
|
-
private springTexture;
|
|
50
|
-
private sizeTexture;
|
|
51
|
-
private offsetTexture;
|
|
52
|
-
private pinTexture;
|
|
53
|
-
private addedNodes;
|
|
54
|
-
private updateTexture;
|
|
55
|
-
private vaoExt;
|
|
56
|
-
private physVao;
|
|
57
|
-
private physSmallVao;
|
|
58
|
-
private updateVao;
|
|
59
|
-
private workaroundVao;
|
|
60
|
-
constructor(config: ForceDirectedOptions & {
|
|
61
|
-
webGLContext: WebGLRenderingContext;
|
|
62
|
-
state: NvlState;
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Sets the layout options.
|
|
66
|
-
* @param options - The object with the options.
|
|
67
|
-
* @param initial - Whether this is the first setting of options.
|
|
68
|
-
*/
|
|
69
|
-
setOptions(options?: ForceDirectedOptions, initial?: boolean): void;
|
|
70
|
-
/**
|
|
71
|
-
* Sets graph data to be used
|
|
72
|
-
* @param {{ nodes: Node[]; rels: Relationship[] }} data the graph object
|
|
73
|
-
* @returns The top level graph of the subgraphs created by the solar merger.
|
|
74
|
-
*/
|
|
75
|
-
setData(data: {
|
|
76
|
-
nodes: Node[];
|
|
77
|
-
rels: Relationship[];
|
|
78
|
-
}): import("./solarmerger/types").CoarsenedGraph;
|
|
79
|
-
/**
|
|
80
|
-
* Updates the node's positions for the next step in the physics layout iterations if the layout needs to update
|
|
81
|
-
* @param refreshPositions whether the entire layout should be reheated
|
|
82
|
-
* @returns Whether the layout should update in the following step.
|
|
83
|
-
*/
|
|
84
|
-
update(refreshPositions?: boolean): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Stops the layout
|
|
87
|
-
*/
|
|
88
|
-
terminateUpdate(): void;
|
|
89
|
-
/**
|
|
90
|
-
* Returns whether the current layout needs to be updated in the next iteration step.
|
|
91
|
-
* @returns Whether the layout should update in the following step.
|
|
92
|
-
*/
|
|
93
|
-
getShouldUpdate(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Returns whether the current layout is computing.
|
|
96
|
-
* Always returns false because the force-directed layout has no computing step
|
|
97
|
-
* @returns Whether the layout is computing.
|
|
98
|
-
*/
|
|
99
|
-
getComputing(): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Adds the current x,y coordinates for each node to a given list of nodes.
|
|
102
|
-
* @param nodeList - The list of nodes to get positions for.
|
|
103
|
-
* @returns The list of nodes containing the x,y coordinates on each node object.
|
|
104
|
-
*/
|
|
105
|
-
getNodePositions(nodeList: Node[]): (Node & Point)[];
|
|
106
|
-
/**
|
|
107
|
-
* Reheats the layout
|
|
108
|
-
* @param fullData - The entire graph object.
|
|
109
|
-
*/
|
|
110
|
-
reheat(fullData: {
|
|
111
|
-
nodes: Node[];
|
|
112
|
-
rels?: Relationship[];
|
|
113
|
-
}): void;
|
|
114
|
-
/**
|
|
115
|
-
* Updates the existing nodes of a graph with a given list of updates
|
|
116
|
-
* @param nodeList - The list of updates.
|
|
117
|
-
*/
|
|
118
|
-
updateNodes(nodeList: Node[]): void;
|
|
119
|
-
/**
|
|
120
|
-
* Adds and removes nodes from the graph based on given updates
|
|
121
|
-
* @param fullData - The entire graph object.
|
|
122
|
-
* @param fullData.nodes - The nodes in the graph.
|
|
123
|
-
* @param fullData.rels - The relationships in the graph.
|
|
124
|
-
* @param nodeChanges - The changes in the graph.
|
|
125
|
-
* @param nodeChanges.adds - A list of nodes to be added.
|
|
126
|
-
* @param nodeChanges.removes - A list of nodes to be removed.
|
|
127
|
-
*/
|
|
128
|
-
addRemoveData(fullData: {
|
|
129
|
-
nodes: Node[];
|
|
130
|
-
rels: Relationship[];
|
|
131
|
-
}, nodeChanges: {
|
|
132
|
-
adds: Record<string, Node>;
|
|
133
|
-
removes: Record<string, Node>;
|
|
134
|
-
}, relationshipChanges: {
|
|
135
|
-
adds: Record<string, Relationship>;
|
|
136
|
-
removes: Record<string, Relationship>;
|
|
137
|
-
}): import("./solarmerger/types").CoarsenedGraph;
|
|
138
|
-
/**
|
|
139
|
-
* Destroys the class and all buffers and textures.
|
|
140
|
-
*/
|
|
141
|
-
destroy(): void;
|
|
142
|
-
/**
|
|
143
|
-
* Takes the new flat key set of relationships and the current relationship changes
|
|
144
|
-
* and checks whether removed relationships are still in the new flat key set.
|
|
145
|
-
* and whether added relationships were already in the old flat key set.
|
|
146
|
-
* @param newFlatKeySet The new flat key set of relationships.
|
|
147
|
-
* @param relationshipChanges The changes in the relationships.
|
|
148
|
-
* @returns Whether the relationship flat map has changed.
|
|
149
|
-
*/
|
|
150
|
-
private hasRelationshipFlatMapChanged;
|
|
151
|
-
private dumpTexture;
|
|
152
|
-
private getScaleNumber;
|
|
153
|
-
private getBaseLength;
|
|
154
|
-
private checkForUpdates;
|
|
155
|
-
private getNodePosition;
|
|
156
|
-
private getMaxSpeedSquared;
|
|
157
|
-
private getMedianSpeedSquared;
|
|
158
|
-
private getPhysData;
|
|
159
|
-
private newTexture;
|
|
160
|
-
private newFramebuffer;
|
|
161
|
-
private checkCompatibility;
|
|
162
|
-
private printGlStats;
|
|
163
|
-
private adjustToGlSize;
|
|
164
|
-
private setupSize;
|
|
165
|
-
private setupSprings;
|
|
166
|
-
private setupPhysics;
|
|
167
|
-
private setupPhysicsForNodes;
|
|
168
|
-
private setupPhysicsForCoarse;
|
|
169
|
-
private setupPinData;
|
|
170
|
-
private setupUpdates;
|
|
171
|
-
private setupReadpixelWorkaround;
|
|
172
|
-
private doReadpixelWorkaround;
|
|
173
|
-
private definePhysicsArrays;
|
|
174
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\n\nuniform sampler2D u_physData;\nuniform sampler2D u_connections;\nuniform sampler2D u_connectionOffsets;\nuniform sampler2D u_pinnedNodes;\nuniform sampler2D u_sizeTexture;\nuniform float u_baseLength;\nuniform float u_curIteration;\nuniform float u_iterationMultiplier;\nuniform vec2 u_gravityCenter;\nuniform float u_numNodes;\nuniform float u_gravity;\n\nuniform sampler2D u_clusterData;\nuniform sampler2D u_prevForce;\nuniform float u_collisionMultiplier;\n\n\nfloat DAMP = 0.6;\nfloat COOL = 0.99998;\nfloat TEMP = max(0.02, pow(COOL, u_curIteration));\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 0.6;\nfloat accLimitLow = 500000.0;\nfloat accLimitHigh = 750000.0;\nfloat accLimitPosHigh = 10000000.0;\n\nconst float denseNodeThreshold = 1000.0;\nconst float MIN_DISTANCE = 0.00000001;\nconst float MAX_DISTANCE = 1000000000.0;\nconst float MAX_ACCELERATION = 50000.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nbool isNan(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n}\n\nconst float BIG_NUMBER = 999999999999999999.0;\nbool isInf(float val) {\n return val > BIG_NUMBER || val < -BIG_NUMBER;\n}\n\nvec2 getDelta(vec2 v1, vec2 v2) {\n vec2 delta = v1 - v2;\n float dist = length(delta);\n if (dist < MIN_DISTANCE || isNan(dist)) {\n return vec2(MIN_DISTANCE, MIN_DISTANCE);\n }\n if (dist > MAX_DISTANCE) {\n vec2 normDelta = delta / dist;\n return normDelta * MAX_DISTANCE;\n }\n return delta;\n}\n\nvec4 getOtherNodePosition(float i) {\n return getTextureData(u_physData, i, 256.0);\n}\n\nfloat getCombinedNodeSize(float i, float nodeSize) {\n float otherNodeSize = getTextureData(u_sizeTexture, i, 256.0).a;\n return nodeSize + otherNodeSize;\n}\n\nvec2 getSpringForce(float curConnection, float numConnections, float springFScale, vec4 myPosition, float i) {\n float curSpring = getTextureData(u_connections, curConnection + i, 4096.0).a;\n\n vec4 otherPosition = getTextureData(u_physData, curSpring, 256.0);\n float otherDataPosition = getTextureData(u_connectionOffsets, curSpring, 256.0).a;\n float avgDegree;\n#if INTEL_WORKAROUND\n avgDegree = max(numConnections, 4.0);\n#else\n float otherNumConnections = getTextureData(u_connections, otherDataPosition, 4096.0).a;\n avgDegree = max((otherNumConnections + numConnections * 3.0) / 4.0, 4.0);\n#endif\n\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n\n float F = (dist * dist * springFScale) / (u_baseLength * avgDegree);\n if (u_collisionMultiplier > 0.0) {\n F *= u_collisionMultiplier;\n }\n return (-delta / dist) * F;\n}\n\nvec2 getCollisionForce(float combinedNodeSize, float dist, float fScale, vec2 delta) {\n float collisionForce = (combinedNodeSize - dist) / (dist);\n if (u_collisionMultiplier > 0.0) {\n collisionForce *= u_collisionMultiplier;\n }\n return (delta * collisionForce * fScale * combinedNodeSize) / (combinedNodeSize + 1.0);\n}\n\nvec2 getRepulsionForce(float dist, float fScale, vec2 delta) {\n float F = (u_baseLength * u_baseLength * fScale) / (dist);\n return (delta / dist) * F * 0.05;\n}\n\nvoid main(void) {\n float textureSide = 256.0; //#TEXTURE_SIDE#;\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5) * textureSide;\n\n if (index >= u_numNodes) {\n discard;\n }\n\n vec4 clusterData = getTextureData(u_clusterData, index, 256.0);\n\n float clusterIndex = clusterData.x;\n float clusterStartIndex = clusterData.y;\n float clusterSize = clusterData.z;\n float clusterWeight = clusterData.w;\n\n vec4 myPosition = getTextureData(u_physData, index, 256.0);\n vec4 previousForce = getTextureData(u_prevForce, clusterIndex, 256.0);\n\n vec2 acceleration = previousForce.xy;\n\n float isPinned = getTextureData(u_pinnedNodes, index, 256.0).a;\n float nodeSize = getTextureData(u_sizeTexture, index, 256.0).a;\n\n if (isPinned > 0.5) {\n gl_FragColor = vec4(myPosition.xy, 0.0, 0.0);\n return;\n }\n\n float curConnection = getTextureData(u_connectionOffsets, index, 256.0).a;\n float numConnections = getTextureData(u_connections, curConnection, 4096.0).a;\n\n float fScale = 1.0 + sqrt(u_iterationMultiplier);\n float springFScale = fScale;\n\n if (numConnections > denseNodeThreshold) {\n springFScale = sqrt(fScale);\n }\n\n float numOfRels = 0.0;\n\n // Springs\n for (float i = 1.0; i <= 256.0 * 256.0; i++) {\n if (numOfRels >= numConnections) {\n break;\n }\n acceleration += getSpringForce(curConnection, numConnections, springFScale, myPosition, i);\n numOfRels += 1.0;\n }\n\n // Repulsion && collision detection\n if (u_collisionMultiplier > 0.0) {\n float number_of_collisions = 0.0;\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= u_numNodes) {\n break;\n }\n\n if (i == index) {\n continue;\n }\n\n vec4 otherPosition = getOtherNodePosition(i);\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n float combinedNodeSize = getCombinedNodeSize(i, nodeSize) * 2.0;\n\n if (dist < combinedNodeSize && number_of_collisions < 40.0) {\n number_of_collisions++;\n acceleration += getCollisionForce(combinedNodeSize, dist, fScale, delta);\n }\n\n if (i >= clusterStartIndex && i < clusterStartIndex + clusterSize) {\n acceleration += getRepulsionForce(dist, fScale, delta);\n }\n }\n } else {\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= clusterStartIndex + clusterSize || i >= u_numNodes) {\n break;\n }\n\n if (i < clusterStartIndex || i == index) {\n continue;\n }\n\n vec4 otherPosition = getOtherNodePosition(i);\n vec2 delta = getDelta(myPosition.xy, otherPosition.xy);\n float dist = length(delta);\n float combinedNodeSize = getCombinedNodeSize(i, nodeSize);\n\n if (dist < combinedNodeSize) {\n acceleration += getCollisionForce(combinedNodeSize, dist, fScale, delta);\n }\n\n acceleration += getRepulsionForce(dist, fScale, delta);\n }\n }\n\n // Gravity\n vec2 delta = getDelta(u_gravityCenter, myPosition.xy);\n float dist = length(delta);\n\n vec2 grav = (delta / dist) * u_gravity * fScale * (dist / 1000.0);\n acceleration += grav;\n\n float accMagnitude = length(acceleration);\n acceleration *= min(MAX_ACCELERATION, accMagnitude) / accMagnitude;\n\n float iterationFrictionThreshold = 1000.0;\n\n if (u_curIteration > iterationFrictionThreshold) {\n float friction = 1.0 + pow((u_curIteration - iterationFrictionThreshold), 2.0) / 100.0;\n acceleration *= 1.0 / friction;\n }\n\n if (u_curIteration == 0.0) {\n gl_FragColor = vec4(myPosition.xy, myPosition.zw);\n } else {\n vec2 prevVelocity = myPosition.zw;\n vec2 currentPos = myPosition.xy;\n vec2 prevPos = currentPos - prevVelocity;\n\n vec2 newPos = currentPos + TEMP * ( DAMP * (prevVelocity) + acceleration * TIMESTEP * TIMESTEP);\n vec2 newVelocity = newPos - currentPos;\n gl_FragColor = vec4(newPos, newVelocity);\n }\n}";
|
|
2
|
-
export default _default;
|
package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-repulsive-fragment.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\nuniform sampler2D u_physData;\nuniform sampler2D u_clusterData;\nuniform sampler2D u_finestIndexes;\nuniform sampler2D u_prevForce;\n\nuniform float u_baseLength;\nuniform float u_numNodes;\nuniform float u_iterationMultiplier;\nuniform float u_isTopLevel;\n\nfloat PI = 3.1415926535897932384626433832795;\nfloat TIMESTEP = 1.0 / 30.0;\nfloat VELOCITYDECAY = 1.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nfloat getSquaredLogClusterWeight(float value) {\n return pow(log(value), 2.0);\n}\n\nvoid main(void) {\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5) * 256.0;\n\n if (index >= u_numNodes) {\n discard;\n }\n\n vec4 clusterData = getTextureData(u_clusterData, index, 256.0);\n\n float clusterIndex = clusterData.x;\n float clusterStartIndex = clusterData.y;\n float clusterSize = clusterData.z;\n float clusterArea = pow(clusterSize + u_baseLength * 2.0, 2.0);\n\n float finestIndex = getTextureData(u_finestIndexes, index, 256.0).a;\n vec4 myPosition = getTextureData(u_physData, finestIndex, 256.0);\n vec4 previousForce = getTextureData(u_prevForce, clusterIndex, 256.0);\n float fScale = 1.0 + sqrt(u_iterationMultiplier);\n\n vec2 acceleration = previousForce.xy;\n\n // Repulsion & Collision Detection\n for (float i = 0.0; i < 256.0 * 256.0; i++) {\n if (i >= clusterStartIndex + clusterSize || i >= u_numNodes) {\n break;\n }\n if (i < clusterStartIndex || i == index) {\n continue;\n }\n\n vec4 otherClusterData = getTextureData(u_clusterData, i, 256.0);\n float otherClusterWeight = getSquaredLogClusterWeight(otherClusterData.w);\n\n float otherFinestIndex = getTextureData(u_finestIndexes, i, 256.0).a;\n vec4 otherPosition = getTextureData(u_physData, otherFinestIndex, 256.0);\n\n vec2 delta = myPosition.xy - otherPosition.xy;\n float dist = max(length(delta), 0.0000001);\n float maxDist = 25.0;\n float repulsionForceScale = 0.1;\n\n float F = (clusterArea * fScale) / (dist * dist);\n\n if (u_isTopLevel == 1.0) {\n repulsionForceScale = 0.2;\n }\n\n acceleration += ((delta / sqrt(dist)) * F) * repulsionForceScale * otherClusterWeight;\n\n if (dist < maxDist) {\n float collide = (maxDist - dist) / (dist * dist);\n acceleration += delta * collide * fScale * maxDist / (maxDist + 1.0);\n }\n }\n\n gl_FragColor = vec4(acceleration, vec2(finestIndex, 0));\n}";
|
|
2
|
-
export default _default;
|
package/dist/types/layouts/forcedirectedlayout/physlayout/shaders/multilevel-update-fragment.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision mediump float;\n\nuniform sampler2D u_physData;\nuniform sampler2D u_updateData;\nuniform float u_numNodesNew;\n\nconst float INDEX_FLAG = 999999.0;\n\nvec4 getTextureData(sampler2D texture, float index, float base) {\n float x = mod(index, base);\n float y = (index - x) / base;\n return texture2D(texture, vec2(x + 0.5, y + 0.5) / base);\n}\n\nvoid main(void) {\n float textureSide = 256.0; //#TEXTURE_SIDE#;\n float index = (gl_FragCoord.x - 0.5) + (gl_FragCoord.y - 0.5)*textureSide;\n\n if (index >= u_numNodesNew) {\n discard;\n }\n\n float firstValue = getTextureData(u_updateData, index * 2.0, 256.0).a;\n float secondValue = getTextureData(u_updateData, index * 2.0 + 1.0, 256.0).a;\n\n if (secondValue == INDEX_FLAG) {\n vec4 myPosition = getTextureData(u_physData, firstValue, 256.0);\n gl_FragColor = myPosition;\n } else {\n gl_FragColor = vec4(firstValue, secondValue, 0.0, 0.0);\n }\n}\n";
|
|
2
|
-
export default _default;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "precision lowp float;\n\nuniform sampler2D u_physData;\nuniform float u_index;\n\nfloat shift_right (float v, float amt) { \n v = floor(v) + 0.5; \n return floor(v / exp2(amt)); \n}\n\nfloat shift_left (float v, float amt) { \n return floor(v * exp2(amt) + 0.5); \n}\n\nfloat mask_last (float v, float bits) { \n return mod(v, shift_left(1.0, bits)); \n}\n\nfloat extract_bits (float num, float from, float to) { \n from = floor(from + 0.5); to = floor(to + 0.5); \n return mask_last(shift_right(num, from), to - from); \n}\n\n// From https://stackoverflow.com/questions/17981163/webgl-read-pixels-from-floating-point-render-target\nvec4 encode_float (float val) { \n if (val == 0.0) return vec4(0, 0, 0, 0); \n float sign = val > 0.0 ? 0.0 : 1.0; \n val = abs(val); \n float exponent = floor(log2(val)); \n float biased_exponent = exponent + 127.0; \n float fraction = ((val / exp2(exponent)) - 1.0) * 8388608.0; \n float t = biased_exponent / 2.0; \n float last_bit_of_biased_exponent = fract(t) * 2.0; \n float remaining_bits_of_biased_exponent = floor(t); \n float byte4 = extract_bits(fraction, 0.0, 8.0) / 255.0; \n float byte3 = extract_bits(fraction, 8.0, 16.0) / 255.0; \n float byte2 = (last_bit_of_biased_exponent * 128.0 + extract_bits(fraction, 16.0, 23.0)) / 255.0; \n float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0; \n return vec4(byte4, byte3, byte2, byte1); \n}\n\nvoid main(void) {\n vec4 texData = texture2D(u_physData, gl_FragCoord.xy / 255.0);\n float data;\n if (u_index == 0.0) {\n data = texData.x;\n } else if (u_index == 1.0) {\n data = texData.y;\n } else if (u_index == 2.0) {\n data = texData.z;\n } else if (u_index == 3.0) {\n data = texData.w;\n }\n\n gl_FragColor = encode_float(data);\n}\n";
|
|
2
|
-
export default _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Node, Relationship } from '../../../../types/graph-element';
|
|
2
|
-
import type { CoarsenedGraph, SolarRelationship } from './types';
|
|
3
|
-
export default class SolarMerger {
|
|
4
|
-
graph: {
|
|
5
|
-
nodes: Node[];
|
|
6
|
-
relationships: number[][];
|
|
7
|
-
idToRel: Record<string, SolarRelationship>;
|
|
8
|
-
};
|
|
9
|
-
subGraphs: CoarsenedGraph[];
|
|
10
|
-
sunMap: Record<string, string>;
|
|
11
|
-
relIdMap: string[][];
|
|
12
|
-
nodeSortMap?: Record<number, number>;
|
|
13
|
-
constructor(inputGraph: {
|
|
14
|
-
nodes: Node[];
|
|
15
|
-
rels: Relationship[];
|
|
16
|
-
}, nodeIdToIndex: Record<string, number>);
|
|
17
|
-
private constructGraphObjects;
|
|
18
|
-
coarsenTo(targetSize: number): CoarsenedGraph;
|
|
19
|
-
coarsenBy(levelToCoarsenBy: number): CoarsenedGraph;
|
|
20
|
-
private coarsen;
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/layouts/forcedirectedlayout/{physlayout/glwrapper.d.ts → glwrapper.d.ts}
RENAMED
|
File without changes
|