plebeiangraphlibrary 1.0.6

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 ADDED
@@ -0,0 +1,139 @@
1
+ ## Introduction
2
+
3
+ The Plebeian Graph Library (PGL) is a library designed to facilitate the visualization of large-scale network data (Network X line plotting in Javascript/Typescript). Leveraging the power of WebGL, PGL offers an efficient and interactive solution for visualizing network data in web browsers (Tested on Firefox, Edge and Chrome). Whether dealing with local datasets or data retrieved from APIs, PGL provides a versatile platform for conducting extensive network simulations, physical modeling, and immersive visualizations. With a rich set of features including graph condensation based on selected criteria, randomized edge pruning in highly connected graphs, and support for diverse visualization techniques like network diffusions and Kamada Kawai layouts, and edge bundling, PGL empowers users to gain valuable insights from complex network structures.
4
+
5
+ ## Notes on terminology
6
+
7
+ It can be a bit cunfusing especially when working with Nodes/Edges/Vetices/Lines in this library (Also in general in working with graphs). Hence the terminology that I've followed here is as following:
8
+
9
+ - Nodes (The libray and the class is called \_Node so as to not confuse with NodeJS ) and Edges make up a graph.
10
+ - Vertices and Lines make up the 3d visualisation side of a graph.
11
+ - Nodes are the abstract idea, vertices are what's visualized
12
+ - Edges are the abstract idea , lines are what's visualized
13
+ Lastly there are a few helper classes like points and lines. Points are essentially vectors and are used for displacement and also for describing a place in relation to the global coordinate system. Line are an array of points that get translated into lines using one of the visualization methods. Points can have different visualisations like boxes, billboarded planes and cylinders etc.
14
+
15
+ ## Semantics of the Package
16
+
17
+ Existing network visualisation libraries like NetworkX dictated the semantics of the graph library and borrowed some of the semantic ideas from three JS. The process is to define a Graph Object made of nodes and edges. Then modify this graph based on some set of properties. Then update the relevant settings. And lastly, to visualise the nodes, either as point clouds, boxes or cylinders, and to draw out the edges (bundled or not) lines.
18
+ Here is an illustrated walkthrough of a simple set-up given a predefined set of “nodes” and “edges”.
19
+
20
+ ## Documentation
21
+
22
+ The documentation for the package is available at [documentation](https://www.plebeiangraphlibrary.com/)
23
+
24
+ ## General setup of the package
25
+
26
+ Apart from the graph class all the methods are stored in variables. These variables (For example SampleData) would have a function attached to it that retuns a value, or in some cases you can pass in values to do stuff (like displaceing the graph etc). I mostly did this for the sake of speed to develop - at some point shall be wrapping them up as classes.
27
+
28
+ ## An example of rendering a basic graph
29
+
30
+ The general idea of drawing a basic graph is outlined above. To recap all the basic steps:
31
+
32
+ - Get a graph (either generate it or get onse using the sample data)
33
+ - Create a graph drawing window (this is essentially a three js canvas)
34
+ - Then add the elements like the nodes of the graphs using one of the many drawing options
35
+
36
+ ```javascript
37
+ // import the library
38
+ import * as PGL from "plebeiangraphlibrary";
39
+
40
+ async function createVisualization() {
41
+ // Load up the ZKC dataset
42
+ const zkcSimulated = await PGL.SampleData.LoadZKCSimulated();
43
+
44
+ // Attach the renderer to a div which is on an HTML that the script is linked too
45
+ const canvas = document.getElementById("displayCanvas");
46
+ // These are some basic options to set up a graph drawing object. Please refer to the documentation for more options
47
+ const graphDrawerOptions = {
48
+ graph: zkcSimulated,
49
+ width: 800,
50
+ height: 700,
51
+ canvas: canvas,
52
+ };
53
+
54
+ // Initialize a graph with these settings
55
+ const graph3d = new PGL.GraphDrawer.GraphDrawer3d(graphDrawerOptions);
56
+ await graph3d.init();
57
+
58
+ // Create the 3d elements for the graph
59
+ // first describe a global scaling factor
60
+ const bounds = 1;
61
+ // Create all the geometry associated with node elements
62
+ const nodeVisualElements = PGL.ThreeWrapper.DrawTHREEBoxBasedVertices(
63
+ zkcSimulated,
64
+ bounds,
65
+ 0xffffff,
66
+ 5
67
+ );
68
+ // add the node geometry to the scene
69
+ graph3d.addVisElement(nodeVisualElements);
70
+ // then create all the geometry associated with the edge elements
71
+ const edgeVisualElements = PGL.ThreeWrapper.DrawTHREEGraphEdgesThick(
72
+ zkcSimulated,
73
+ bounds,
74
+ 0xffafcc,
75
+ 0.02
76
+ );
77
+ // add the edge geometry to the scene
78
+ graph3d.addVisElement(edgeVisualElements);
79
+
80
+ // by default the camera revolves around the graph, trigger the animation call
81
+ function animate() {
82
+ requestAnimationFrame(animate);
83
+ graph3d.rendercall();
84
+ }
85
+
86
+ animate();
87
+ }
88
+
89
+ createVisualization();
90
+ ```
91
+
92
+ ## Usage / Installation
93
+
94
+ Install it from the npm repository. Note that this method needs a npm folder to be set up with a build tool like parcel to package the visualisations
95
+
96
+ ```
97
+ npm i plebeiangraphlibrary
98
+ ```
99
+ There is a boiler plate example of this in [repository](https://github.com/range-et/pgl_example)
100
+
101
+ Or head over to the github, download the pgl_module.js [Builds](https://github.com/range-et/PGL/tree/main/Build) file and then start using it as a standalone module.
102
+
103
+ ## More examples
104
+
105
+ More examples are available at [Examples](https://www.plebeiangraphlibrary.com/examples.html) Check them out as a demonstration of some of the features of the library.
106
+
107
+ ## Integrations
108
+
109
+ The plebeian Graph Library (PGL) is built on top of the ThreeJS library, seamlessly integrating its rich functionalities into a comprehensive and powerful toolset for large-scale graph data visualization. By leveraging the foundation provided by ThreeJS, PGL inherits a wide range of features, including advanced shading techniques, texture mapping capabilities, and much more. These powerful rendering capabilities enable PGL to create visually stunning and immersive graph visualizations, adding depth and realism to the representation of complex network structures. With its symbiotic relationship with ThreeJS, PGL empowers users to go beyond traditional graph visualizations, unlocking a world of possibilities for exploration and analysis.
110
+
111
+ ## Benchmarking
112
+
113
+ A performance benchmark conducted against D3, an industry-standard visualization library, showcases PGL's capabilities. In this test involving approximately 5000 nodes and 200000 edges, D3-based SVG graphs only achieved a frame rate of 1.5 frames per second, bottoming at a frame every two seconds with a maximum of 12 frames per second. In contrast, PGL maintained a minimum of 52 frames per second and averaging 58 frames per second under similar conditions. This benchmark, performed on both Firefox and Chrome browsers (with negligible differences in performance) on a computer with an Nvidia RTX 2080 GPU, highlights PGL's superior performance and efficiency in rendering complex network visualizations. The benchmarking files are available under benchmarking for the D3 project and the PGL example can be accessed under Examples / 3_LargePointCloud.html
114
+
115
+ ## Contributing
116
+
117
+ Contributions are welcome to the plebeian Graph Library (PGL)! Whether you're fixing a bug, adding a feature, improving documentation, or spreading the word, your contribution is valuable. Here's how you can get involved:
118
+
119
+ * Reporting Issues: If you encounter any bugs or issues, please report them in the Issues section of our GitHub repository. Provide as much detail as you can, including steps to reproduce the issue.
120
+
121
+ * Submitting Changes:
122
+ - Fork the repository on GitHub.
123
+ - Clone your forked repository to your local machine.
124
+ - Create a new branch for your feature or bug fix.
125
+ - Make your changes and test them.
126
+ - Commit your changes and push them to your fork.
127
+ - Submit a pull request back to the main repository. In your pull request, describe the changes and link to any relevant issues.
128
+
129
+ * Seeking Support: If you have questions or need help integrating PGL into your project, feel free to reach out on the github [issues page](https://github.com/range-et/PGL/issues), I shall be more than happy to help out there.
130
+
131
+ * Improving Documentation: Good documentation is crucial for any project. If you see an area that needs improvement or have ideas for new content, don't hesitate to reach out and open an issue.
132
+
133
+ Also remember to check out the contributions file where there are more details on how to contribute to the project.
134
+
135
+ Remember to follow our Code of Conduct to ensure a welcoming and inclusive environment for everyone
136
+
137
+ ## Acknowledgements
138
+
139
+ This libray was sponsored by the Geometry Lab under the Laborotory for Design Technologies at the Graduate School of Design, Harvard University. Many thanks to Andrew Witt for guiding this project. This project was developed by : [Indrajeet Haldar](https://www.indrajeethaldar.com/)
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "plebeiangraphlibrary",
3
+ "version": "1.0.6",
4
+ "description": "A NetworkX like package for graphs in javascript",
5
+ "source": "./Src/index.ts",
6
+ "main": "./Build/pgl.js",
7
+ "types": "./Build/pgl.d.ts",
8
+ "module": "./Build/pgl_module.js",
9
+ "scripts": {
10
+ "watch": "parcel watch",
11
+ "build": "parcel build",
12
+ "test": "node ./test/test_1.js",
13
+ "document": "npx typedoc --out docs Src"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/range-et/PGL.git"
18
+ },
19
+ "keywords": [
20
+ "Network",
21
+ "Graphs",
22
+ "Webgl",
23
+ "Visualization"
24
+ ],
25
+ "files": [
26
+ "Build/",
27
+ "Examples/",
28
+ "README.md",
29
+ "CODE_OF_CONDUCT.md",
30
+ "CONTRIBUTING.md",
31
+ "LICENSE"
32
+ ],
33
+ "author": "Indrajeet Haldar",
34
+ "license": "MIT",
35
+ "bugs": {
36
+ "url": "https://github.com/range-et/PGL/issues"
37
+ },
38
+ "homepage": "https://www.plebeiangraphlibrary.com/",
39
+ "targets": {
40
+ "main": {
41
+ "includeNodeModules": false
42
+ },
43
+ "module": {
44
+ "includeNodeModules": true
45
+ }
46
+ },
47
+ "dependencies": {
48
+ "three": "^0.141.0"
49
+ },
50
+ "devDependencies": {
51
+ "@parcel/packager-ts": "^2.9.1",
52
+ "@parcel/transformer-typescript-tsc": "^2.9.1",
53
+ "@parcel/transformer-typescript-types": "^2.9.1",
54
+ "@types/three": "^0.136.1",
55
+ "express": "^4.18.2",
56
+ "jest": "^29.7.0",
57
+ "jest-image-snapshot": "^6.4.0",
58
+ "jsdoc": "^4.0.2",
59
+ "parcel": "^2.9.1",
60
+ "pixelmatch": "^5.3.0",
61
+ "pngjs": "^7.0.0",
62
+ "puppeteer": "^21.7.0",
63
+ "shelljs": "^0.8.5",
64
+ "typedoc": "^0.24.8",
65
+ "typescript": "^5.1.3"
66
+ }
67
+ }