Splice ./universe directory into ./
Manually merging: - README.md: I added the description from universe/README.md into the heading of dotfiles/README.md. - .envrc: dotfiles/.envrc was a superset of universe/.envrc - .gitignore: Adding some of the ignored patterns from universe/.gitignore to dotfiles/.gitignore Everything else here should be a simple rename.
This commit is contained in:
		
							parent
							
								
									fb9380ba26
								
							
						
					
					
						commit
						5c9079a410
					
				
					 133 changed files with 17 additions and 7979 deletions
				
			
		|  | @ -1,26 +0,0 @@ | |||
| # Doing a practice implementation of Dijkstra's algorithm: a priority-first | ||||
| # search. | ||||
| from heapq import heappush, heappop | ||||
| 
 | ||||
| 
 | ||||
| class Node(object): | ||||
|     def __init__(self, value, children): | ||||
|         self.value = value | ||||
|         self.children = children | ||||
| 
 | ||||
| 
 | ||||
| def shortest_path(a, b): | ||||
|     """Return the shortest path from `a` to `b`.""" | ||||
|     q = [] | ||||
|     seen = set() | ||||
|     heappush((a.value, a, [a]), q) | ||||
| 
 | ||||
|     while q: | ||||
|         d, node, path = heappop(q) | ||||
|         if node == b: | ||||
|             return path | ||||
|         seen.add(node) | ||||
|         for child in node.children: | ||||
|             if child not in seen: | ||||
|                 heappush((d + child.value, child, path + [child]), q) | ||||
|     raise Exception("Path between nodes A and B does not exist.") | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue