Skip to content

Instantly share code, notes, and snippets.

View abitofalchemy's full-sized avatar

Salvador Aguinaga abitofalchemy

View GitHub Profile
@utahta
utahta / vb.py
Created December 19, 2010 16:55
Variable Byte Code
#!/usr/bin/env python
from struct import pack, unpack
def vb_encode(number):
bytes = []
while True:
bytes.insert(0, number % 128)
if number < 128:
break
number /= 128
@conradlee
conradlee / clique_percolation_networkx.py
Created November 5, 2011 20:37
K-Clique Percolation with Networkx (with docstring, doctest)
import networkx as nx
from collections import defaultdict
from itertools import combinations
def get_percolated_cliques(G, k, cliques=None):
"""
Finds k-percolated cliques in G, e.g,
Unless the cliques argument evaluates to True, this algorithm
first enumerates all cliques in G. These are stored in memory,