Skip to content

Latest commit

 

History

History
183 lines (96 loc) · 4.24 KB

plot_14_bipartite_layout.rst

File metadata and controls

183 lines (96 loc) · 4.24 KB

html

Note

Click here <sphx_glr_download_sphinx_gallery_output_plot_14_bipartite_layout.py> to download the full example code

sphx-glr-example-title

Bipartite node layout

By default, nodes are partitioned into two subsets using a two-coloring of the graph. The median heuristic proposed in Eades & Wormald (1994) is used to reduce edge crossings.

/sphinx_gallery_output/images/sphx_glr_plot_14_bipartite_layout_001.png

sphx-glr-script-out

Out:

/home/paul/src/netgraph/netgraph/_node_layout.py:1026: UserWarning: The graph consistst of multiple components, and hence the partitioning into two subsets/layers is ambiguous!
Use the `subsets` argument to explicitly specify the desired partitioning.
  warnings.warn(msg)

The partitions can also be made explicit using the subsets argument. In multi-component bipartite graphs, multiple two-colorings are possible, such that explicit specification of the subsets may be necessary to achieve the desired partitioning of nodes.

/sphinx_gallery_output/images/sphx_glr_plot_14_bipartite_layout_002.png

To change the layout from the left-right orientation to a bottom-up orientation, call the layout function directly and swap x and y coordinates of the node positions.

/sphinx_gallery_output/images/sphx_glr_plot_14_bipartite_layout_003.png

sphx-glr-timing

Total running time of the script: ( 0 minutes 0.362 seconds)

html