Files
dsa/main.py
2025-10-02 15:01:42 -05:00

18 lines
297 B
Python

import networkx as nx
def main():
G = nx.Graph()
G.add_node("A")
G.add_node("B")
G.add_node(3)
G.add_edge("A", "B")
G.add_edge("B", 3)
print(G.nodes())
print(G.edges())
print(G.degree())
nx.draw(G, with_labels=True)
if __name__ == "__main__":
main()