Skip to content

Instantly share code, notes, and snippets.

View georggrab's full-sized avatar
♥️
trying out this github status thing

Georg Grab georggrab

♥️
trying out this github status thing
View GitHub Profile
@chuanconggao
chuanconggao / prefixspan.py
Last active January 22, 2024 06:00
The original minimal 15 lines implementation of PrefixSpan. Full library at https://github.com/chuanconggao/PrefixSpan-py.
from collections import defaultdict
def frequent_rec(patt, mdb):
results.append((len(mdb), patt))
occurs = defaultdict(list)
for (i, startpos) in mdb:
seq = db[i]
for j in range(startpos + 1, len(seq)):
l = occurs[seq[j]]