Link Search Menu Expand Document

Graphology GRAPHML Utilities

GRAPHML parser & writer for graphology.

For more information about the GRAPHML file format, you can head there.

Installation

npm install graphology-graphml

Usage

Parser

The parser must be passed a graphology constructor and is able to read either a string, or an XMLDocument instance.

var Graph = require('graphology');

// Node
var graphml = require('graphology-graphml');
// Browser
var graphml = require('graphology-graphml/browser');

// Reading a string
var graph = graphml.parse(Graph, string);

// Reading a dom document
var graph = graphml.parse(Graph, xmlDocument);

// Passing options
var graph = graphml.parse(Graph, string, {addMissingNodes: true});

Arguments

  • constructor GraphClass: graphology constructor to use.
  • source string|Document: source data to parse.
  • options ?object: parsing options:
    • addMissingNodes ?boolean false: whether to add missing nodes referenced in the file’s edges.