Git Product home page Git Product logo

krapivsky's Introduction

About

This is a fast implementation of the scale-free network model described by Krapivsky, Rodgers, and Redner in Degree Distributions of Growing Networks [fn:1].

The complexity of the simulation is O(n * log n), where n is the number of nodes in the simulated network. 10**6 nodes can be simulated in about 5 seconds on a modern laptop.

Compilation

If using unix/linux/osx, simply type ‘make’ in this directory.

If using windows, download and install cygwin (http://www.cygwin.com), then type ‘make’ in this directory within the cygwin terminal.

After compilation the ‘krapivsky’ binary will be available in this directory.

Usage

Simulation Only

Usage: krapivsky [options] nnodes

nnodes: number of nodes to simulate

options:


  • –p: model parameter p, the probability of taking a node step. (default: p=0.5)
  • –lambda: model parameter lambda, the in-degree fitness of nodes. (default: lambda=0.2)
  • –mu: model parameter mu, the out-degree fitness of nodes. (default: mu=0.2)
  • –nsamples: number of out-degree,in-degree samples to take. (default: nsamples=100)
  • –samplefile: filename for sample out-degree,in-degree output. (default: samplefile=”samples.csv”)
  • –allfile: filename for all out-degree,in-degree pairs. (default: allfile=”allsamples.csv”)
  • –nodefile: filename for nodes. (default: nodefile=”nodes.csv”)
  • –edgefile: filename for edges. (default: edgefile=”edges.csv”
  • –variable-fitness: if this flag is present, sample mu and lambda from a standard lognormal with means defined by the mu and lambda parameters.

Simulation & Analysis

./generate-sample-plot.sh tag p lambda mu target_n_nodes n_samples

Simulate a model with target_n_nodes nodes, then produce diagnostic plots.

  • tag : string identifier for this simulation’s results
  • p : probability of a node-creation step
  • lambda : in-degree probability offset
  • mu : out-degree probability offset
  • target_n_nodes : number of nodes in the simulated network
  • n_samples : number of nodes to sample from the simulated network

Executing this script creates the directory results/tag_p_lambda_mu_target_n_nodes/. Within this directory, one will find

  • command.txt : the ‘krapivsky’ command used to generate these results
  • sample.csv : sampled nodes (format: out-degree,in-degree)
  • all.csv : all nodes (same format as sample.csv)
  • log-ccdf_…_.png : log-log plot of the degree ccdfs with comparisons to predicted values.

Requirements

Simulation Only

A C compiler with the standard libraries.

Simulation & Analysis

A C compiler with the standard libraries.

Python 2.7X with the numpy, matplotlib, and statsmodels libraries.

References

[fn:1] http://arxiv.org/abs/cond-mat/0012181

krapivsky's People

Contributors

jcatw avatar

Stargazers

Bishoy Hanna avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

ryanbergner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.