Seven ways to draw a hyperedge#

With fixed vertex positions, hyperedges can be drawn as padded convex hulls (HyperGodot), rounded hulls, implicit isocontours that avoid non-members (Bubble Sets style), minimum-volume ellipses (as in the HAT-VIS scripts), filled polygons (XGI style), stars from a hub node (star expansion) or minimum spanning trees (HAT-VIS).

hull, smooth, bubble, ellipse, polygon, star, mst, vertex filter: C3
import matplotlib.pyplot as plt

import hatvis as hv
from hatvis.plotting import draw_hypergraph

H = hv.datasets.load_manufacturing_cps()
pos = hv.layout_membership(H, random_state=0)
styles = ["hull", "smooth", "bubble", "ellipse", "polygon", "star", "mst"]
fig, axes = plt.subplots(2, 4, figsize=(17, 8.5))
for ax, style in zip(axes.ravel(), styles, strict=False):
    # [snippet:style]
    draw_hypergraph(H, pos=pos, style=style, ax=ax, legend=False, title=style, labels=False)
    # [/snippet:style]
draw_hypergraph(H, pos=pos, style="smooth", ax=axes[1, 3], highlight="C3", legend=False,
                title="vertex filter: C3", labels=True)
plt.tight_layout()

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

Gallery generated by Sphinx-Gallery