randomgraph

0.1.3 • Public • Published

randomgraph.js

A small library for generating, well, random graphs. Not that many models at the moment, feel free to jump in and add some more. The algorithms were partly ported and double-checked with the Gephi implementations (thx @jacomyal for the link).

preview

/* Erdős–Rényi (n, p)
 *
 * n .. number of nodes
 * p .. edge probability
 */
graph = randomgraph.ErdosRenyi.np(150, 0.05);
 
/* Watts-Strogatz (n, K, beta)
 *
 * n .. number of nodes
 * K .. mean degree (even integer)
 * beta .. rewiring probability [0..1]
 */
graph = randomgraph.WS(150, 4, 0.4);
 
/* Barabási–Albert (N, m0, M)
 *
 * N .. number of nodes
 * m0 .. size of connected core (m0 <= N)
 * M .. (M <= m0)
 */
graph = randomgraph.BA(150, 10, 2);
 

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i randomgraph

      Weekly Downloads

      3

      Version

      0.1.3

      License

      Public Domain

      Last publish

      Collaborators

      • gka