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

self-reinforcing-paths

v0.0.1

Published

shortest paths that become 'more popular' with repeated use. simulate forest trail formation, infrastructure network growth, plant root growth, mold growth, other analogous phenomena, etc.

Downloads

9

Readme

self-reinforcing-paths

shortest paths that become 'more popular' with repeated use.

allows simulating phenomena analogous to:

  • a trail in a forest that gets wider with more traffic
  • ants leaving pheromones as they travel
  • growth of plants, roots, mold
  • growth of transportation/plumping/electrical networks

Installation

npm i self-reinforcing-paths

Usage

var testMesh = require('bunny');

var serp = require('self-reinforcing-paths');

var srcId = Math.floor(Math.random()*testMesh.positions.length)
var targetId = Math.floor(Math.random()*testMesh.positions.length)

//var opts = {noContrib:false, dfLine:lineLength_withFootsteps, incFunc: incrementPtFootsteps};
var shortestPath = serp.meshShortestPath(testMesh,srcId,targetId) //,opts)
console.log(shortestPath);

//list of vertex indices representing the shortest path
// [
//     1409, 1417, 1407, 1117,
//     1445, 1501, 1104, 1328,
//     137,  806,  634, 1108,
//     874, 1116, 1739, 1734,
//     1089
// ]

//each point along the path has a "footsteps" field that accumulates how many times it has
//been visited by the shortest path algo

//as a point gets more "footsteps" it becomes "wider" [by decreasing the length of connected segments in the graph used by the shortest paths algo]
//therefore making it more likely to get visited in the future

//use opts.noContrib=true to skip the footstep incrementing [get shortest path without "widening" it]

//override opts.lineLength_withFootsteps to specify custom "path-widening" behavior.
//default: 
// function lineLength_withFootsteps(line){ 
//     //line is array of 2 pts
//     return lineLength(line)/((line[0].footsteps||1.0) + (line[1].footsteps||1.0))/2.0;
// }

//override opts.incFunc to change the footstep-paremeter-incrementing behavior 
//default:
// function incrementPtFootsteps(pt, nextPt?){ 
//     //can optionally use nextPt to do logic based on edges etc
//     pt.footsteps=pt.footsteps?pt.footsteps+1:1;
// }

//alternative - using points with .neighbors instead of mesh

//use serp.setOfPtsShortestPath(setOfPts, src, target, opts)
//generate the setOfPts using npm pts-to-graph [see below]

See Also

  • pts-to-graph - convert sets of 3d points into graph structures

stonks