Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code for Guided Practice 7, MTH 325
# Import networkx
import networkx as nx
# Import two functions from the "random" library:
# randint(a,b) generates a random integer between a and b
# random() generates a random floating point number between 0 and 1
from random import random, randint
# Generates 5 random graphs with random numbers of nodes and
# connection probabilities, and prints off their dictionaries.
for i in range(5):
n = randint(2, 10)
p = random()
g = nx.random_graphs.gnp_random_graph(n,p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.