stochastic_graph(G, copy=True, weight='weight')
A right-stochastic graph is a weighted digraph in which for each node, the sum of the weights of all the out-edges of that node is 1. If the graph is already weighted (for example, via a 'weight' edge attribute), the reweighting takes that into account.
A ~networkx.DiGraph
or ~networkx.MultiDiGraph
.
If this is True, then this function returns a new graph with the stochastic reweighting. Otherwise, the original graph is modified in-place (and also returned, for convenience).
Edge attribute key used for reading the existing weight and setting the new weight. If no attribute with this key is found for an edge, then the edge weight is assumed to be 1. If an edge has a weight, it must be a positive number.
Returns a right-stochastic representation of directed graph G
.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them