This file contains hidden or 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 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, |
This file contains hidden or 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/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 |