Assignment 2

Consider a device that securely stores a graph (with directed edges, labeled by strings) what works as follows. When you plug it in into the USB we can send a 32-byte node_id and a string (at most 32 bytes). The device displays the node info and lets the user confirm the action, the the user confirms the action by pressing a button. Then the device sends back to the computer the node_id's of all vertices connected to this vertex by an edge whose label matches the string from the input.

1. Write an emulator to the device (GraphDeviceEmulator).
2. Write a simple app (GraphDeviceApp) to handle the device. Do it is such a way that the code could be used both with real device and with the emulator (that is, inject transport layer).
3. Write a three simple emulator integration tests. First test succesfully traverses a path on three edges in the graph. In the second test the user rejects the request. In third test, the program will query incorrect node-id.

To perform this task, use asynchronous programming (allowed languages - Python, Javascript, C++, if you want to use something other, discuss). Emulator should run in a separate process, is up to you how you want to communicate with it. The tools the emulator support should mimic those of the theoretical real world device (a.g. no additional synchronization, you may even need to sleep in the tests due to this). Also, consider adding fake work to the emulator.

Send your solution to lukotka.pts@gmail.com. The deadline is 02.12.2021 23:59:59. The solutions sent later will be accepted, however the number of points awarded may be reduced.