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

appleseed-metric

v1.0.1

Published

local trust metric algorithm

Downloads

14

Readme

appleseed-metric

Appleseed is a trust propagation algorithm and trust metric for local group trust computation. It was first described by Cai-Nicolas Ziegler and Georg Lausen in Propagation Models for Trust and Distrust in Social Networks.

Basically, Appleseed makes it possible to take a group of nodes—which have various trust relations to each other—look at the group from the perspective of a single node, and rank each of the other nodes according to how trusted they are from the perspective of the single node.

Appleseed is used by TrustNet, a system for interacting with and managing computational trust.

For more details, see Chapter 6 of the TrustNet report by Alexander Cobleigh. The report contains a full walkthrough of the original algorithm's pseudocode, a legend over all of the variables, and water-based analogy for understanding the otherwise abstract algorithm (and illustrations!) You may also be interested in reading the blog article introducing TrustNet.

Usage

const appleseed = require("appleseed-metric")
const trustAssignments = []
trustAssignments.push({ src: 'a', dst: 'b', weight: 0.80 })
trustAssignments.push({ src: 'a', dst: 'c', weight: 0.80 })
trustAssignments.push({ src: 'b', dst: 'd', weight: 0.80 })
trustAssignments.push({ src: 'x', dst: 'y', weight: 0.80 })
const source = "a"
appleseed(source, trustAssignments, 200, 0.85, 0.01).then((result) => {
    console.log(`converged in ${result.iteration} iterations`)
    console.log(result.rankings) // won't contain x or y, as they are unconnected to a. 
    // b, c, and d will have numerical rankings assigned to them
})

API

const appleseed = require("appleseed-metric")

appleseed (source, trustAssignments, initialEnergy, spreadingFactor, threshold)

Returns a promise. which resolves into a object of id -> rank mappings. The promise is resolved when the algorithm has converged, and all the trust ranks have been determined, as seen from the connected graph emanating outwards from source.

Returns `{ rankings, graph, iterations }

  • rankings Object mapping an identifier from a src or dst field in trustAssignments to its found trust ranking, which is a float.
  • graph The trust graph, discovered by traversing trustAssignments from the starting point source
  • iterations The number of iterations required before convergence. Normally around 50-70 iterations.

Parameters

  • source The trust source whose trust graph we are traversing to determine trust ranks.
  • trustAssignments A list of trust assignments of form [{ src, dst, weight}, ..]. src and dst are strings, while weight is a float defined in the range 0.0 - 1.0.
  • initialEnergy The amount of energy the Appleseed distributes across the trust graph's discovered nodes. Ziegler & Lausen's recommended default is 200.
  • spreadingCoefficient Determines the amount of energy each node passes on to nodes it trusts (and correspondingly the amount of energy it gets to keep it self. Defined in the range 0.0 to 1.0. Recommended default is 0.85
  • threshold Iteration has stopped, and convergence is reached, when threshold exceeds the largest change in energy in the past iteration.

License

appleseed-metric is available for dual-licensing. All the code in this repository is licensed as AGPL3.0-or-later. If AGPL3 does not work for you, or your organization, contact cblgh-at-cblgh dotte org to purchase a more permissive usage license.

If your project is a not-for-profit project, the permissive license will likely be available at very low-cost :)