r"""
s-walks: how strongly are hyperedges connected?
===============================================

Two hyperedges are :math:`s`-adjacent if they share at least :math:`s`
vertices. As :math:`s` grows, the :math:`s`-line graph thins out and only
strongly overlapping groups remain connected. The *s-profile* of hatvis shows
the :math:`s`-connected component of every activity of the wire harness
space for :math:`s=1,\dots,4`, and the vertex :math:`s`-line graphs show the
resources that share at least one or two activities.
"""

# %%
import matplotlib.pyplot as plt

import hatvis as hv
from hatvis.plotting import plot_s_profile, plot_s_walks

H = hv.datasets.load_wire_harness()
# [snippet:profile]
print(hv.s_component_profile(H, s_values=range(1, 5)))
print(hv.s_component_profile(H, s_values=range(1, 5), edges=False))
# [/snippet:profile]

# %%
fig, ax = plt.subplots(figsize=(5, 11))
plot_s_profile(H, s_values=range(1, 5), ax=ax, labels=True)
plt.tight_layout()

# %%
plot_s_walks(H, s_values=(1, 2))
plt.gcf().set_size_inches(13, 5.5)
plt.tight_layout()
