Graspologic
raw JSON → 3.4.4 verified Mon Apr 27 auth: no python
graspologic is a Python library for graph statistics, including estimation of latent position graphs, graph matching, and spectral embedding. Current version is 3.4.4, supporting Python 3.9 to <3.13. Release cadence is irregular, with several minor releases per year.
pip install graspologic Common errors
error AttributeError: module 'graspologic' has no attribute 'embed' ↓
cause You imported graspologic but not the submodule. The top-level package does not automatically import submodules.
fix
Use 'from graspologic.embed import AdjacencySpectralEmbed' instead of 'graspologic.embed.AdjacencySpectralEmbed'.
error ImportError: cannot import name 'GaussianCluster' from 'graspologic.cluster' ↓
cause GaussianCluster was removed or renamed in graspologic 3.x. The clustering module now uses 'GaussianMixture' from scikit-learn under the hood.
fix
Use 'from sklearn.mixture import GaussianMixture' or check docs for alternative graspologic class.
error TypeError: 'AdjacencySpectralEmbed' object is not iterable ↓
cause In older code, you may have tried to unpack the embedding result as a tuple. In graspologic 3.x, fit_transform returns a numpy array only.
fix
Assign result to a variable directly: X = ase.fit_transform(adj).
error ModuleNotFoundError: No module named 'hyppo' ↓
cause You are using a function that relies on hyppo (e.g., independence test) but hyppo is not installed.
fix
Install with: pip install graspologic[stats]
Warnings
breaking In graspologic 3.x, the old 'graspologic.embed' submodule API changed: some functions now return objects instead of tuples. Code from 2.x may break if you unpack results directly. ↓
fix Check return types: use .fit_transform() method on embedding classes, not standalone functions.
deprecated The function 'graspologic.plot.heatmap' is deprecated and will be removed in a future release. Use matplotlib directly instead. ↓
fix Replace with matplotlib.pyplot.imshow() or seaborn.heatmap().
gotcha Importing 'graspologic' alone (without submodules) does not import embedding or clustering functions. You must import specific submodules like 'graspologic.embed'. ↓
fix Use from graspologic.embed import ... or import graspologic.embed as ge
gotcha The 'hyppo' library is an optional dependency; if not installed, some independence test functions will raise ImportError at runtime. ↓
fix Install with 'pip install graspologic[stats]' to include hyppo.
breaking Python 3.13 support is not yet available; graspologic requires Python <3.13. ↓
fix Use Python 3.9–3.12.
Imports
- AdjacencySpectralEmbed
from graspologic.embed import AdjacencySpectralEmbed - LaplacianSpectralEmbed
from graspologic.embed import LaplacianSpectralEmbed - GaussianCluster
from graspologic.cluster import GaussianCluster - graspologic wrong
import graspologiccorrectInternal server error