Skip to content

Commit 969ac83

Browse files
committed
started pythons script for notebook generation
1 parent 0a6466d commit 969ac83

12 files changed

+57
-0
lines changed

filter.cc renamed to OLD/filter.cc

File renamed without changes.
File renamed without changes.

OLD/joined-2pages.pdf

342 KB
Binary file not shown.

OLD/joined.pdf

764 KB
Binary file not shown.
File renamed without changes.

OLD/page_numbers.docx

20.7 KB
Binary file not shown.

OLD/page_numbers.pdf

118 KB
Binary file not shown.

contents.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,45 @@
1+
# Any line followed by a '#' character is ignored
2+
# Section headings must be in square brackets
3+
# Subsections within a section should follow the format:
4+
# [filename within code directory][tab character \t][subsection title]
5+
16
[Combinatorial optimization]
7+
#MaxFlow.cc Dense max-flow
28
Dinic.cc Sparse max-flow
39
MinCostMaxFlow.cc Min-cost max-flow
410
PushRelabel.cc Push-relabel max-flow
511
MinCostMatching.cc Min-cost matching
612
MaxBipartiteMatching.cc Max bipartite matchine
713
MinCut.cc Global min-cut
814
GraphCutInference.cc Graph cut inference
15+
#MaxFlow.java Max-flow (Java)
16+
#MinCostMaxFlow.java Min-cost max-flow (Java)
917

1018
[Geometry]
1119
ConvexHull.cc Convex hull
1220
Geometry.cc Miscellaneous geometry
1321
JavaGeometry.java Java geometry
1422
Geom3D.java 3D geometry
1523
Delaunay.cc Slow Delaunay triangulation
24+
#Delaunay.java Slow Delaunay triangulation (Java)
25+
1626
[Numerical algorithms]
1727
Euclid.cc Number theory (modular, Chinese remainder, linear Diophantine)
1828
GaussJordan.cc Systems of linear equations, matrix inverse, determinant
1929
ReducedRowEchelonForm.cc Reduced row echelon form, matrix rank
2030
FFT_new.cc Fast Fourier transform
2131
Simplex.cc Simplex algorithm
32+
#FFT.cc Fast Fourier transform (C++)
2233

2334
[Graph algorithms]
35+
#BellmanFord.cc Bellman-Ford shortest paths with negative edge weights (C++)
36+
#DijkstraFloyd.cc Dijkstra and Floyd's algorithm (C++)
2437
FastDijkstra.cc Fast Dijkstra's algorithm
2538
SCC.cc Strongly connected components
2639
EulerianPath.cc Eulerian path
40+
#Kruskal.cc Kruskal's algorithm
41+
#Prim.cc Minimum spanning trees
42+
2743
[Data structures]
2844
SuffixArray.cc Suffix array
2945
BIT.cc Binary Indexed Tree
@@ -42,3 +58,11 @@ IO.cc C++ input/output
4258
KMP.cc Knuth-Morris-Pratt
4359
LatLong.cc Latitude/longitude
4460
EmacsSettings.txt Emacs settings
61+
#TopologicalSort.cc Topological sort (C++)
62+
#Dates.java Dates (Java)
63+
#DecFormat.java Decimal output formatting (Java)
64+
#RandomSTL.cc Random STL stuff
65+
#CSP.cc Constraint satisfaction problems
66+
#FastExpo.cc Fast exponentiation
67+
#LCS.cc Longest common subsequence
68+
#MillerRabin.c Miller-Rabin Primality Test (C)

generate_notebook.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/python
2+
3+
import subprocess
4+
5+
if __name__ == "__main__":
6+
section_name = None
7+
sections = []
8+
code_dir = 'code'
9+
with open('contents.txt', 'r') as f:
10+
for line in f:
11+
if '#' in line: line = line[:line.find('#')]
12+
line = line.strip()
13+
if len(line) == 0: continue
14+
if line[0] == '[':
15+
if section_name is not None:
16+
sections.append((section_name, subsections))
17+
section_name = line[1:-1]
18+
subsections = []
19+
else:
20+
tmp = line.split('\t', 1)
21+
if len(tmp) == 1:
22+
raise ValueError('Subsection parse error: %s' % line)
23+
filename = tmp[0]
24+
subsection_name = tmp[1]
25+
if subsection_name is None:
26+
raise ValueError('Subsection given without section')
27+
subsections.append((filename, subsection_name))
28+
29+
html = ''
30+
for (section_name, subsections) in sections:
31+
enscript_options = ["enscript", "-E", "--color", "--language=html", "-o -"]
32+
filenames = [code_dir + '/' + filename for (filename, _) in subsections]
33+
section_html = subprocess.check_output(enscript_options + filenames)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)