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> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
</head> | |
<body> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.6.0"></script> | |
<script type="text/javascript"> | |
var svg = d3.select("body").append("svg") |
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
def solve_tsp_dynamic(points): | |
#calc all lengths | |
all_distances = [[length(x,y) for y in points] for x in points] | |
#initial value - just distance from 0 to every other point + keep the track of edges | |
A = {(frozenset([0, idx+1]), idx+1): (dist, [0,idx+1]) for idx,dist in enumerate(all_distances[0][1:])} | |
cnt = len(points) | |
for m in range(2, cnt): | |
B = {} | |
for S in [frozenset(C) | {0} for C in itertools.combinations(range(1, cnt), m)]: | |
for j in S - {0}: |
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
#!/usr/bin/python -tt | |
# MIT licensed by Abraham Williams - http://abrah.am | |
# Pulls your Facebook friends likes and interest and finds who you have the most in common with. | |
import urllib, json, sys | |
graph_url = 'https://graph.facebook.com/' | |
def print_intersect_count(access_token): | |
tally = {} |