Created
November 26, 2024 15:56
-
-
Save RobertTalbert/7d91acc8a35156d11fc55343eb7d65dd to your computer and use it in GitHub Desktop.
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
# Load libraries | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
# Generate the graph | |
## The second parameter is a probability that two distinct vertices are adjacent | |
## Raise the probability for more connections | |
g = nx.gnp_random_graph(8, 0.5) | |
# Draw the graph | |
nx.draw(g, pos=nx.circular_layout(g), with_labels=True, node_color='lightgray') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment