yawning_titan.networks.network_creator.gnp_random_connected_graph#

yawning_titan.networks.network_creator.gnp_random_connected_graph(n_nodes, probability_of_edge)[source]#

Create a randomly connected graph.

With the guarantee that each node will have at least one connection.

This is taken from the following stack overflow Q&A with a bit of a refactor for clarity.

Parameters:
  • n_nodes – the number of nodes in the graph.

  • probability_of_edge – the probability for a node to have an edge.

Returns:

An instance of Network.