CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

CoCalc’s goal is to provide the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual use to large groups and classes.

| Download
Project: MAT 2540
Views: 4
Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu2004
Kernel:

Introduction to Graphs

import networkx as nx import matplotlib.pyplot as plt
g = nx.Graph()
g.add_node(1)
g.add_nodes_from([2,3,4,5])
g.nodes()
NodeView((1, 2, 3, 4, 5))
g.add_edges_from([(1,2),(1,3),(4,1),(4,5)])
g.edges()
EdgeView([(1, 2), (1, 3), (1, 4), (4, 5)])
nx.draw(g,with_labels=True)
Image in a Jupyter notebook