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

@polygraph/data-graph

v0.0.7

Published

The DataGraph structure an associated functions.

Downloads

2

Readme

Data Graph

This library provides some data structures for representing graphs in various useful forms and converting among them. Additionally, it includes an interface for converting commonly understood resource operations into technical graph operations. These graph operations should be easier to implement in adapters. Additionally, they are easier to compose when merge conflicts arise.

I will likely separate the interface to operations part into its own library.

Nothing in here is aware of schemata. As such, edges in graphs will be represented as one way. It is up to adapter authors to ensure proper inverse connections.

Graph Abstractions

Base

This is the native polygraph format. All relationships link to fully resolved resources. This makes it the easiest data structure to crawl, but also the most cumbersome on memory.

Additionally, the base abstraction must be capable of converting to any other format. Likewise, other formats must be able to convert to the base format. This allows any format to be converted into any other, even at the expense of two conversions.

I would like to handle this via some registration process. Such a process would create a base graph factory with pairs of classes and functions to tranform base graphs into the corresponding class.

Operations Interface

Takes resource operations and transforms them into graph operations.

Resource Operation Lexicon

  • Resource: Something with an id, type, attributes, and relationships represented by other Resources.
  • Resource Reference: An id and type that points to a Resource.
  • Normalized Resource: An id, type, attributes, and relationships represented by Resource References.

Additionally anything with Like appended to it, e.g., ResourceLike means an object that conforms to the underlying type, but can contain extra properties.

Resource Operations

  • Create
  • Update
  • Delete
  • Append Relationships
  • Replace Relationship
  • Replace Relationships
  • Delete Relationship
  • Delete Relationships
  • Query*
  • Merge**

* Does not have a corresponding Graph Operation (should it?) ** Requires a read operation

Graph Operation Lexicon

  • Vertex: A vertex within a graph composed of an id, type, and attributes.
  • Edge: An edge connecting two vertices composed of a starting vertex, an ending vertex, and a type.

Graph operations must be precise, so there are no types such as VertexLike.

Graph Operations

  • Add Vertex
  • Update Vertex
  • Remove Vertex
  • Add Edge
  • Remove Edge
  • Remove Edges of Type

Comments

Care should be taken to use the terms precisely. There's a great deal of overlapping concepts, but the separation of the resource-oriented terminology a user of an adapter will encounter lacks some of the desirable qualities that the more technical graph operations convey. This will hopefully accomplish two goals:

  1. Ease of creating adapters. More precise graph operations should be more straightforward to implement.
  2. Creation of alternative interfaces. Anything that can create graph operations can be part of an adapter.

TODO

  • Create a deterministic method of merging sets of operations. Too easy, I know. ;)