Coder Social home page Coder Social logo

rajatjain1997 / layered-3d-graphs Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 1.91 MB

Layered 3D graphs aims to plot 3D force directed and layered graphs on the basis of a "pre-requisite of" relationship between nodes. It borrows the philosophy from the paper "Latitude and Longitude of a Semantic System From a Directed Graph of Dependencies" by Nagarguna G. et al.

License: GNU Affero General Public License v3.0

CSS 16.39% HTML 5.03% JavaScript 21.95% R 38.23% Shell 0.37% Dockerfile 6.02% Python 12.01%
nodejs r shiny kue javascript d3 socket-io force-directed-graphs plotly docker

layered-3d-graphs's Introduction

Docker Build Status

Layered-3D-Graphs

Layered-3D-Graphs plots 3D force directed and layered graphs on the basis of a pre-requisite of relationship between nodes.

Quick Reference

Introduction

The graph is rendered using the following sequence of steps:

  1. Read the data and initialize each node to (x = 0, y = 0, layer = 1), where layer is plotted on the z-axis.

  2. Calculate the layer of each node using the "pre-requisite of" relationship. Each node has a layer assigned to it such that,

    • No two nodes related by an edge are on the same level.
    • For each node at layer n, there exists at least one node at layer n-1 which is related to the aforementioned node.
  3. Apply electrostatic repulsive forces between each node in a particular layer and give each edge a spring force.

  4. Store the graph in a database, so that if the same dataset is needed, calculations need not be done.

  5. Render the graph with the coordinates (x, y, layer) calculated in step 3.

Layered-3D-Graphs can scale to huge datasets easily, with most of the time taken only in serializing the data to the database, and constructing indices.

Installation

Layered-3D-Graphs is available as a docker image. Pull the image from docker hub first by:

docker pull rajatjain1997/layered-3d-graphs

The following are the ports used by the image:

Container Port Host Port Task
8000 ANY Dataset processing
4000 4000 Graph Plotter

To run the image, use:

docker run \
	-p 4000:4000 -p 8000:8000 \
	--volume=$HOME/Layered-3D-Graphs/data:/code/data \
	--name=layered-3d-graphs rajatjain1997/layered-3d-graphs

This binds the data volume of the container to the host machine to allow for easy input of data.

Configuration

By default, Layered-3D-Graphs visualizations are only accessible through localhost. However, easy configuration options are provided to make it available on local or wide area networks.

Configuration File Option Function Default
server.json host IP of the application, set it to wherever Layered-3D-Graphs is to be hosted localhost
server.json plotter_address The address at which the plotter is mapped outside the container http://localhost:4000

For persistent configuration, you need to copy the \code\config directory on your local machine and bind it to a new instance of the container.

NOTE: After configuration, the container needs to be restarted.

Creating/Preparing Data

Layered-3D-Graphs accepts JSON format graphs, with the key "nodes" holding an array of all vertix objects and "links" holding an array denoting the relationships.

Each node in nodes should have the following keys:

  • id = Unique ID for the node
  • name = Name of the node

Each relationship in links should have the following keys:

  • source = The node from which the link orginates
  • destination = The node on which the link ends

Once prepared, the data file can be placed in the docker container's data volume (bound at $HOME/Layered-3D-Graphs/data) and can be plotted by visiting the web interface at

localhost:8000/?data="FILE_NAME"

Layered-3D-Graphs has been tested with more than 30000 nodes and 70000 edges! It's easy to plot big graphs!

UI

Once plotting is completed, Layered-3D-Graphs offers a simple web-interface which allows the user to search and plot the dependencies and parents of each node in the graph by either doing a full text search or by clicking any node in the graph. The results, once computed, are available in a sub-graph.

Both the graphs and the subgraphs are fully interactive and support the search functionality.

The graph is persistently stored in a database inside the container. Therefore, it can be generated again without recalculations by visiting

localhost:4000

Backend Design

The backend is written keeping big graphs in mind, and employs the use of nodejs, redis, neo4j and shiny. Each component achieves separate purposes, as described below.

  • Nodejs: The main page is hosted on an express app, which does all the calculations related to forces on the graph on the client machine and sends the calculated information to the server. This information is sent through sockets as they maintain persistent connections and are thus able to consistently post messages to the server without the overhead of sending the headers and waiting for the response per request.

  • Redis: Loading all the data in neo4j takes time as queries on databases are slower than the speed at which the server is receiving the database insertion requests. Kue is used to maintain an asynchronous queue on redis which acts as a buffer from the server where queries are stored until neo4j is ready to execute them.

  • Neo4j: Neo4j is the database that is used to store persistent information about the last graph calculated by Layered-3D-Graphs. This helps in fast access of the last graph generated any number of times at the cost of the initial time taken in order to construct the database.

  • Shiny: The shiny server uses the power of plotly to batch plot the entire graph present in the database. It also hosts the search engine and the entire UI of the graph rendering page, and if directly visited skips the recalculations.

Use Cases

License

All Layered-3D-Graphs source code is made available under the terms of the GNU Affero Public License (GNU AGPLv3).

layered-3d-graphs's People

Contributors

rajatjain1997 avatar rohitg28 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rohitg28 nnu-gisa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.