Instantly share code, notes, and snippets.

🏠
Working from home

# Keisuke OTAKIcocomoff

🏠
Working from home
• Sort options
Created Jul 17, 2019
dot-png generator
View run.sh
 #!/bin/zsh for l in `ls output/*.dot`; do fname=\${l:r}.png; dot -Tpng \$l > \$fname; done;
Created Jul 8, 2019
example_tdzdd.cpp
View example_tdzdd.cpp
 #include #include #include #include using namespace std; const bool DEBUG_ENUM = false; class Combination : public tdzdd::DdSpec {
Created Jul 8, 2019
example_tdzdd_01knapsack.cpp
View example_tdzdd_01knapsack.cpp
 #include #include #include #include using namespace std; class KnapsackZdd : public tdzdd::DdSpec { int const n; int const *w;
Created Jul 4, 2019
multidag_longest_path.py
View multidag_longest_path.py
 # -*- coding: utf-8 -*- import networkx as nx import networkx.algorithms as nxa def longest_path_for_multidigraph(G, weight='weight', default_weight=1): dist = {} for v in nx.topological_sort(G): us = [] for u, data in G.pred[v].items():
Created Jul 4, 2019
example_bdd_constraint_var18.cpp
View example_bdd_constraint_var18.cpp
 #include #include #include #include "cuddObj.hh" using namespace std; int main() { Cudd mgr;
Last active Jul 4, 2019
example_bdd_constraint.cpp
View example_bdd_constraint.cpp
 #include #include #include #include "cuddObj.hh" using namespace std; int main() { Cudd mgr;
Created Jul 3, 2019
wavelet tree of integer values
View example_wt.cpp
 #include #include using namespace std; using namespace sdsl; int main() { wt_int> wt; // auto iv = int_vector<>({0, 7, 2, 1, 4, 3, 6, 7, 2, 5, 0, 4, 7, 2, 6, 3}); auto iv = int_vector<>({0, 2, 1, 3, 2, 0, 2, 3});
Created Jun 30, 2019
bit vector example
View example_bs.cpp
 /* g++ -std=c++14 -o main main.cpp -I/home/cocomoff/sdsl-lite/build/include -L/home/cocomoff/sdsl-lite/build/lib -lsdsl -ldivsufsort -ldivsufsort64 */ #include #include #include #include #include
Created Jun 19, 2019

View several_coding_examples.py
 # -*- coding: utf-8 -*- def unary(x): return "0" * (x - 1) + "1" def binary(x): return bin(x)[2:] def gamma(x): bx = binary(x)
Created Jun 16, 2019
BWT (figure 3.1)
View simple_BWT.py
 # -*- coding: utf-8 -*- if __name__ == '__main__': T = "abracadabra\$" lT = len(T) print("Input:", T) sa = [T[i:] for i in range(lT)] isa = list(zip(range(lT), sa)) sorted_isa = sorted(isa, key=lambda x: x[1])
You can’t perform that action at this time.