Networkx - Directed - Ipynb - Colaboratory
Networkx - Directed - Ipynb - Colaboratory
# NetworkX is a package for the Python programming language that's used to create, manipulate, and study the structure, dynamics, and functions of compl
import networkx as nx
# Matplotlib is a plotting library for the Python
import matplotlib.pyplot as plt
# Draw graph
nx.draw(G, with_labels = True)
plt.show()
plt.savefig("filename.png")
print("List of all nodes from which we can go to node 2 in a single step: ",
list(G.predecessors(2)))