A JavaScript library for drawing network graphs.

Overview

Gnet.js

Demo

Gnet is a JavaScript library for network graph visualization, developed by Goutham.

First I want to thank D3.js developers for creating such an amazing data visualization library. Gnet is build on top of D3.js for graph visualization and interaction. Even though it's build on D3.js it's very lightweight javascript library compared to D3.js. Also, Gnet is making use canvas feature of D3.js instead of traditional SVG. The big advantage of canvas over SVG is that you can create thousands of separate elements without it really affecting the performance.

This project is beta so I'm not recommending for production use.

Things I used.

d3js TypeScript Webpack npm

Example

A basic example of loading the network graph is shown below using Gnet.

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Gnet</title>
  </head>
  <body>
    <div id="container"></div>
  </body>
  <script src="gnet.min.js"></script>
  <script src="main.js"></script>
</html>

main.js

function main(){
    const data = {
        nodes: [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }],
        links: [
            {
                source: 1,
                target: 2,
            },
            {
                source: 2,
                target: 3,
            },
            {
                source: 3,
                target: 4,
            },
            {
                source: 4,
                target: 2,
            },
            {
                source: 3,
                target: 5,
            },
    ],
  };
   const graph = new Gnet("#container", {
        width: "500",
        height: "500",
        nodeStyle: {
            radius: 5,
            color: "#48C9B0",
            borderColor: "#fff",
        },
        linkStyle: {
            color: "#aaa",
        },
        complete: (d) => {
            console.log(d);
        },
    });
    graph.addData(data);
    graph.run();
}
main();

that's it, simple right 😎

Build

To build the library from source, clone the project from github.

$ git clone https://github.com/gouthams96/gnet.js.git

To install all the dependencies and build the library, run following commands in the root of the project.

$ cd gnet.js
$ npm install

Then, the project can be build running:

$ npm run build

Contribute

Contributions to the Gnet.js is are very welcome!.

You might also like...

Obsidian plugin to export Graphviz graphs from vault's notes

Obsidian plugin to export Graphviz graphs from vault's notes

What it is: an Obsidian plugin to generate hierarchical graphs, with the nodes are from your Obsidian vault How it does: convert the database from Bre

Nov 14, 2022

View maps, graphs, and tables of your save and compete in a casual, evergreen leaderboard of EU4 achievement speed runs. Upload and share your save with the world.

View maps, graphs, and tables of your save and compete in a casual, evergreen leaderboard of EU4 achievement speed runs. Upload and share your save with the world.

PDX Tools PDX Tools is a modern EU4 save file analyzer that allow users to view maps, graphs, and data tables of their save all within the browser. If

Dec 27, 2022

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

Jan 4, 2023

A obsidian.md plugin for rendering maths graphs.

A obsidian.md plugin for rendering maths graphs.

obsidian-functionplot A plugin for displaying mathematical graphs in obsidian.md. Remember to star this plugin on Github if you like it. How to use Ty

Dec 23, 2022

Automatically construct and visualize Graphs generated from your Node.js project

Automatically construct and visualize Graphs generated from your Node.js project

cyclops is a minimalist developer tool that can be used to generate directed graphs from your Node.js project. It can automatically detect circular de

Jan 5, 2023

A lightweight SolidJS component for building interactive node-based diagrams and graphs.

Convert Your Ideas To Graphs With Solid Graph! Solid Graph A lightweight and minimal Solid component for building interactive graphs and node-based ed

Dec 8, 2022

A lightweight SolidJS component for building interactive node-based diagrams and graphs.

Convert Your Ideas To A Simple And Excitig Journay With Odysea! Odysea A lightweight and minimal Solid component for building interactive graphs and n

Aug 15, 2022

Automatically construct, traverse and visualize graphs generated from your Node.js project

Automatically construct, traverse and visualize graphs generated from your Node.js project

skott is a minimalist developer tool that can be used to efficiently generate directed graphs from your JavaScript/Node.js project. It can automatical

Dec 21, 2022

Graphs/networks turned into tables

Graphs/networks turned into tables

(IMP NOTE FOR CONTRIBUTORS: PLEASE DON'T FORMAT THE CODE, IT'S DIFFICULT FOR ME TO FIND THE CHANGES. THANK YOU!) Graph to Table You must have seen gra

Oct 20, 2022
Owner
Goutham S
Cyber Security Engineer | Programmer | Encrypted life | :~$
Goutham S
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
JavaScript library to make drawing animation on SVG

vivus.js Demo available on http://maxwellito.github.io/vivus Play with it on Vivus Instant Vivus is a lightweight JavaScript class (with no dependenci

maxwellito 14.5k Jan 3, 2023
JustGage is a handy JavaScript plugin for generating and animating nice & clean dashboard gauges. It is based on Raphaël library for vector drawing.

JustGage JustGage is a handy JavaScript plugin for generating and animating nice & clean dashboard gauges. It is based on Raphaël library for vector d

Bojan Djuricic 1.8k Jan 3, 2023
Simple but Complete & Fast network monitor for your home network

netmon Netmon is an opensource project for protecting and monitoring your home network. Netmon is written to run on a Raspberry PI and is optimized to

Tommaso Ventafridda 9 Jul 6, 2022
Cross provider map drawing library, supporting Mapbox, Google Maps and Leaflet out the box

Terra Draw Frictionless map drawing across mapping providers. TerraDraw centralises map drawing logic and provides a host of out the box drawing modes

James Milner 106 Dec 31, 2022
Build Schema.org graphs for JavaScript Runtimes (Browser, Node, etc). Improve your sites SEO with quick and easy Rich Results.

schema-org-graph-js The quickest and easiest way to build Schema.org graphs for JavaScript Runtimes (Browser, Node, etc). Status: ?? In Development Pl

Harlan Wilton 17 Dec 21, 2022
Drawing Newton's fractal using pure js, rust-wasm, SIMDs, threads and GPU

Newton's fractal Runtime Newton's fractal renderer. >>Click<< to open in your browser Inspired by 3blue1brown's video about Newton's fractal. Drawing

Aleksei 86 Nov 17, 2022
A web app demonstrating how the Fourier series can be used to approximate user-inputted line drawing

Fourier Series Animation An interactive React web app that demonstrates how an arbitrary user-inputted line drawing can be approximated using the Four

Jason Wang 31 Dec 22, 2022
API and site for discovering publicly-available Desmos graphs. Not affiliated with Desmos.

desmosearch-api API and site for discovering, cataloguing, and keeping track of publicly-available Desmos graphs. Not affiliated with Desmos. This pro

null 4 Feb 24, 2022