test
This commit is contained in:
9
main.py
9
main.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user