This commit is contained in:
2025-10-02 15:02:53 -05:00
parent d7fd296035
commit 156e52cc42

View File

@@ -1,17 +1,20 @@
import networkx as nx
import matplotlib.pyplot as plt
def main():
G = nx.Graph()
# Tree
G = nx.DiGraph()
G.add_node("A")
G.add_node("B")
G.add_node(3)
G.add_node("C")
G.add_edge("A", "B")
G.add_edge("B", 3)
G.add_edge("B", "C")
print(G.nodes())
print(G.edges())
print(G.degree())
nx.draw(G, with_labels=True)
plt.show()
if __name__ == "__main__":
main()