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
# Get the absolute path of the directory containing main.py | |
script_dir = os.path.dirname(os.path.abspath(__file__)) | |
# Change the current working directory to script_dir | |
os.chdir(script_dir) | |
print("Current Working Directory:", os.getcwd()) |
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
def recursivelyMark(nodeID, nodes): | |
(connections, visited) = nodes[nodeID] | |
if visited: | |
return | |
nodes[nodeID][1] = True | |
for connectedNodeID in connections: | |
recursivelyMark(connectedNodeID, nodes) | |
def main(): | |
nodes = [[[1], False], [[0], False], [[3], False], [[2], False], [[], False], [[], False]] |