Skip to content

quivero/prego

Repository files navigation

nail it

Prego

Codacy Badge StandWithUkraine npm version Code coverage report downloads

This is a npm data-structure application service and package: The former is work in progress; the latter exhibits a more mature form. It is a bootstrap from this project: https://github.com/trekhleb/javascript-algorithms.

Table of contents

  1. Preamble
  2. How to run
  3. Featured
  4. Backlog
  5. Prelude

Preamble

"In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data i.e., it is an algebraic structure about data." From wikipedia

How to run

As a package

Here is an example of the library use case.

  1. Navigate to your project path (for example, NodeJS or React);
  2. Install the library by command run npm install --save quivero-api;
  3. Import in your project, for example, import Graph from 'quivero-api/data-structures/graph/Graph.js'

As a service

We host the app on a cloud service {AWS, Azure, GCloud} or run locally. For it, we run either commands below:

  1. Dockerfile:
docker build -t quivero . &&& docker run --publish 8080:8080 quivero
  1. docker-compose:
docker-compose up

We follow the instructions below to host the service locally:

  1. Clone the repository by command run on terminal: git clone git@github.com:quivero/quivero-api.git;

  2. Run the commands:

    2.1. npm install: install local dependencies;

    2.2. npm start: run the server locally;

  3. Go to route localhost:8080 on the URL field of predilect browser;

Featured

The library Mermaid offers a graphical manner to visualize, among others, graphs. It is a feature as a parser for development tool FlowBuild workflow JSON-artifacts, available here. There are some samples here.

For diagrams rendering, you need to:

  1. Copy the text file content available here;
  2. Open online Mermaid Editor here;
  3. Paste the copied content from item 1) on the respective text field;
  4. In the case of big enough textual diagram, the platform will complain and deactivate auto-rendering. You must reactivate it to see the rendered diagram.

Remark: The resulting diagram text-code outputs as a string with escape characters \n. The online tool FreeFormater allows the developer to indent the text without these non-compilable escape characters. We follow instructions below:

  1. Open online tool FreeFormater;
  2. Copy-paste the text on the text field;
  3. Press Unescape JSON: the unescaped text appears on text field below.

Backlog

As a solution

There are similar libraries in different languages for the particular case of data-structure "graph" e.g. networkx: they provide multiple concepts for graph formalization and defition whose current author's knowledge lacks. Hence, it seems reasonable to offer similar features in these directions.

As a package

A glossary with implementation possibilities is available here. This package author is sofar able to obtain the following ideas from it:

  1. data-structures/graph/Graph.js:

Prelude

In case you run it as a service, nodemon may disappear from terminal. You may kill the process by run of command fuser -k 8080/tcp