{"id":21399,"library":"graspologic","title":"Graspologic","description":"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.","status":"active","version":"3.4.4","language":"python","source_language":"en","source_url":"https://github.com/graspologic-org/graspologic","tags":["graph statistics","spectral embedding","network analysis","community detection"],"install":[{"cmd":"pip install graspologic","lang":"bash","label":"install from PyPI"}],"dependencies":[{"reason":"graph data structures and algorithms","package":"networkx","optional":false},{"reason":"numerical computations","package":"numpy","optional":false},{"reason":"used in clustering and other utilities","package":"scikit-learn","optional":false},{"reason":"independence testing (optional for some functions)","package":"hyppo","optional":true},{"reason":"optimal transport (optional)","package":"POT","optional":true}],"imports":[{"note":"Standard import path for spectral embedding.","symbol":"AdjacencySpectralEmbed","correct":"from graspologic.embed import AdjacencySpectralEmbed"},{"note":"Standard import path for Laplacian spectral embedding.","symbol":"LaplacianSpectralEmbed","correct":"from graspologic.embed import LaplacianSpectralEmbed"},{"note":"Standard import path for Gaussian clustering.","symbol":"GaussianCluster","correct":"from graspologic.cluster import GaussianCluster"},{"note":"Top-level import does not expose most functions; you must import submodules.","wrong":"import graspologic","symbol":"graspologic"}],"quickstart":{"code":"import numpy as np\nfrom graspologic.embed import AdjacencySpectralEmbed\nfrom graspologic.simulations import er_np\n\n# Generate a random graph\nadj = er_np(100, 0.3)\n\n# Embed the adjacency matrix\nase = AdjacencySpectralEmbed(n_components=2)\nX = ase.fit_transform(adj)\nprint(X.shape)  # (100, 2)\n","lang":"python","description":"Quickstart: generate an Erdős–Rényi graph and compute an adjacency spectral embedding."},"warnings":[{"fix":"Check return types: use .fit_transform() method on embedding classes, not standalone functions.","message":"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.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Replace with matplotlib.pyplot.imshow() or seaborn.heatmap().","message":"The function 'graspologic.plot.heatmap' is deprecated and will be removed in a future release. Use matplotlib directly instead.","severity":"deprecated","affected_versions":">=3.3.0"},{"fix":"Use from graspologic.embed import ... or import graspologic.embed as ge","message":"Importing 'graspologic' alone (without submodules) does not import embedding or clustering functions. You must import specific submodules like 'graspologic.embed'.","severity":"gotcha","affected_versions":"all"},{"fix":"Install with 'pip install graspologic[stats]' to include hyppo.","message":"The 'hyppo' library is an optional dependency; if not installed, some independence test functions will raise ImportError at runtime.","severity":"gotcha","affected_versions":">=3.4.0"},{"fix":"Use Python 3.9–3.12.","message":"Python 3.13 support is not yet available; graspologic requires Python <3.13.","severity":"breaking","affected_versions":">=3.4.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from graspologic.embed import AdjacencySpectralEmbed' instead of 'graspologic.embed.AdjacencySpectralEmbed'.","cause":"You imported graspologic but not the submodule. The top-level package does not automatically import submodules.","error":"AttributeError: module 'graspologic' has no attribute 'embed'"},{"fix":"Use 'from sklearn.mixture import GaussianMixture' or check docs for alternative graspologic class.","cause":"GaussianCluster was removed or renamed in graspologic 3.x. The clustering module now uses 'GaussianMixture' from scikit-learn under the hood.","error":"ImportError: cannot import name 'GaussianCluster' from 'graspologic.cluster'"},{"fix":"Assign result to a variable directly: X = ase.fit_transform(adj).","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.","error":"TypeError: 'AdjacencySpectralEmbed' object is not iterable"},{"fix":"Install with: pip install graspologic[stats]","cause":"You are using a function that relies on hyppo (e.g., independence test) but hyppo is not installed.","error":"ModuleNotFoundError: No module named 'hyppo'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}