Skip to content

Commit

Permalink
Merge branch 'networkx:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dtekinoglu authored Mar 30, 2022
2 parents 8f78164 + af082ad commit 6a343b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions 2022-round-1/FAIZ113/nx_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.1
1 change: 1 addition & 0 deletions 2022-round-1/deepthi1107/nx_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.1
17 changes: 17 additions & 0 deletions 2022-round-1/parikshit14/nx_tutorial_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import networkx as nx
import matplotlib.pyplot as plt

# creating DiGraph object
DG = nx.DiGraph()
DG.add_edges_from([(1, 2), (2, 3)]) # adding node 1,2,3 and connecting them 1->2->3
DG.add_edge("hello", "world") # adding node and connecting them "hello" -> "world"
DG.add_edge("world", (5, 6)) # adding node (5,6) and connecting them "world" -> (5,6)
DG.add_edge(1, (5, 6)) # adding edge 1 -> (5,6)
DG.add_edge(1, "world") # adding edge 1 -> "world"

# Drawing the DiGraph
nx.draw(DG, with_labels=True)

# Calculating the shortest path and printing it
sp = nx.shortest_path(DG)
print(sp)

0 comments on commit 6a343b1

Please sign in to comment.