plebeiangraphlibrary 2.0.1 → 2.1.2

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.
Files changed (58) hide show
  1. package/Build/Core/Edge.d.ts +20 -0
  2. package/Build/Core/Graph.d.ts +114 -0
  3. package/Build/Core/_Node.d.ts +20 -0
  4. package/Build/Core/index.d.ts +3 -0
  5. package/Build/Drawing/Drawing.d.ts +129 -0
  6. package/Build/Drawing/GraphDrawer.d.ts +70 -0
  7. package/Build/Drawing/MeshLineGeometry.d.ts +11 -0
  8. package/Build/Drawing/MeshLineMaterial.d.ts +16 -0
  9. package/Build/Drawing/ThickLine.d.ts +21 -0
  10. package/Build/Drawing/ThreeJSDrawer.d.ts +197 -0
  11. package/Build/Drawing/index.d.ts +3 -0
  12. package/Build/GraphAlgorithms/GraphMethods.d.ts +47 -0
  13. package/Build/GraphAlgorithms/index.d.ts +1 -0
  14. package/Build/HelperClasses/ColorHelper.d.ts +21 -0
  15. package/Build/HelperClasses/GeometryHelpers.d.ts +31 -0
  16. package/Build/HelperClasses/GraphConstructors.d.ts +12 -0
  17. package/Build/HelperClasses/Line.d.ts +12 -0
  18. package/Build/HelperClasses/Point.d.ts +26 -0
  19. package/Build/HelperClasses/Utilities.d.ts +45 -0
  20. package/Build/HelperClasses/index.d.ts +3 -0
  21. package/Build/Hierarchy/KDDistanceStrategy.d.ts +8 -0
  22. package/Build/Hierarchy/KDTree.d.ts +10 -0
  23. package/Build/Hierarchy/buildSimplifiedGraph.d.ts +7 -0
  24. package/Build/Hierarchy/index.d.ts +29 -0
  25. package/Build/Hierarchy/types.d.ts +33 -0
  26. package/Build/MatrixHelpers.d.ts +12 -0
  27. package/Build/Models/ErdosRenyiModel.d.ts +13 -0
  28. package/Build/Models/index.d.ts +1 -0
  29. package/Build/SampleData/DataLoader.d.ts +49 -0
  30. package/Build/SampleData/ZKC.d.ts +5 -0
  31. package/Build/SampleData/ZKC_simulated.d.ts +10 -0
  32. package/Build/SampleData/dwt_1005.d.ts +1008 -0
  33. package/Build/SampleData/index.d.ts +2 -0
  34. package/Build/Shaders/fragmentShader.glsl.d.ts +2 -0
  35. package/Build/Shaders/vertexShader.glsl.d.ts +2 -0
  36. package/Build/Simulation/KamadaKawai3D.d.ts +30 -0
  37. package/Build/Simulation/Octree.d.ts +34 -0
  38. package/Build/Simulation/StressSGD3D.d.ts +45 -0
  39. package/Build/Simulation/index.d.ts +4 -0
  40. package/Build/index.d.ts +40 -0
  41. package/Build/pgl.js +3824 -3389
  42. package/Build/pgl.js.map +1 -1
  43. package/Build/pgl_module.js +20827 -35564
  44. package/Build/pgl_module.js.map +1 -1
  45. package/Examples/10_Adjacency_matrix.html +74 -0
  46. package/Examples/11_Custom_layout.html +89 -0
  47. package/Examples/12_StressSGD_simulation_live.html +80 -0
  48. package/Examples/13_StressSGD_bunny_3d.html +104 -0
  49. package/Examples/4_ToggleActivation.html +1 -1
  50. package/Examples/5_Hierarchy_simple.html +5 -2
  51. package/Examples/9_Simulation_live.html +74 -0
  52. package/Examples/data/bunny.obj +7474 -0
  53. package/Examples/examples.html +27 -2
  54. package/README.md +42 -10
  55. package/package.json +15 -23
  56. package/Build/Textures/Square.png +0 -0
  57. package/Build/pgl.d.ts +0 -703
  58. package/Build/pgl.d.ts.map +0 -1
