npm's personal messenger
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    randomgraphpublic

    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);
     

    Keywords

    none

    install

    npm i randomgraph

    Downloadsweekly downloads

    7

    version

    0.1.3

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar