NetworkX

Previous topic

networkx.generators.ego.ego_graph

Next topic

Linear algebra

networkx.generators.stochastic.stochastic_graph

stochastic_graph(G, copy=True)

Return a right-stochastic representation of G.

A right-stochastic graph is a weighted graph in which all of the node (out) neighbors edge weights sum to 1.

Parameters:

G : graph

A NetworkX graph, must have valid edge weights

copy : boolean, optional

If True make a copy of the graph, otherwise modify original graph