GithubHelp home page GithubHelp logo

pgrk's Introduction

README

Simple command line PageRank calculator.

The input file represents a directed graph as adjacency list, where each node must be identified by an integer (translation from and to your domain must happen elsewhere).

Installation

$ go get github.com/miku/pgrk/cmd/{pgrk,pgrk-gen,pgrk-dot}

Example

Shiny graph

Example input file:

$ cat example.in
0   1
1   2
2   3   4   5
4   2
5   1

Usage:

$ pgrk example.in 2> /dev/null | sort -k2,2 -nr
2   0.33477170103317816
1   0.20154082325712538
5   0.13963495553328562
4   0.13963495553328562
3   0.13963495553328562
0   0.0447826091098397

Options:

$ pgrk
Usage: pgrk [OPTIONS] FILE
File format: TSV (NODE OUTBOUND [OUTBOUND, ...])
  -c=0.0001: convergence criteron
  -w=0.85: walk probability

Benchmark

  • Computing the pagerank of an 10,004,750 node sparse graph takes about 30s (tested on i5-3470, 4 core, 3.2GHz machine, 16G RAM).
  • {"p": 0.8, "nodes": 30000000, "edges": 46735510}: 1m55.010s
  • {"p": 0.8, "nodes": 50000000, "edges": 77879276}: 3m6.173s
  • {"p": 0.99, "nodes": 50000000, "edges": 268891019}: 4m10.350s

Utils

Generate and visualize random directed graphs, with pgrk-gen and pgrk-dot:

$ pgrk-gen -n 30 -p 0.75 > test.in
$ cat test.in | pgrk-dot | dot -Tpdf -o test.pdf && open test.pdf
$ pgrk test.in 2> /dev/null | sort -nrk2,2 | head -5
20  0.10566870915778451
18  0.10238092345567337
6   0.10012509291487659
28  0.06610747553255986
16  0.06485242652853762

Another Shiny graph

Credits

pgrk's People

Contributors

juliend2 avatar miku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

juliend2

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.