npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

perfect-graph-1.0

v1.0.0

Published

Fork of the original perfect-graph with new changes.

Readme

PerfectGraph

Motivation

We want to build a collaborative Knowledge Graph Editor. To achive that goal we need a Graph Visualizer on a web browser and it needs to have a declarative rendering. Because in imperative style we need to call appropriate api functions respect to the data changes like addNode, deleteNode etc. But we just want to change JSON data (node and edge information) and render elements respectively to the changes.

First, install Nodejs and Yarn to your working environment. Then

yarn global add expo-cli

Then,

expo init my-project
cd my-project
yarn add perfect-graph colay colay-ui immer

After you can write this command to the terminal in your project directory

yarn web

So let's start coding

import {Graph} from 'perfect-graph'

export default function MyGraph() {
  return (
    <Graph
      style={{width: 600, height: 400}}
      nodes={[
        {id: '1', position: {x: 10, y: 10}},
        {id: '2', position: {x: 300, y: 100}}
      ]}
      edges={[{id: '51', source: '1', target: '2'}]}
    />
  )
}

To use GraphEditor you need to install material-ui packages. We use the latest version:

yarn add @mui/icons-material @mui/material @mui/styles @emotion/react @emotion/styled react-beautiful-dnd @rjsf/core @rjsf/material-ui react-color

To support material-ui v5 with @rjsf/material-ui, we need to add some special configuration until they have fully support for v5. Also add some packages.

yarn add @expo/webpack-config babel-plugin-module-resolver -D
// webpack.config.js
const createExpoWebpackConfigAsync = require('@expo/webpack-config')

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: ['@rjsf/material-ui']
      }
    },
    argv
  )
  return config
}
// babel.config.js
module.exports = function (api) {
  api.cache(true)
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      [
        'module-resolver',
        {
          extensions: ['.js', '.jsx', '.es', '.es6', '.mjs', '.ts', '.tsx'],
          alias: {
            '@material-ui/core': '@mui/material',
            '@material-ui/icons': '@mui/icons-material',
            '@material-ui/styles': '@mui/styles'
          }
        }
      ]
    ]
  }
}
import {GraphEditor} from 'perfect-graph/components/GraphEditor'
import {useController} from 'perfect-graph/plugins/controller'

export default function MyGraphEditor() {
  const [controllerProps] = useController({
    nodes: [
      {id: '1', position: {x: 10, y: 10}},
      {id: '2', position: {x: 300, y: 100}}
    ],
    edges: [{id: '51', source: '1', target: '2'}]
  })

  return <GraphEditor style={{width: 600, height: 400}} {...controllerProps} />
}

Start development server again:

yarn web

To have json editor:

yarn add brace jsoneditor jsoneditor-react
import {GraphEditor} from 'perfect-graph/components/GraphEditor'
import {useController} from 'perfect-graph/plugins/controller'

export default function MyGraphEditor() {
  const [controllerProps] = useController({
    nodes: [
      {id: '1', position: {x: 10, y: 10}},
      {id: '2', position: {x: 300, y: 100}}
    ],
    edges: [{id: '51', source: '1', target: '2'}],
    dataBar: {
      editable: true
    }
  })

  return <GraphEditor style={{width: 600, height: 400}} {...controllerProps} />
}

To use rdf based operation please install the required dependencies:

yarn add jsonld jsonld-context-parser n3 rdf-literal rdflib

To use layouts, please install the required dependencies:

yarn add cytoscape-avsdf cytoscape-cise cytoscape-cola cytoscape-d3-force cytoscape-dagre cytoscape-euler cytoscape-fcose cytoscape-klay cytoscape-spread

If the PIXI.js renderer takes a lot time to render all elements and blocks the UI then consider on:

  • Decreasing the view resolution and settings quality In example when a huge data chunk imported to perfect-graph, if the view quality is very high ; then PIXI.js will block (to render the elements with high view quality) the UI thread and cause strange issues. Set low view quality settings before importing the data chunk and let Adaptive Performance Optimizer do the rest of the optimization.

  • If there is an error: Can not set readonly 'x' of '#Object' That could be related with position ; If you use cy.$(id).position() in somewhere and store it that can cause an issue. Use cy.$(id).position().x , cy.$(id).position().y

Furthermore please refer to the Components Section.