Skip to content

Commit

Permalink
Updated README file for new features.
Browse files Browse the repository at this point in the history
  • Loading branch information
wfunkenbusch committed Nov 9, 2018
1 parent 2dceba0 commit 0d731f6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
42 changes: 35 additions & 7 deletions README.md
Expand Up @@ -17,11 +17,23 @@ where $e$ is an edge, $w_e$ is the weight of an edge (the distance between the t
Implementation:
* Run using Javascript, node.js (v8 or above)
* Needs the following modules installed: jsnetworkx, lodash-clonedeep, command-line-args, mocha (for testing), assert (for testing), istanbul (for coverage), and coveralls mocha-lcov-reporter (for coverage)
* Run: npm install wfunkenbusch-markov-chain-monte-carlo
* Create a .js file which calls the main function and sets inputs
* Run: node *file name*.js

Ex. .js file
1. npm install wfunkenbusch-markov-chain-monte-carlo
2. Create a .js file which calls the main function and sets inputs
3. node *file name*.js

Alternatively,

1. git clone https://github.com/wfunkenbusch/Markov-Chain-Monte-Carlo
2. Enter repository
3. node ./lib/index.js/ --nodes *nodes* --T *T* --r *r* --N *N*

To run unit tests:

1. Enter repository
2. npm test

Example .js file:

const mcmc = require('wfunkenbusch-markov-chain-monte-carlo')
var options = {};
Expand Down Expand Up @@ -52,8 +64,24 @@ Outputs:

All outputs are printed to the console.

* Current iteration number, for keeping track of code progress.
* Each adjacency matrix, in order of appearance, followed by the number of times it appeared.
* Current iteration number, for keeping track of code progress. To suppress, comment out console.log(i + 1) in main(). To reduce the number of outputs, console.log(i + 1) may be replaced with:

if ((i + 1) % n === 0) {
console.log(i + 1)
}

where n is the fraction of outputs to print.

* The top 1% of adjacency matrices, followed by the number of times they appeared. Prioritizes graphs which appeared earlier. To change the percentage of top graphs printed, replace the line

var nBestGraphs = Math.floor(Fun.AList.length / 100 + 1);

with

var nBestGraphs = Math.floor(Fun.AList.length * (*fraction to print*) + 1);

* The expected number of edges connected to the source node.
* The expected number of edges in the graph.
* The expected value of the maximum shortest path from the source node to all other nodes.
* The expected value of the maximum shortest path from the source node to all other nodes.

Note: the total number of adjacency matrices is N + 1.
7 changes: 2 additions & 5 deletions lib/index.js
Expand Up @@ -577,9 +577,6 @@ function main(options) {
Fun.generate();
Fun.storeA(Fun.G);

// Prints current iteration
console.log(1);

// Finds longest shortest path length from source node to a node
var maxPathLength = 0;

Expand All @@ -597,13 +594,13 @@ function main(options) {
var totalMaxPathLength = maxPathLength;

// Metropolis-Hastings algorithm, storing A at each iteration
for (var i = 0; i < N - 1; i++) {
for (var i = 0; i < N; i++) {
Fun.iterate();
Fun.acceptOrReject(Fun.G, Fun.H, T, r);
Fun.storeA(Fun.G);

// Prints current iteration
console.log(i + 2);
console.log(i + 1);

// Overwrites current longest path if path length for tested node is larger
maxPathLength = 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "wfunkenbusch-markov-chain-monte-carlo",
"version": "0.0.1",
"version": "0.0.2",
"description": "Markov Chain Monte-Carlo",
"homepage": "",
"author": {
Expand Down

0 comments on commit 0d731f6

Please sign in to comment.