Skip to content

Instantly share code, notes, and snippets.

View andreytim's full-sized avatar

Andrey andreytim

  • London, United Kingdom
  • 18:02 (UTC +01:00)
View GitHub Profile
import java.util.*;
public class LetterCombinations {
private static final Map<Character, String> mapping = new HashMap<>();
static {
mapping.put('2', "abc"); mapping.put('3', "def"); mapping.put('4', "ghi");
mapping.put('5', "jkl"); mapping.put('6', "mno"); mapping.put('7', "pqrs");
mapping.put('8', "tuv"); mapping.put('9', "wxyz");
}
@andreytim
andreytim / mce_BK.py
Last active August 29, 2015 13:57
mce_BK
def mce_BK(R, P, X, g, cliques):
if not P and not X:
cliques.append(R)
for v in degeneracy_ordering(P, g):
mce_BK(R | set([v]), P & g.neighbors(v), X & g.neighbors(v),
g, cliques)
P.remove(v)
X.add(v)
def degeneracy_ordering(P, g):