Skip to content

Commit 3b82114

Browse files
committed
Correct two type-checking errors.
1 parent 371c086 commit 3b82114

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Approximate Shortest Superstring Generator
22

3-
_WARNING: While this note persist, I may force-push to master_
4-
5-
A Python library and tool for generating approximate [shortest common superstrings](https://en.wikipedia.org/wiki/Shortest_common_supersequence#Shortest_common_superstring).
3+
A Python tool for generating approximate [shortest common superstrings](https://en.wikipedia.org/wiki/Shortest_common_supersequence#Shortest_common_superstring).
64

75
All code is provided under the [MIT License](LICENSE).
86

@@ -142,7 +140,7 @@ case it's 'brutedp'. If you specify an invalid name here, you should get a list
142140
`make_substring_free(list) -> list`
143141
: For Greedy to work as originally specified, its input must be _substring-free_ (aka _factor-free_), i.e contain no elements that are substrings of one another. This function will process a list to ensure this pre-condition is true.
144142

145-
See the [ssp.py source code](ssp.py) for details.
143+
See the [ssp.py source code](ssp.py) for details and references.
146144

147145
### Example API Usage
148146

@@ -157,7 +155,6 @@ res = ssp.generate_superstring(arr)
157155

158156
## TODO
159157

160-
* Verify that the type-spec in ssp.py is actually correct.
161158
* Implement encoding into bitstrings.
162159
* Built-in benchmark.
163160

ssp.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ def overlap(a, b):
169169
return len(a) - start
170170
start += 1
171171

172-
shortest = None
172+
shortest = ""
173173
for perm in permutations(arr):
174174
sup = perm[0]
175175
for i in range(len(arr) - 1):
176176
olen = overlap(perm[i], perm[i+1])
177177
sup += perm[i+1][olen:]
178-
if shortest is None or len(sup) < len(shortest):
178+
if shortest == "" or len(sup) < len(shortest):
179179
shortest = sup
180180
return shortest
181181

@@ -258,6 +258,7 @@ def brutedijkstra(arr: list[str]) -> str:
258258
if not updated:
259259
return candidate
260260
del paths[min_len]
261+
return ""
261262

262263
def generate_superstring(strings: list[str], func=greedy) -> str:
263264
"""

0 commit comments

Comments
 (0)