Skip to main content
Ctrl+K

graphclust

  • Installation
  • Example gallery
  • The book
  • API reference
  • Migrating from the MATLAB toolbox
    • Citing
    • Changelog
    • All books
  • GitHub
  • Installation
  • Example gallery
  • The book
  • API reference
  • Migrating from the MATLAB toolbox
  • Citing
  • Changelog
  • All books
  • GitHub

Section Navigation

  • Graphs from data
    • Proximity graphs and their nesting
    • Geodesic distances on a neighborhood graph
  • Vector quantization and topology learning
    • Neural gas learns the shape of the data
    • Topology representing networks
    • Growing networks: GNG, GWR, DTRN and WINN
    • Edge lifetime decides which links survive
  • Clustering with spanning trees
    • Zahn’s MST clustering and the chaining effect
    • Hybrid MST–Gath–Geva clustering cuts the chain
    • Volume-based splitting as initialization of Gaussian mixtures
    • Hybrid MST–GG on the Iris data
    • HDBSCAN*: density-corrected spanning trees
  • Clustering with shared neighbors and graph communities
    • Jarvis–Patrick clustering and its two integer parameters
    • Fuzzy neighborhood similarity: MDS, VAT and dendrogram
    • Fuzzy neighborhood distances on the Wine data
    • Shared-neighbor density and density peaks
    • Spectral clustering and graph communities
  • Visual assessment and map quality
    • VAT and iVAT images
    • Measuring the quality of a map
  • Distance- and neighborhood-based maps
    • PCA, Sammon mapping and MDS
    • LPP, the self-organizing map and incremental grid growing
  • Topology-preserving maps
    • Isomap, Isotop and curvilinear distance analysis
    • OVI-NG, GNLP-NG and TRNMap
    • TRNMap component planes
    • Number of nodes in TRNMap and the mapping quality
  • Neighbor-graph embeddings
    • Laplacian eigenmaps and diffusion maps
    • UMAP and t-SNE on handwritten digits
  • Comparative case studies
    • Combining quantization, distance and mapping
    • Quantitative comparison of topology-based maps
    • Mapping real data: Wine and Wisconsin breast cancer
  • Example gallery
  • Vector quantization and topology learning
  • Edge lifetime decides which links survive

Note

Go to the end to download the full example code or to run this example in your browser via Binder.

Edge lifetime decides which links survive#

All topology learners delete links that have not been refreshed for a given number of steps. A long lifetime keeps transient links created while the nodes were still moving and links that jump between neighboring windings of the swiss roll; a short lifetime keeps only the links supported by the data. The suggestion of the WINN paper, a maximal age of N/10, is far too large for a curved manifold.

WINN, maximal edge age 200: 461 edges, WINN, maximal edge age 3: 2 edges
import matplotlib.pyplot as plt

from graphclust import WeightedIncrementalNetwork
from graphclust.datasets import make_swiss_roll, minmax_scale
from graphclust.plotting import plot_graph

X = minmax_scale(make_swiss_roll(2000, random_state=0)[0])
fig = plt.figure(figsize=(9, 4))
for i, age in enumerate([len(X) / 10, 3]):
    # [snippet:age]
    winn = WeightedIncrementalNetwork(n_nodes=200, max_age=age, random_state=0).fit(X)
    # [/snippet:age]
    ax = fig.add_subplot(1, 2, i + 1, projection="3d")
    plot_graph(winn.nodes_, winn.adjacency_, ax=ax, node_size=5, lw=0.5)
    ax.set_title(f"WINN, maximal edge age {age:g}: {winn.n_edges_} edges", fontsize=10)
    ax.view_init(10, -70)
    ax.set_xticks([])
    ax.set_yticks([])
    ax.set_zticks([])
plt.tight_layout()

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

Launch binder

Download Jupyter notebook: plot_04_edge_lifetime.ipynb

Download Python source code: plot_04_edge_lifetime.py

Download zipped: plot_04_edge_lifetime.zip

Gallery generated by Sphinx-Gallery

previous

Growing networks: GNG, GWR, DTRN and WINN

next

Clustering with spanning trees

Show Source

© Copyright 2026, Ágnes Vathy-Fogarassy, János Abonyi.

Created using Sphinx 9.1.1.