I have a weighted directed graph (nx.DiGraph) that I want to plot as a Sankey diagram using Matplotlib.
I'm a bit confused about the roles of prior and connect. The docs say:
prior : int
Index of the prior diagram to which this diagram should be connected.
and
connect : (int, int)
A (prior, this) tuple indexing the flow of the prior diagram and the flow of this diagram which should be connected. If this is the first diagram or prior is None, connect will be ignored.
It isn't clear to me what these parameters are that I would have to specify prior twice, once in prior and the other time as the first element passed to connect.
There are these examples in the Matplotlib gallery, but I did not find that they illuminated much about how these parameters are really supposed to work.
I found this tutorial which did a nice job of incrementally building up some of the components. It described connect this way:
It turns out that we can now give a simpler explanation of the connect argument: it says which flows (indexed in the order they were defined) should be connected. So connect should really be described as
connect = (index_of_prior_flow, index_of_current_diagram_flow) that need to be connected
But taking that understanding to this example proved confusing to me since I would have thought that index_of_current_diagram_flow would be constant across diagrams, but the example suggests otherwise.
I'm sure there is a consistent behaviour to this tool, but I don't understand it yet. How do I understand prior and connect in terms of a directed graph?