This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import uniform, shuffle | |
import matplotlib.pyplot as plt | |
import numpy as np | |
L = 500 # number of cells in row | |
num_iters = 500 # number of iterations | |
density = 0.48 # how many positives | |
vmax = 2 | |
p = 0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import snap | |
# requires python 2.7 and 64-bit machine | |
G1 = snap.TUNGraph.New() | |
with open("data/edges.csv") as f: | |
for line in f: | |
tokens = line.split() | |
n1, n2, weight = int(tokens[0]), int(tokens[1]), int(tokens[2]) | |
if not G1.IsNode(n1): | |
G1.AddNode(n1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createField(width, height) { | |
var field = new Uint8Array(width * height); | |
var fcenterX = Math.floor(width / 2); | |
var fcenterY = Math.floor(height / 2); | |
// center occupied | |
field[fcenterX + fcenterY * width] = 1; | |
return { field: field, width:width, height:height}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import uniform | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from random import sample | |
n = 200 # number of cells in row | |
num_iters = 200 # number of iterations | |
density = 0.5 # how many positives | |
# rule 184 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<title>Network | Images</title> | |
<head> | |
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" /> | |
<script src="http://visjs.org/dist/vis.js"></script> | |
<script type="text/javascript"> | |
function draw() { | |
var nodes = [ | |
{id: 1, label: 'SLR1', group: 'source', value: 10}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TLE = | |
(function () { | |
function isCorrupted(line) { | |
var checksum = parseInt(line[line.length-1]); | |
var computedChecksum = line.slice(0,line.length-1) | |
.replace(/[\-\-]/g,"1") | |
.replace(/[a-zA-Z\.+\s]/g,"") | |
.split("") | |
.map(function(digit) { return parseInt(digit) }) | |
.reduce(function(prev, current) {return prev + current;}, 0) % 10; |
NewerOlder