{"id":2540,"library":"igraph","title":"igraph","description":"igraph is a high-performance Python library that provides data structures and algorithms for creating, manipulating, and analyzing graphs (networks). It is a Python interface to the powerful C library `igraph`. The library focuses on efficiency for large graphs and offers extensive functionality, including graph generation, layout algorithms, community detection, and various graph measures. As of version 1.0.0, the project aims for a stable API after a series of breaking changes in earlier 0.x releases, and it maintains a consistent release cadence with frequent bugfix updates.","status":"active","version":"1.0.0","language":"en","source_language":"en","source_url":"https://github.com/igraph/python-igraph","tags":["graph","network","data-structure","algorithm","social-network-analysis","network-science"],"install":[{"cmd":"pip install igraph","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Requires Python 3.9 or later.","package":"Python","optional":false}],"imports":[{"note":"While `from igraph import *` works, it is generally discouraged to avoid name collisions and improve code readability. The canonical import is `import igraph as ig`.","wrong":"from igraph import *","symbol":"Graph","correct":"import igraph as ig\ng = ig.Graph()"}],"quickstart":{"code":"import igraph as ig\n\n# Create a directed graph with 5 vertices\ng = ig.Graph(n=5, directed=True)\n\n# Add names to vertices\ng.vs['name'] = ['Alice', 'Bob', 'Charlie', 'David', 'Eve']\n\n# Add edges with attributes\ng.add_edges([(0, 1), (0, 2), (1, 3), (2, 3), (3, 4)])\ng.es['weight'] = [1.0, 0.5, 2.0, 1.0, 1.5]\n\n# Get basic graph information\nprint(f\"Number of vertices: {g.vcount()}\")\nprint(f\"Number of edges: {g.ecount()}\")\nprint(f\"Is directed: {g.is_directed()}\")\n\n# Find shortest path from 'Alice' to 'Eve'\npath = g.get_shortest_paths('Alice', to='Eve', weights='weight', output='vpath')\nprint(f\"Shortest path from Alice to Eve (vertex IDs): {path}\")\n\n# Example of plotting (requires Cairo or Matplotlib/Plotly backends)\n# from igraph import plot\n# plot(g, layout=g.layout_auto(), target='graph.png', vertex_label=g.vs['name'])","lang":"python","description":"This quickstart demonstrates how to create a directed graph, add vertices with attributes, add weighted edges, retrieve basic graph properties, and find the shortest path between two vertices. Plotting functionality is also mentioned, although commented out as it requires additional dependencies."},"warnings":[{"fix":"Change `python-igraph` to `igraph` in your `requirements.txt` or `pyproject.toml` and reinstall.","message":"The `python-igraph` PyPI package was renamed to `igraph` in version 0.9.8. The `python-igraph` package became a stub that depended on `igraph` and stopped receiving updates after September 1, 2022. Projects should update their dependencies to `igraph` directly.","severity":"breaking","affected_versions":"<0.9.8 (specifically before Sep 1, 2022)"},{"fix":"Consult the official `igraph` migration guide or changelogs for specific function renamings and API adjustments when migrating from 0.9.x to 0.10.x or 1.0.0.","message":"Versions 0.10.x of `python-igraph` (and its underlying C core) introduced numerous API-breaking changes and function renamings in preparation for the 1.0 stable release. Code written for 0.9.x will likely not work directly with 0.10.x without modifications.","severity":"breaking","affected_versions":"0.10.0 and later (relative to 0.9.x)"},{"fix":"Refer to the 1.0.0 changelog and documentation for detailed breaking changes and updated API usage. For example, `Graph.Incidence()` and `Graph.get_incidence()` were deprecated in 0.10.6 in favor of `Graph.Biadjacency()` and `Graph.get_biadjacency()`.","message":"The 1.0.0 release of `igraph` continues with API refinements, building on the breaking changes introduced in 0.10.x to achieve a more consistent and predictable API. This includes updates to the C core to version 1.0.0, which may necessitate further code adjustments for applications migrating from 0.10.x.","severity":"breaking","affected_versions":"1.0.0 (relative to 0.10.x)"},{"fix":"Always import `igraph` with an alias, typically `import igraph as ig`, and prefix `igraph` objects and functions with `ig.` (e.g., `ig.Graph()`).","message":"Using `from igraph import *` is discouraged. While functional, it pollutes the global namespace and can lead to name collisions with other modules or variables, reducing code clarity and maintainability.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}