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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ogdfjs

v0.2.0

Published

A JavaScript Graph Drawing Library Emscripts the C++ Library [OGDF](https://ogdf.uos.de/)

Downloads

29

Readme

A JavaScript Graph Drawing Library Emscripts the C++ Library OGDF.

Introduction

The project is forked from Basasuya/ogdf.js. The idea of this project is to compile the C++ library OGDF into a JavaScript library. The former stands both for Open Graph Drawing Framework (the original name) and Open Graph algorithms and Data structures Framework.

We now aim to use emscripten to compile the Layout part of OGDF into ogdf.js.

How to use

  • npm (ogdfjs):

    $ npm install ogdfjs
  • unpkg: ogdf.js

    <script src="https://unpkg.com/ogdfjs"></script>

Layout Supported

Some layout algorithms are supported now:

Energy-based Layout Algorithms
Layer-based Layout Algorithms
Planar and Planarization-based Layout Algorithms
Layout Algorithms for Clustered Graphs
  • ClusterOrtho: Represents a planar orthogonal drawing algorithm for c-planar, c-connected clustered graphs.

Examples can be found in ./examples. We use NetV.js to render the graph.

// layouts can be called like:
const Layout = ogdf.layouts.energebased.fm3
const fm3 = new Layout()
fm3.graph(/* graph data */ { nodes: facebook.nodes, links: facebook.links })
fm3.parameters(/* parameters */ { qualityVersusSpeed: "GorgeousAndEfficient" })
fm3.run().then(graph => {
    // ...
})

// or using import/export
import * as ogdf from 'ogdfjs'

How to build it?

We suggest you to build ogdf.js with Linux or MacOS (we still have no experience with Windows OS to build the ogdf library, for Windows developers, WSL is suggested). Before building the ogdf.js, you should make sure you have enviroments to build C++ library:

  • Git
  • CMake
  • Compiling tools. GCC (Linux), Xcode (MacOS)
  • Python 2.7.x

Building Steps

NOTE*: for Windows users, please use WSL to perform step 1~3.

  1. Download and install Emscripten. Here is several main steps, and please refer to the official document for more details:

    # Get the emsdk repo
    $ cd ..
    $ git clone https://github.com/emscripten-core/emsdk.git
    
    # Enter that directory
    $ cd emsdk
    
    # Fetch the latest version of the emsdk (not needed the first time you clone)
    $ git pull
    
    # Download and install the latest SDK tools.
    $ ./emsdk install latest
    
    # Make the "latest" SDK "active" for the current user. (writes .emscripten file)
    $ ./emsdk activate latest
    
    # Activate PATH and other environment variables in the current terminal
    $ source ./emsdk_env.sh

    To ensure that you have install Emscripten successfully, you can create a folder with a file:

    $ mkdir hello
    $ cd hello
    $ echo '#include <stdio.h>' > hello.c
    $ echo 'int main(int argc, char ** argv) {' >> hello.c
    $ echo 'printf("Hello, world!\n");' >> hello.c
    $ echo '}' >> hello.c
    $ emcc hello.c -s WASM=1 -o hello.html
    $ python -m SimpleHTTPServer 1111 # for python2
    $ python -m http.server 1111 # for python3
    # open your browser, and open http://localhost:1111/hello.html

    Then you can start a localhost server to view the html.

  2. Build ogdf library.

    # cd to ~/packages/ogdf.js
    $ cd ../../ogdf.js
    $ cd packages/ogdf.js/ogdf
    $ mkdir build && cd build
    $ emcmake cmake ..
    $ emmake make

    Everytime you restart your OS, you should run ./emsdk activate latest and source ./emsdk_env.sh in step one the ensure your environment is correct

    For the "this header is only for x86 only" error, please refer to: emscripten-issue-9363

  3. Build rawogdf.js

    # cd to ~/packages/ogdf.js
    $ cd ../..
    $ make rawogdf.js
  4. Build ogdf.js

    # cd to ~/
    $ cd ../..
    $ npm install
    $ npm run bootstrap
    $ npm run build
    # open dashboard
    $ npm run watch:dashboard

Server & Testing

$ npm run test # run all tests
$ npm run server # open a local http server to see examples
$ npm run watch:dashboard # to open the dashboard

Progress

  • add other layout algorithms