How to use the graphology.Graph function in graphology

To help you get started, we’ve selected a few graphology examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medialab / website / wilson / database.js View on Github external
constructor(store, options) {
    options = options || {};

    const pathPrefix = options.pathPrefix || '';
    const skipDrafts = options.skipDrafts || false;

    const draftIds = new Set();

    this.store = store;
    this.graph = new Graph();

    // Hydrating graph & filtering drafts
    models.forEach(model => {
      store[model] = store[model].filter(item => {
        if (skipDrafts && item.draft) {
          draftIds.add(item.id);
          return false;
        }

        // Tagging model
        item.model = model;

        this.graph.addNode(item.id);
        return true;
      });
    });

graphology

A robust and multipurpose Graph object for JavaScript.

MIT
Latest version published 10 months ago

Package Health Score

73 / 100
Full package analysis