CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| 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