Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pprint import pprint | |
| from collections import defaultdict | |
| import numpy as np | |
| from typing import List | |
| class Node: | |
| """[ | |
| Object representing a node in the hypercube graph | |
| Has a binary coordinate b and a color c | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| class node: | |
| """ | |
| Node class to model the events as nodes in a graph. | |
| Have parent and child pointers, a node id (unique integer) and a process id | |
| Has a timestamp (ts) attribute which can be set by the BFS | |
| """ | |
| def __init__(self): | |
| self.id = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pprint import pprint | |
| def binarySearch(alist, item): | |
| """ | |
| binary search given alist and item to search for | |
| returns is element was found, otherwise return the last midpoint before search failed | |
| last midpoint is always either the predessecor or succesor to item (if the item is not found) | |
| """ | |
| first = 0 | |
| last = len(alist)-1 |