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

@ector/concept-network

v1.1.0

Published

Weighted directed graph

Downloads

5

Readme

@ector/concept-network

npm version

Concept Network is weighted directed graph, in which activation values can be propagated, using @ector/state.

Usage

const conceptNetwork = require('@ector/concept-network');

let cn = conceptNetwork.addNode({}, 'node1');
cn = conceptNetwork.addNode(cn, 'node2');

cn = conceptNetwork.addLink(cn, 'node1', 'node2');
// {
//   node: [ { label: 'node1', occ: 1 }, { label: 'node2', occ: 1 } ],
//   link: [ { from: 0, to: 1, coOcc: 1 } ]
// }

Functions

Table of Contents

ConceptNetwork

Type: Object<string, any>

Properties

ConceptNetworkNode

Type: Object<string, any>

Properties

  • label string
  • occ number occurrence of the node
  • beg number? Times at the beginning of a sentence
  • mid number? Times at the middle of a sentence
  • end number? Times at the end of a sentence

ConceptNetworkLink

Type: Object<string, any>

Properties

  • from number incoming node index
  • to number outcoming node index
  • coOcc number co-occurrence of both nodes

getNode

Get the node matching label.

Parameters

Returns (ConceptNetworkNode | undefined)

getNodeIndex

Get the index of the node matching label.

Parameters

Returns number -1 when not found

addNode

Create a node in cn or increment its occurrence.

Parameters

addLink

Create a link between from and to, and increment coOcc by one.

Parameters

Returns ConceptNetwork the new ConceptNetwork

getLink

Get the link from from to to.

Parameters

Returns (ConceptNetworkLink | undefined)

getLinksFrom

Get the links from label node.

Parameters

Returns Array<ConceptNetworkLink>

getLinksTo

Get the links to label node.

Parameters

Returns Array<ConceptNetworkLink>

removeNode

Remove the node which label is given (and the links to it)

Parameters

Returns ConceptNetwork the new ConceptNetwork

nodes

Parameters

Returns Array<ConceptNetworkNode>

removeLinksOfNode

Remove all links of the node which label is given.

Parameters

Returns ConceptNetwork new ConceptNetwork

removeLink

Remove the link from from to to

Parameters

Returns ConceptNetwork the new ConceptNetwork

getLinkIndex

Get the index of the link from from to to.

Parameters

Returns number -1 when not found

getLinkIndex2

Get the index of the link from fromIndex to toIndex.

Parameters

Returns number -1 when not found

decrementNode

Decrement the occ of the node which label is given by one.

Parameters

Returns ConceptNetwork the new ConceptNetwork

decrementLink

Decrement the coOcc of the link from from to to by one.

Parameters

Returns ConceptNetwork new ConceptNetwork

incrementBeginning

Increment the beg of the node which label is given by one.

Parameters

Returns ConceptNetwork the new ConceptNetwork

incrementMiddle

Increment the mid of the node which label is given by one.

Parameters

Returns ConceptNetwork the new ConceptNetwork

incrementEnd

Increment the end of the node which label is given by one.

Parameters

Returns ConceptNetwork the new ConceptNetwork