@neo4j-nvl/base 1.0.0-bca52f61 → 1.0.0-ccb2e2ae

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.
@@ -71,7 +71,7 @@ export declare class PhysLayout {
71
71
  setData(data: {
72
72
  nodes: Node[];
73
73
  rels: Relationship[];
74
- }): any;
74
+ }): import("./solarmerger/types").CoarsenedGraph;
75
75
  /**
76
76
  * Updates the node's positions for the next step in the physics layout iterations if the layout needs to update
77
77
  * @param refreshPositions whether the entire layout should be reheated
@@ -130,7 +130,7 @@ export declare class PhysLayout {
130
130
  }, relationshipChanges: {
131
131
  adds: Record<string, Relationship>;
132
132
  removes: Record<string, Relationship>;
133
- }): any;
133
+ }): import("./solarmerger/types").CoarsenedGraph;
134
134
  /**
135
135
  * Destroys the class and all buffers and textures.
136
136
  */
@@ -1,43 +1,21 @@
1
+ import type { Node, Relationship } from '../../../../types/graph-element';
2
+ import type { CoarsenedGraph, SolarRelationship } from './types';
1
3
  export default class SolarMerger {
2
- constructor(graph: any, nodeIdToIndex: any);
3
4
  graph: {
4
- nodes: any[];
5
- relationships: any[];
6
- idToRel: {};
7
- };
8
- subGraphs: any[];
9
- sunMap: {};
10
- constructGraphObjects(graph: any, nodeIdToIndex: any): {
11
- nodes: any[];
12
- relationships: any[];
13
- idToRel: {};
14
- };
15
- relIdMap: any[];
16
- coarsenTo(targetSize: any): {
17
- nodes: any[];
18
- relationships: any[];
19
- idToRel: {};
20
- };
21
- nodeSortMap: {};
22
- coarsenBy(levelToCoarsenBy: any): {
23
- nodes: any[];
24
- relationships: any[];
25
- idToRel: {};
26
- };
27
- coarsen({ nodes, relationships }: {
28
- nodes: any;
29
- relationships: any;
30
- }, firstIteration: any): {
31
- output: {
32
- nodes: {
33
- id: any;
34
- }[];
35
- relationships: any[];
36
- };
37
- sortedInput: {
38
- nodes: any[];
39
- relationships: any[];
40
- };
41
- nodeSortMap: {};
5
+ nodes: Node[];
6
+ relationships: number[][];
7
+ idToRel: Record<string, SolarRelationship>;
42
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;
43
21
  }
@@ -0,0 +1,49 @@
1
+ import type { Node } from '../../../../types/graph-element';
2
+ export interface SolarNode extends Omit<Node, 'id' | 'size'> {
3
+ id: number;
4
+ weight?: number;
5
+ finestIndex?: number;
6
+ originalId: string;
7
+ position?: {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ placement?: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ size?: number | (() => number);
16
+ }
17
+ export interface SolarRelationship {
18
+ id: string;
19
+ from: string;
20
+ to: string;
21
+ }
22
+ export interface CoarsenedGraph {
23
+ nodes: SolarNode[];
24
+ relationships: number[][];
25
+ idToRel: Record<string, SolarRelationship>;
26
+ }
27
+ export interface Sun extends SolarNode {
28
+ planets: Planet[];
29
+ size: () => number;
30
+ children: () => Planet[];
31
+ previousIndex: number;
32
+ }
33
+ export interface Planet extends SolarNode {
34
+ parent: Sun;
35
+ sunId: number;
36
+ moons: Moon[];
37
+ size: () => number;
38
+ children: () => Moon[];
39
+ }
40
+ export interface Moon extends SolarNode {
41
+ parent: Planet;
42
+ sunId: number;
43
+ size: () => number;
44
+ }
45
+ export type Celestial = Sun | Planet | Moon;
46
+ export declare const isSolarNode: (node: SolarNode | Node) => node is SolarNode;
47
+ export declare const isSun: (node: SolarNode | Celestial) => node is Sun;
48
+ export declare const isPlanet: (node: SolarNode | Celestial) => node is Planet;
49
+ export declare const isMoon: (node: SolarNode | Celestial) => node is Moon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/base",
3
- "version": "1.0.0-bca52f61",
3
+ "version": "1.0.0-ccb2e2ae",
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",
@@ -29,7 +29,7 @@
29
29
  "postpack": "rm LICENSE.txt && rm CHANGELOG.md"
30
30
  },
31
31
  "dependencies": {
32
- "@neo4j-nvl/layout-workers": "1.0.0-bca52f61",
32
+ "@neo4j-nvl/layout-workers": "1.0.0-ccb2e2ae",
33
33
  "@segment/analytics-next": "^1.70.0",
34
34
  "color-string": "^1.9.1",
35
35
  "d3-force": "^3.0.0",