Note
Go to the end to download the full example code or to run this example in your browser via Binder.
Linked primal and dual views#
Reading a hypergraph together with its dual helps to switch between the two roles of the elements: in the production example an entity is a vertex of several tasks, and in the dual it becomes the hyperedge of those tasks. In the linked views (after Qu et al. 2022) the color of a hyperedge in one view is the color of the corresponding vertex in the other.

import matplotlib.pyplot as plt
import hatvis as hv
from hatvis.plotting import draw_primal_dual
H = hv.datasets.load_manufacturing_cps()
# [snippet:pd]
axes = draw_primal_dual(H, layout="similarity", style="smooth", labels=True, pad=0.025)
# [/snippet:pd]
axes[0].figure.set_size_inches(14, 6)
plt.tight_layout()
Total running time of the script: (0 minutes 0.255 seconds)