Skip to content
file-graph / 0.12.0

file-graph 0.12.0

Install from the command line:
Learn more about npm packages
$ npm install @diy0r/file-graph@0.12.0
Install via package.json:
"@diy0r/file-graph": "0.12.0"

About this version

File-Graph

version npm downloads jsDocs.io license Testing CI

file-graph is a library for working with graphs using a file-based storage system. It provides functionality for creating, updating, deleting, and searching for graph vertices and edges, as well as for performing traversal and pathfinding operations within the graph.


Installation

npm install file-graph

Alternatively, you can install it from the GitHub registry:

npm install @diy0r/file-graph

Creating a Graph Instance

const graph = FileGraph('../graph.txt');

FileGraph accepts a path where the graph data will be stored. The graph object returned is an instance of the FileGraphAbstract class, which provides methods for manipulating the graph. You can refer to the jsDoc documentation for more details.

File Structure

After initializing the graph at the specified path, a file will be created where each line represents a vertex. It is recommended not to modify the file contents manually.

Example of a vertex record:

{
  "id": "33ef29be-adaa-4509-b306-62a32db7310e", // UUID - unique identifier of the vertex
  "data": { ... }, // The data associated with the vertex
  "links": [] // List of UUIDs of vertices that this vertex is connected to
}

Public API - Asynchronous Methods

Creating a Vertex

const data = { name: 'Diyor', city: 'New-York' };
const createdVertex = await graph.createVertex<typeof data>(data);

This method returns an instance of the created vertex.

Details


Assets

  • file-graph-0.12.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0