package/Build/pgl.d.ts DELETED
@@ -1,703 +0,0 @@
1
- import * as THREE from "three";
2
- import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
3
- interface Point {
4
- x: number;
5
- y: number;
6
- z: number;
7
- }
8
- declare class Point {
9
- /**
10
- * Constructs a point based on the x y z values
11
- * @param x x value
12
- * @param y y value
13
- * @param z z value
14
- */
15
- constructor(x: number, y: number, z: number);
16
- /**
17
- * Displaces a point - note this method moves the existing point
18
- * @param Point - Displacement vector (used as a point)
19
- */
20
- translate(Point: Point): void;
21
- }
22
- interface Line {
23
- points: Point[];
24
- }
25
- declare class Line {
26
- /**
27
- * Constructs a line from an array of points
28
- * @param points an array of points
29
- */
30
- constructor(points: Point[]);
31
- }
32
- interface _Node {
33
- data: any;
34
- neighbours: number[];
35
- }
36
- /**
37
- * Node class: each node has an ID (index) and arbitrary data.
38
- * The data typically includes "pos" (Point) for visualization.
39
- */
40
- declare class _Node {
41
- /**
42
- *
43
- * @param data - Data associated with the node; include "pos" (Point) for graph visuals
44
- */
45
- constructor(data: any);
46
- }
47
- interface Edge {
48
- start: number;
49
- end: number;
50
- data: any;
51
- }
52
- /**
53
- * Edge class: connects two nodes by start/end IDs; can hold optional data (e.g. "ldata" for line geometry).
54
- */
55
- declare class Edge {
56
- /**
57
- *
58
- * Construct an edge
59
- *
60
- * @param start Start index of the edge based on the array of nodes
61
- * @param end End index of the edge based on the array of nodes
62
- * @param data - Optional data; "ldata" is reserved for line geometry used when drawing the edge
63
- */
64
- constructor(start: number, end: number, data: any);
65
- }
66
- export interface Graph {
67
- nodes: Map<number, _Node>;
68
- edges: Map<number, Edge>;
69
- }
70
- /**
71
- * The main graph object: contains nodes and edges that get modified with different
72
- * operations (layout, clustering, etc.).
73
- */
74
- export class Graph {
75
- /**
76
- *
77
- * Construct a graph object (no initializing)
78
- *
79
- * @param nodes - Map of all the nodes associated with the graph
80
- * @param edges - Map of all the edges associated with the graph
81
- */
82
- constructor(nodes: Map<number, _Node>, edges: Map<number, Edge>);
83
- /**
84
- * Prints out a snapshot of data associated with this graph like how many nodes and how many edges
85
- */
86
- printData(): void;
87
- /**
88
- * Initializes the graph and constructs the node adjacency list.
89
- */
90
- initialize(): Promise<void>;
91
- /**
92
- *
93
- * This is the official create method to make a graph based on a set of nodes and edges
94
- * It also auto-initializes the graph and sets all the adjacency lists in memory.
95
- *
96
- * @param nodes - map of nodes
97
- * @param edges - map of edges
98
- * @returns
99
- */
100
- static create(nodes: Map<number, _Node>, edges: Map<number, Edge>): Promise<Graph>;
101
- /**
102
- * Constructs the adjacency associated with the graph
103
- */
104
- constructAdjacencyList(): Promise<void>;
105
- /**
106
- * Add a node to the graph.
107
- * @param nodeID - The node ID
108
- * @param data - Data associated with the node
109
- */
110
- add_node(nodeID: number, data: _Node): void;
111
- /**
112
- * Add an edge to the graph
113
- * @param start - Starting index of the edge
114
- * @param end - The end index of the edge
115
- * @param data - data associated with the edge
116
- */
117
- add_edge(start: number, end: number, data: any): void;
118
- /**
119
- *
120
- * @returns The adjacency lists associated with the graph
121
- */
122
- get_adjacency(): Map<number, number[]>;
123
- /**
124
- * Apply a position map based on some data
125
- * @param data - the position map that has to be applied to the graph
126
- */
127
- apply_position_map(data: Map<number, Point>): void;
128
- /**
129
- * Apply an line map to a graph
130
- * @param data Line data that has to be applied to the graph
131
- */
132
- apply_edge_pos_maps(data: Map<number, Line>): void;
133
- /**
134
- * get the current edge map
135
- * @returns The current set of edges associated with the graph
136
- */
137
- get_edge_map(): Map<number, Line>;
138
- /**
139
- * Applies all the maps to the graph
140
- * @param layout - Applies an object of maps associated with with a graph is made up of {pmap:(the position map), emap:{the edge map}}
141
- */
142
- apply_drawing_maps(layout: {
143
- pmap: Map<number, Point>;
144
- emap: Map<number, Line>;
145
- }): void;
146
- /**
147
- * Gets the position map and the edge map respectively
148
- * @returns The position map and the edge map as pmap and emap
149
- */
150
- get_map(): {
151
- pmap: Map<number, Point>;
152
- emap: Map<number, Line>;
153
- };
154
- /**
155
- * Get the position of the nodes in the graph.
156
- * @returns The position map (node ID to Point)
157
- */
158
- get_position_map(): Map<number, Point>;
159
- }
160
- /**
161
- *
162
- * Performs a BFS search on a graph - Async because it takes a while on large graphs
163
- *
164
- * @param Graph - The graph which has to be searched using the BFS algorithm
165
- * @param node - The node form which to start
166
- * @returns - A map of which node was explored from which other node
167
- */
168
- declare function BFSSearch(Graph: Graph, node: number): Promise<Map<number, number>>;
169
- /**
170
- *
171
- * Performs a dijkstra search on a graph
172
- *
173
- * @param Graph - The graph on which to perform the Dijkstra search
174
- * @param Node - The node from which to start
175
- * @returns - Map from which each one of the nodes was searched from
176
- */
177
- declare function Dijkstra(Graph: Graph, Node: number): Promise<Map<number, number>>;
178
- /**
179
- *
180
- * Finds the diameter of the graph
181
- *
182
- * @param Graph
183
- * @returns returns an object with a start, end - the two points of a graph and the diameter of the graph
184
- */
185
- declare function GraphDiameter(Graph: Graph): Promise<{
186
- start: number;
187
- end: number;
188
- distance: number;
189
- }>;
190
- /**
191
- *
192
- * Select a subgraph
193
- *
194
- * @param graph - The main graph to select from
195
- * @param nodeList - The selection of nodes that we want to select from this graph
196
- * @returns A graph object that contains this subgraph
197
- */
198
- declare function SelectSubgraph(graph: Graph, nodeList: number[]): Promise<Graph>;
199
- export const GraphMethods: {
200
- GraphDiameter: typeof GraphDiameter;
201
- Dijkstra: typeof Dijkstra;
202
- BFSSearch: typeof BFSSearch;
203
- SelectSubgraph: typeof SelectSubgraph;
204
- };
205
- /**
206
- * construct a graph based on an edge list and node list
207
- * @param nodes nodes as a list
208
- * @param edges edges as a list
209
- * @returns A graph that was construct from the list of nodes and edges
210
- */
211
- declare function ConstructGraphNodeEdgesList(nodes: any[], edges: any[]): Promise<Graph>;
212
- export const Constructors: {
213
- ConstructGraphNodeEdgesList: typeof ConstructGraphNodeEdgesList;
214
- };
215
- /**
216
- * calculate the average of an array of numberss
217
- * @param arr an array of number whose average has to be calculated
218
- * @returns the average
219
- */
220
- declare function calculateAverage(arr: number[]): number;
221
- /**
222
- * Calculate the distance betweeen two points
223
- * @param p1 the first point
224
- * @param p2 the second point
225
- * @returns the distance between the points
226
- */
227
- declare function calculateDistance(p1: Point, p2: Point): number;
228
- /**
229
- * Calculate the squared distance between two points
230
- * @param p1 the first point
231
- * @param p2 the second point
232
- * @returns the squared distance between the two points
233
- */
234
- declare function calculateSquaredDistance(p1: Point, p2: Point): number;
235
- /**
236
- * get a random subset of something from a array of things must provide the number of things we want from that array
237
- * @param arr the array from which the subset has to be made
238
- * @param n number of items to select
239
- * @returns a new array made up of a random sample from the original array
240
- */
241
- declare function getRandomSubset(arr: any[], n: number): any[];
242
- /**
243
- * This is a super useful method to get a random number of edges or something that you would like to draw
244
- * this is primarily done because there are way too many edges sometimes and and the number of edges is really
245
- * What slows the whole rendering process down
246
- * @param map - the map that youd like to reduce
247
- * @param n - the fraction of items that youd like to return from this map
248
- * @returns A reduced map with a fractio of those many entries
249
- */
250
- declare function getRandomSubset_map(map: Map<number, any>, n: number): Map<any, any>;
251
- export const Utilities: {
252
- calculateAverage: typeof calculateAverage;
253
- calculateDistance: typeof calculateDistance;
254
- calculateSquaredDistance: typeof calculateSquaredDistance;
255
- getRandomSubset: typeof getRandomSubset;
256
- getRandomSubset_map: typeof getRandomSubset_map;
257
- };
258
- /**
259
- * Creates a line based on the number of divisons
260
- *
261
- * @param start the start point
262
- * @param end the end point
263
- * @param divisions the number of divisions
264
- * @returns the line object
265
- */
266
- declare function line_from_start_end_divisions(start: Point, end: Point, divisions: number): Line;
267
- /**
268
- * Divides the line into a number of divisions based on distance
269
- * @param start - the start point
270
- * @param end - the end point
271
- * @param distance - the distance at which this line must be divided
272
- * @returns A line object with the right number of points
273
- */
274
- declare function line_from_start_end_distance(start: Point, end: Point, distance: number): Line;
275
- /**
276
- * Calculates the centroid of an array of points
277
- * @param points An array of points
278
- * @returns the central point of the array of points
279
- */
280
- declare function centroid(points: Point[]): Point;
281
- export const Geometry: {
282
- line_from_start_end_divisions: typeof line_from_start_end_divisions;
283
- line_from_start_end_distance: typeof line_from_start_end_distance;
284
- centroid: typeof centroid;
285
- };
286
- /**
287
- * Simulates Kamada kawai for a network in 2d. 3d is not supported yet
288
- * Note: This is an async function as it take time for some of the large graphs
289
- *
290
- * @param Graph - The first input number
291
- * @param iterations - The second input number
292
- * @param simulationBound - The bounds of simulation (Mostly a global number to scale the graph up or down)
293
- * @param cohesionValue - How sticky the nodes are i.r. how much they cluster together
294
- * @returns And node map of all the nodes and their simulated positions - Please note: position maps have to to be applied to the graph!
295
- *
296
- */
297
- declare function SimulateKamadaKawai(Graph: Graph, iterations: number, simulationBound?: number, cohesionValue?: number, repulsionValue?: number): Promise<Map<number, Point>>;
298
- /**
299
- *
300
- * Randomly sets all the positions for a graph
301
- * Not really very useful but I've used it in some cases and have kept it around
302
- *
303
- * @param Graph - The graph who's nodes you would want to reposition
304
- *
305
- * @return A position map of all the nodes and its corresponding positions
306
- */
307
- declare function InstanciateRandomPositions(Graph: Graph): Map<number, Point>;
308
- /**
309
- *
310
- * Constructs the edges as lines, Note: these are just a representation of the lines
311
- * they then have to be visulized using one of the Three JS Drawer functions like
312
- * draw a thick line or a thin line. This draws out the edges divided by some number of
313
- * divisions that you specify
314
- *
315
- * @param Graph - The graph whos edges are getting drawn
316
- * @param divDistance - How many divisions (distance) to make along the edge
317
- * @returns A line map - which holds a map of all the edge indices and the corresponding line representations
318
- */
319
- declare function DrawEdgeLines(Graph: Graph, divDistance: number): Map<number, Line>;
320
- /**
321
- *
322
- * Constructs the edges as lines, Note: these are just a representation of the lines
323
- * they then have to be visulized using one of the Three JS Drawer functions like
324
- * draw a thick line or a thin line - this draws them based on the number of divisions
325
- * you would like them to have
326
- * @param Graph - The graph whos edges are getting drawn
327
- * @param numberOfDivs - How many divisions to make along the edge
328
- * @returns A line map - which holds a map of all the edge indices and the corresponding line representations
329
- */
330
- declare function DrawEdgeLinesDivisions(Graph: Graph, numberOfDivs: number): Map<number, Line>;
331
- /**
332
- *
333
- * Edge bundling - this isnt as fast as the current KDE based methods - but it provides a basic method of
334
- * Visualizing large edge flows. Note: This is an aysnc function as it takes a while for the edge bundling to happen
335
- *
336
- * @param LineMap - The map of edges as a line map
337
- * @param iterations - The number of iterations to run edge bundling
338
- * @param distance - A shorthand for how close together the vertices need to be before they get influnced by each other
339
- * @returns A line map with all the updated positions of the line (Where they are bundled together) Again - this needs to be applied to the graph!
340
- */
341
- declare function DrawEdgeBundling(LineMap: Map<number, Line>, iterations: number, distance: number): Promise<Map<number, Line>>;
342
- /**
343
- *
344
- * Displace the edges vertically, almost akin to the Deck.gl arcs
345
- * The displacement is done in a sin curve with the ends still touching the nodes
346
- * Note: This is an inplace modification of the edges
347
- *
348
- * @param LineMap - The map of edges as a line map
349
- * @param displacement - the amount of vertical displacement
350
- */
351
- declare function DisplaceEdgeInY(LineMap: Map<number, Line>, displacement: number): Map<number, Line>;
352
- /**
353
- *
354
- * Displace the vertices vertically based on some prameter (For example degree or modularity)
355
- *
356
- * @param Graph - the graph whos nodes have to be displaced
357
- * @param parameter - the prameter based on which you want to modify the
358
- * @param displacement - the maximum amunt of displacement, all the other values are rescaled linerly
359
- */
360
- declare function DisplaceVertices(Graph: Graph, parameter: string, displacement: number): void;
361
- /**
362
- *
363
- * Generates a hive plot for a graph, this includes the option to displace the graph vertically based on degrees and how far away each node is
364
- *
365
- * @param Graph - The graph
366
- * @param selectedNode - the node around which the hive plot is generated
367
- * @param step - If the hive should step up or down if yes then by what increments
368
- * @param startPosition - Starting position
369
- * @returns
370
- */
371
- declare function HivePlot(Graph: Graph, selectedNode: number, step: number, startPosition: Point): Promise<{
372
- pmap: Map<any, any>;
373
- emap: Map<number, Line>;
374
- }>;
375
- /**
376
- * Move a graph somewhere (like the physical location) - This is an inplace movement and overwrites existing values
377
- *
378
- * @param Graph - The graph that has to be moved
379
- * @param dispacement - This is a point and I end up using Point and Vector interchangably. So here the xyz values from the point are used to displace the nodes
380
- */
381
- declare function MoveGraph(Graph: Graph, dispacement: Point): void;
382
- /**
383
- *
384
- * Draw new lines from edges, and draw them based on the distance of divisions (i.e. divide the line up every 10 units) Note: This is an in place update that takes place on the graph - it overwrites the existing data.
385
- *
386
- * @param Graph - The grapht who's edges have to be updated
387
- * @param divDistance - The distance by which the divisions are made
388
- */
389
- declare function UpdateEdgeLinesDist(Graph: Graph, divDistance: number): void;
390
- /**
391
- *
392
- * Draw new lines from edges, and draw them based on divisions (i.e. divide the line into 10 units) Note: This is an in place update that takes place on the graph - it overwrites the existing data.
393
-
394
- * @param Graph - The grapht who's edges have to be updated
395
- * @param Divs - The number of divisions to be made
396
- */
397
- declare function UpdateEdgeLinesDivs(Graph: Graph, Divs: number): void;
398
- export const Drawing: {
399
- SimulateKamadaKawai: typeof SimulateKamadaKawai;
400
- DrawEdgeLines: typeof DrawEdgeLines;
401
- DrawEdgeLinesDivisions: typeof DrawEdgeLinesDivisions;
402
- DrawEdgeBundling: typeof DrawEdgeBundling;
403
- HivePlot: typeof HivePlot;
404
- DisplaceEdgeInY: typeof DisplaceEdgeInY;
405
- MoveGraph: typeof MoveGraph;
406
- InstanciateRandomPositions: typeof InstanciateRandomPositions;
407
- DisplaceVertices: typeof DisplaceVertices;
408
- UpdateEdgeLinesDist: typeof UpdateEdgeLinesDist;
409
- UpdateEdgeLinesDivs: typeof UpdateEdgeLinesDivs;
410
- };
411
- /**
412
- *
413
- * @returns the raw ZKC dataset
414
- */
415
- declare function LoadZKC(): Promise<Graph>;
416
- /**
417
- *
418
- * @returns the ZKC dataset with the positons simulated before hand
419
- */
420
- declare function LoadZKCSimulated(): Promise<Graph>;
421
- export const SampleData: {
422
- LoadZKC: typeof LoadZKC;
423
- LoadZKCSimulated: typeof LoadZKCSimulated;
424
- };
425
- /**
426
- *
427
- * Draw the veritces of the graph out as a point cloud
428
- *
429
- * @param Graph - the graph that has to be drawn out
430
- * @param bounds - A global scaling parameter defaults to 1 but change to scale up a garph
431
- * @param size - The size of all the nodes - either input an array the same length of the number of nodes decribing how big each node is, or a global node value as a number or defaults to 1
432
- * @param color - the color of the node defaults to white
433
- * @param alpha - the alpha value of the node defaults to 1 (opaque)
434
- * @returns a three JS group that contains all the vertices as a point cloud or a three js points object that can be added to the scene
435
- */
436
- declare function DrawTHREEGraphVertices(Graph: Graph, bounds?: number, size?: number | number[], color?: number, alpha?: number): THREE.Group<THREE.Object3DEventMap>;
437
- /**
438
- *
439
- * Draws out all the edges (Thick edges of a graph)
440
- *
441
- * @param Graph - The graph whose edges have to be drawn
442
- * @param bounds - the global scale for all the edges to be drawn defaults to 1
443
- * @param color - color of the edges defaults to white
444
- * @param thickness - thickness of the edges (defaults to 0.4; screen-space pixels ≈ thickness × 100 for values &lt; 1)
445
- * @returns a Three Js group of edges that can be added to the scene
446
- */
447
- declare function DrawTHREEGraphEdgesThick(Graph: Graph, bounds?: number, color?: number, thickness?: number): THREE.Group<THREE.Object3DEventMap>;
448
- /**
449
- *
450
- * Draw thick edges from an edge map
451
- *
452
- * @param EdgeMap - The edge map associated with the graph
453
- * @param bounds - The global scale of the graph - defaults to 1
454
- * @param color - The color of the edges - defaults to white
455
- * @param thickness - thickness of the edges (defaults to 0.4; pixels ≈ thickness × 100 for values &lt; 1)
456
- * @returns
457
- */
458
- declare function DrawThickEdgesFromEdgeMap(EdgeMap: Map<number, Line>, bounds: number, color?: number, thickness?: number): THREE.Group<THREE.Object3DEventMap>;
459
- /**
460
- *
461
- * Draw thin lines for all the edges given a graph
462
- *
463
- * @param Graph - The graph that has to be drawn
464
- * @param bounds - The global scale factor for the the edges - defaults to 1
465
- * @param color - color of the lines - defaults to white
466
- * @returns
467
- */
468
- declare function DrawTHREEGraphEdgesThin(Graph: Graph, bounds?: number, color?: number): THREE.Group<THREE.Object3DEventMap>;
469
- /**
470
- * Draw a single thick line through an ordered list of node IDs (e.g. a path).
471
- * Uses graph positions; line width in pixels (pass thickness >= 1 for pixel width).
472
- *
473
- * @param Graph - Graph with position map
474
- * @param bounds - Scale factor for positions
475
- * @param pathNodeIds - Ordered node IDs (start to end)
476
- * @param color - Hex color for the path line
477
- * @param thickness - Line width in pixels (e.g. 5 for a thick path)
478
- */
479
- declare function DrawThickPathFromNodeIds(Graph: Graph, bounds: number, pathNodeIds: number[], color?: number, thickness?: number): THREE.Group<THREE.Object3DEventMap>;
480
- /**
481
- *
482
- * Draw Line map as lines given the edge map assocaited with the graph
483
- *
484
- * @param LineMap - The edge map that has to be drawn out
485
- * @param bounds - Global scale for the edges to be drawn defaults to 1
486
- * @param color - Color of the edges defaults to 1
487
- * @returns
488
- */
489
- declare function DrawThinEdgesFromEdgeMap(LineMap: Map<number, Line>, bounds?: number, color?: number): THREE.Group<THREE.Object3DEventMap>;
490
- /**
491
- *
492
- * Adde boxes where all the boxes are
493
- *
494
- * @param nodeMap - a map of all the nodes
495
- * @param bounds - global scale of the edges to be drawn, defaults to 1
496
- * @param color - default color of the edges, defaults to white
497
- * @param size - size of the nodes defaults to 10
498
- * @returns a group of vertices that contains all of the boxes associated with each one of the vertices
499
- */
500
- declare function AddBoxBasedImaging(nodeMap: Map<number, Point>, bounds?: number, color?: number, size?: number | number[]): THREE.Group<THREE.Object3DEventMap>;
501
- /**
502
- *
503
- * Draw box based verices given a graph
504
- *
505
- * @param Graph - The graph that needs its vertices drawn
506
- * @param bounds - A global scale for the graph, defaults to one
507
- * @param color - Default color of the boxes defaults to white
508
- * @param size - Default size of the nodes defaults to 10
509
- * @returns
510
- */
511
- declare function DrawTHREEBoxBasedVertices(Graph: Graph, bounds?: number, color?: number, size?: number | number[]): THREE.Group<THREE.Object3DEventMap>;
512
- /**
513
- *
514
- * Draw cylinders where all the vertices are based on a node map
515
- *
516
- * @param nodeMap - the node map assiciate with the graph that has to be drawn out
517
- * @param divisonLength - the length of the divisions that are there in each one of the cylinder (this is a circumfurence amount), defaults to 16
518
- * @param color - the default color of the cylinder, defaults to white
519
- * @param size - the default size of the cylinder, defaults to 10
520
- * @returns
521
- */
522
- declare function AddCylinderBasedImaging(nodeMap: Map<number, Point>, divisonLength?: number, color?: number, size?: number | number[]): THREE.Group<THREE.Object3DEventMap>;
523
- /**
524
- *
525
- * Split up a graph and return an boject containing a bunch of node groups and edge groups based on some parameterS
526
- *
527
- * @param Graph - the graph that you want to split up
528
- * @param propertyName - the property that you want to split them on
529
- * @returns - an object that hasa set of node vertices and a set of edge lines based on the splitting factor
530
- */
531
- declare function AddInModularityBasedPointGroups(Graph: Graph, propertyName: string): Promise<{
532
- nodeGroups: Map<number, THREE.Group<THREE.Object3DEventMap>>;
533
- EdgeGroups: Map<number, THREE.Group<THREE.Object3DEventMap>>;
534
- }>;
535
- /**
536
- *
537
- * Draw simplified line edges (thin based) based on some number. This number is a fraction of the total number of edges (so if you specify 0.1 it would draw 10% of the edges)
538
- *
539
- * @param Graph - The graph that has to be drawn out
540
- * @param amount - The fraction of edges to be drawn
541
- * @param color - color of these edges - defaults to 0.1
542
- * @returns - a group of simple lines based on all the edges supplied to it
543
- */
544
- declare function DrawSimplifiedEdges(Graph: Graph, amount: number, color?: number): THREE.Group<THREE.Object3DEventMap>;
545
- /**
546
- * Set vertex colors by node ID. Uses the geometry's "label" attribute (node ID per vertex) to map node IDs to vertex indices; if "label" is missing, indexArray is treated as vertex indices.
547
- *
548
- * @param vertices - THREE.Points with customColor (and optionally label) attribute, or a Group whose first child is that Points object
549
- * @param indexArray - Node IDs to color, or vertex indices if geometry has no label attribute
550
- * @param color - Hex color to apply
551
- */
552
- declare function ChangeTheVertexColours(vertices: THREE.Points | THREE.Group, indexArray: number[], color: number): void;
553
- /**
554
- * Reset all vertex colors to white.
555
- * @param vertices - THREE.Points with customColor attribute, or a Group whose first child is that Points object
556
- */
557
- declare function ResetVertexColors(vertices: THREE.Points | THREE.Group): void;
558
- export const ThreeWrapper: {
559
- DrawTHREEGraphVertices: typeof DrawTHREEGraphVertices;
560
- DrawTHREEGraphEdgesThick: typeof DrawTHREEGraphEdgesThick;
561
- DrawTHREEGraphEdgesThin: typeof DrawTHREEGraphEdgesThin;
562
- DrawThickPathFromNodeIds: typeof DrawThickPathFromNodeIds;
563
- AddBoxBasedImaging: typeof AddBoxBasedImaging;
564
- AddInModularityBasedPointGroups: typeof AddInModularityBasedPointGroups;
565
- DrawThinEdgesFromEdgeMap: typeof DrawThinEdgesFromEdgeMap;
566
- DrawThickEdgesFromEdgeMap: typeof DrawThickEdgesFromEdgeMap;
567
- AddCylinderBasedImaging: typeof AddCylinderBasedImaging;
568
- DrawSimplifiedEdges: typeof DrawSimplifiedEdges;
569
- ChangeTheVertexColours: typeof ChangeTheVertexColours;
570
- ResetVertexColors: typeof ResetVertexColors;
571
- DrawTHREEBoxBasedVertices: typeof DrawTHREEBoxBasedVertices;
572
- };
573
- interface GraphDrawer3d {
574
- canvas: HTMLCanvasElement;
575
- width: number;
576
- height: number;
577
- geometryMap: Map<any, any>;
578
- materialMap: Map<any, any>;
579
- meshMap: Map<any, any>;
580
- controls: OrbitControls;
581
- renderer: THREE.WebGLRenderer;
582
- camera: THREE.PerspectiveCamera;
583
- scene: THREE.Scene;
584
- graphs: Map<number, Graph>;
585
- }
586
- /**
587
- * This is the main graph drawer class
588
- */
589
- declare class GraphDrawer3d {
590
- /**
591
- * To initialize the graph drawer there are a set of graph drawing settings that have to be set.
592
- * Here are the details to do the same:
593
- * canvas - the html canvas element that you would like to render
594
- * height - the the height of the initialized canvas
595
- * width - the width of the initialized canvas
596
- * geometry map - a map that keeps track of all the geometry in the scene (Optional)
597
- * material map - a mapt that keeps track of all the materials in the scene (Optional)
598
- * controls - Controls that define how one can navigate this 3d space (Self initialized)
599
- * renderer - Renderer element form the three JS library
600
- * camera - A perspective camera from the threeJS library
601
- * scene - The three JS scene that gets define automatically
602
- *
603
- * @param GraphDrawerOptions3d - These above options are construdeted into a single object and passed into the Options elem
604
- */
605
- constructor(GraphDrawerOptions3d: {
606
- canvas: HTMLCanvasElement;
607
- width: number;
608
- height: number;
609
- geometryMap: Map<any, any>;
610
- materialMap: Map<any, any>;
611
- meshMap: Map<any, any>;
612
- controls: OrbitControls;
613
- renderer: THREE.WebGLRenderer;
614
- camera: THREE.PerspectiveCamera;
615
- scene: THREE.Scene;
616
- });
617
- /**
618
- * This essentially initializes the drawing element based on the settings
619
- * Remember to do this since if if its not done the scene will not render
620
- */
621
- init(): Promise<void>;
622
- /**
623
- *
624
- * This is the main way to add elements to the viewer window that gets initialized
625
- *
626
- * @param element A geomerty element + material element to add to the scene as a group line or point cloud
627
- */
628
- addVisElement(element: THREE.Group | THREE.Line | THREE.Points): void;
629
- /**
630
- * This is the render call that is called every frame to update the rendering of the canvas
631
- * Remember to do this since this is a common are for bugs to occur
632
- */
633
- rendercall(): void;
634
- }
635
- export const GraphDrawer: {
636
- GraphDrawer3d: typeof GraphDrawer3d;
637
- };
638
- /**
639
- * The G ( n , p ) G(n,p) model, a graph is constructed by connecting labeled nodes randomly. Each edge is included in the graph with probability p p, independently from every other edge.
640
- * https://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_model
641
- * @param n Number of nodes
642
- * @param p Probability of two edges to eb connected
643
- * @returns A Erdos Reyni graph
644
- */
645
- declare function GenerateErdosReyni_n_p(n: number, p: number): Promise<Graph>;
646
- export const Models: {
647
- GenerateErdosReyni_n_p: typeof GenerateErdosReyni_n_p;
648
- };
649
- /**
650
- * Options for distance-based clustering.
651
- */
652
- interface ClusterByDistanceOptions {
653
- /** Maximum distance between two nodes for them to be in the same cluster. */
654
- distanceThreshold: number;
655
- }
656
- /**
657
- * Result of a clustering step: maps each node ID to its cluster ID.
658
- */
659
- interface ClusterResult {
660
- /** Map from original node ID to cluster ID (integer). */
661
- nodeToCluster: Map<number, number>;
662
- /** Map from cluster ID to centroid position (e.g. for super-node placement). */
663
- clusterCentroids: Map<number, Point>;
664
- /** List of unique cluster IDs. */
665
- clusterIds: number[];
666
- }
667
- /**
668
- * Strategy interface for hierarchical node combining.
669
- * Implementations (e.g. KD-tree distance-based, or future class-based) produce a clustering.
670
- */
671
- interface ClusterStrategy {
672
- /**
673
- * Compute clustering of graph nodes.
674
- * @param graph - The graph to cluster
675
- * @param options - Strategy-specific options
676
- * @returns Assignment of each node to a cluster and cluster centroids
677
- */
678
- cluster(graph: Graph, options: Record<string, unknown>): ClusterResult;
679
- }
680
- /**
681
- * Cluster the graph by distance (KD-tree based) and return a simplified graph.
682
- * Nodes within `distanceThreshold` are merged; super-nodes are placed at cluster centroids.
683
- *
684
- * @param graph - The graph to cluster
685
- * @param options - { distanceThreshold: number }
686
- * @returns A new graph with one node per cluster and aggregated edges between clusters
687
- */
688
- declare function clusterByDistance(graph: Graph, options: ClusterByDistanceOptions): Promise<Graph>;
689
- /**
690
- * Cluster the graph using a custom strategy and return a simplified graph.
691
- *
692
- * @param graph - The graph to cluster
693
- * @param strategy - A ClusterStrategy implementation
694
- * @param options - Strategy-specific options
695
- * @returns A new graph with one node per cluster and aggregated edges
696
- */
697
- declare function clusterByStrategy(graph: Graph, strategy: ClusterStrategy, options: Record<string, unknown>): Promise<Graph>;
698
- export const Hierarchy: {
699
- clusterByDistance: typeof clusterByDistance;
700
- clusterByStrategy: typeof clusterByStrategy;
701
- };
702
-
703
- //# sourceMappingURL=pgl.d.ts.map