My knowledge about the random.sample algorithm in the following code below is not the best but try increasing the frequency of the rate to connect the nodes or to create a new algorithm where each node has a 25%-50% chance of connecting with every other node.
https://github.com/angdav/cs435-p2/blob/7773ebbbc02f04d5968b58217efb4db4635591ad/p123.py#L108-L115
This method is not wrong and the search algorithms work but the chances for a dfs algorithm to get to the source is around half for creating a randomized graph of size 100 when running in a for loop of 10 iterations.
My knowledge about the random.sample algorithm in the following code below is not the best but try increasing the frequency of the rate to connect the nodes or to create a new algorithm where each node has a 25%-50% chance of connecting with every other node. https://github.com/angdav/cs435-p2/blob/7773ebbbc02f04d5968b58217efb4db4635591ad/p123.py#L108-L115 This method is not wrong and the search algorithms work but the chances for a dfs algorithm to get to the source is around half for creating a randomized graph of size 100 when running in a for loop of 10 iterations.