1.6.2 • Published 3 years ago

graph-format-converter v1.6.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

graph-format-converter

Typescript library used to convert a graph format to another

Installation

You can install Graph Format Converter using npm:

npm install graph-format-converter --save

Usage

To import Graph Format Converter you can do it like so

import {GraphFormatConverter} from "graph-format-converter";

Or

const {GraphFormatConverter} = require("graph-format-converter");

And then you can use it this way

const graphAsJson = {
    nodes: [...],
    edges: [...]
}

// Create the graph instance from a JSON graph
const jsonInstance = GraphFormatConverter.fromJson(graphAsJson);

// Get the graph as JSON
jsonInstance.toJson();

// Get the graph as GEXF
jsonInstance.toGexf();

// Get the graph as GRAPHML
jsonInstance.toGraphml();

// And you can create a graph instance from a (valid) 
// - Gexf string (to see the file format => https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf)
// - Graphml string (to see the file format => http://graphml.graphdrawing.org/primer/graphml-primer.html#Graph)

// - Graphology as JSON exported graph (https://graphology.github.io/serialization.html#export)

const gexfInstance = GraphFormatConverter.fromGexf(graphAsGexfString);

// Or

const graphmlInstance = GraphFormatConverter.fromGraphml(graphAsGraphmlString);

// Or 

const graphologyInstance = GraphFormatConverter.fromGraphology(graphAsJSONExportedFromGraphology);

"Test"

To test that the graphs are working well you can run the following command after building the sources

npm test

You will have the folder data/output populated with graphs files, try to open them with Gephi to see if everything works !

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago