Suppose there is a weighted directed graph, possibly with cycles
import neteorkx as nx G = nx.DiGraph() G.add_weighted_edg