# Usage

**URL:** https://igraph.discourse.group/c/usage/11.md

[Latest](https://igraph.discourse.group/latest.md) · [Categories](https://igraph.discourse.group/categories.md) · [Tags](https://igraph.discourse.group/tags.md)

---

## [About the Usage category](https://igraph.discourse.group/t/about-the-usage-category/30)

<div class="topic-metadata">

**Author:** [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Replies:** 0\
**Last updated:** [27 January 2020 12:56 UTC](https://igraph.discourse.group/t/about-the-usage-category/30 "2020-01-27T12:56:17Z")

</div>

Questions about using igraph. Since igraph is available in several different languages, you are asked to tag your post to indicate the language. When posting questions: try to be as precise as possible; if possible, …

---

## [edge\_betweenness output vector coerced to dist matrix?](https://igraph.discourse.group/t/edge-betweenness-output-vector-coerced-to-dist-matrix/2220)

<div class="topic-metadata">

**Author:** [@drakej](https://igraph.discourse.group/u/drakej)\
**Replies:** 2\
**Last updated:** [27 October 2026 19:26 UTC](https://igraph.discourse.group/t/edge-betweenness-output-vector-coerced-to-dist-matrix/2220 "2026-10-27T19:26:11Z")

</div>

I am trying to conduct a correlative analysis where in I am trying to relate the pairwise edge betweenness values to a pairwise genetic value. I have been unable to determine how to coerce the vector that edge\_betweenne…

---

## [Get parts of the transitivity ratio](https://igraph.discourse.group/t/get-parts-of-the-transitivity-ratio/2243)

<div class="topic-metadata">

**Author:** [@Zilch](https://igraph.discourse.group/u/Zilch)\
**Replies:** 2\
**Last updated:** [2 June 2026 16:38 UTC](https://igraph.discourse.group/t/get-parts-of-the-transitivity-ratio/2243 "2026-06-02T16:38:19Z")

</div>

Hi there. I’m trying to get both parts of the transitivity ratio, i.e. number:number, instead the 0-1 value. I tried using the triangles and graph.motifs.no function for motifs of triads but the code under provides resul…

---

## [Issue verifying betweenness centrality for a directed graph in R](https://igraph.discourse.group/t/issue-verifying-betweenness-centrality-for-a-directed-graph-in-r/2242)

<div class="topic-metadata">

**Author:** [@Dr-Eti](https://igraph.discourse.group/u/Dr-Eti)\
**Replies:** 4\
**Last updated:** [30 April 2026 14:58 UTC](https://igraph.discourse.group/t/issue-verifying-betweenness-centrality-for-a-directed-graph-in-r/2242 "2026-04-30T14:58:35Z")

</div>

Consider a simple R object containing the following edge list for a directed graph: myArcs\_igraph source\_node\_ISO target\_node\_ISO 1 FR BE 2 NL BE 3 …

---

## [mst() for directed graphs?](https://igraph.discourse.group/t/mst-for-directed-graphs/2226)

<div class="topic-metadata">

**Author:** [@DOSull](https://igraph.discourse.group/u/DOSull)\
**Replies:** 4\
**Last updated:** [28 January 2026 10:21 UTC](https://igraph.discourse.group/t/mst-for-directed-graphs/2226 "2026-01-28T10:21:57Z")

</div>

Hi, I am in a situation where I’m using mst() (in igraph R) but on directed graphs. I know that this is not formally correct, and that e.g., networkx can find arborescences which might be more ‘correct’. However the min…

---

## [How to calculate assortativity for weighted directed graphs?](https://igraph.discourse.group/t/how-to-calculate-assortativity-for-weighted-directed-graphs/2211)

<div class="topic-metadata">

**Author:** [@rosario](https://igraph.discourse.group/u/rosario)\
**Replies:** 1\
**Last updated:** [26 December 2025 19:08 UTC](https://igraph.discourse.group/t/how-to-calculate-assortativity-for-weighted-directed-graphs/2211 "2025-12-26T19:08:51Z")

</div>

I want to define the methodology for my thesis, but RStudio obtains a different value from mine for assortativity. My graph is directed, a multigraph, and has weighted degrees. The equation that I think igraph uses (and …

---

## [Clarification on subgraph function and sample-specific information](https://igraph.discourse.group/t/clarification-on-subgraph-function-and-sample-specific-information/2206)

<div class="topic-metadata">

**Author:** [@H\_Charlie](https://igraph.discourse.group/u/H_Charlie)\
**Replies:** 3\
**Last updated:** [25 September 2025 06:17 UTC](https://igraph.discourse.group/t/clarification-on-subgraph-function-and-sample-specific-information/2206 "2025-09-25T06:17:29Z")

</div>

Hello, thank you for the great tool! I have a question regarding the use of the subgraph function in building single-sample subnetworks. From what I understand, the current implementation takes the global network and th…

---

## [How to correctly calculate betweenness, closeness, and modularity in a weighted, undirected graph with negative weights？](https://igraph.discourse.group/t/how-to-correctly-calculate-betweenness-closeness-and-modularity-in-a-weighted-undirected-graph-with-negative-weights/2200)

<div class="topic-metadata">

**Author:** [@H\_Charlie](https://igraph.discourse.group/u/H_Charlie)\
**Replies:** 3\
**Last updated:** [17 September 2025 12:28 UTC](https://igraph.discourse.group/t/how-to-correctly-calculate-betweenness-closeness-and-modularity-in-a-weighted-undirected-graph-with-negative-weights/2200 "2025-09-17T12:28:09Z")

</div>

I have a question regarding the best practices for calculating centrality metrics and community structure in weighted, undirected networks that contain both positive and negative edge weights (representing correlations). …

---

## [all relation ship between two vertices in a DAG](https://igraph.discourse.group/t/all-relation-ship-between-two-vertices-in-a-dag/2196)

<div class="topic-metadata">

**Author:** [@grocanar](https://igraph.discourse.group/u/grocanar)\
**Replies:** 4\
**Last updated:** [24 August 2025 21:12 UTC](https://igraph.discourse.group/t/all-relation-ship-between-two-vertices-in-a-dag/2196 "2025-08-24T21:12:40Z")

</div>

Hi I am an old user of GRAMPS software to make my genealogy. Amd i m wondering if python-igrah can overcome some low speed troutine in GRAMPS. Especially for instance to find all relatinship path between two person. T…

---

## [Creating Preferential Attachment (PA) Complex Networks with Self Loops](https://igraph.discourse.group/t/creating-preferential-attachment-pa-complex-networks-with-self-loops/2191)

<div class="topic-metadata">

**Author:** [@benyamindsmith](https://igraph.discourse.group/u/benyamindsmith)\
**Replies:** 7\
**Last updated:** [12 August 2025 20:23 UTC](https://igraph.discourse.group/t/creating-preferential-attachment-pa-complex-networks-with-self-loops/2191 "2025-08-12T20:23:07Z")

</div>

I am trying to create a directed simulated preferential attachment complex network with self loops, similar to something like this: (This is the oncology\_network dataset available in the ig.degree.betweenness package.…

---

## [set up seed for community\_leiden](https://igraph.discourse.group/t/set-up-seed-for-community-leiden/2193)

<div class="topic-metadata">

**Author:** [@JellyZhangxc](https://igraph.discourse.group/u/JellyZhangxc)\
**Replies:** 5\
**Last updated:** [11 August 2025 22:57 UTC](https://igraph.discourse.group/t/set-up-seed-for-community-leiden/2193 "2025-08-11T22:57:35Z")

</div>

Hi, there is there any way we could set up a seed for community\_leiden? thanks seems kwds does not support any other argument except resolution\_parameter

---

## [Find minimum number of individuals](https://igraph.discourse.group/t/find-minimum-number-of-individuals/2188)

<div class="topic-metadata">

**Author:** [@Ross\_Ahmed](https://igraph.discourse.group/u/Ross_Ahmed)\
**Replies:** 0\
**Last updated:** [27 July 2025 11:30 UTC](https://igraph.discourse.group/t/find-minimum-number-of-individuals/2188 "2025-07-27T11:30:02Z")

</div>

I have a tibble with two columns and 312 rows: individual and different. The column individual is an integer vector with numbers 1 to 312. The column different is a character vector with each row listing individuals that…

---

## [All topological sorting arrangements of a DAG](https://igraph.discourse.group/t/all-topological-sorting-arrangements-of-a-dag/1151)

<div class="topic-metadata">

**Author:** [@mb208](https://igraph.discourse.group/u/mb208)\
**Replies:** 3\
**Last updated:** [1 July 2025 23:47 UTC](https://igraph.discourse.group/t/all-topological-sorting-arrangements-of-a-dag/1151 "2025-07-01T23:47:20Z")

</div>

Hi all, I noticed that there is a topological sort method that gives a topological sorting of the vertices of a DAG, but this seems to only return 1 arrangement. I was wondering if there was a method that returns all po…

---

## [Find cycles in graph](https://igraph.discourse.group/t/find-cycles-in-graph/2165)

<div class="topic-metadata">

**Author:** [@iFoxz](https://igraph.discourse.group/u/iFoxz)\
**Replies:** 1\
**Last updated:** [11 June 2025 09:29 UTC](https://igraph.discourse.group/t/find-cycles-in-graph/2165 "2025-06-11T09:29:33Z")

</div>

I have installed python-igraph with pip (version 0.11.8). I created a directed graph but I am not able to access the function simple\_cycles reported in the doc. I found in the C documentation that the related functions…

---

## [Callback in Python igraph Traversal Algorithms](https://igraph.discourse.group/t/callback-in-python-igraph-traversal-algorithms/1517)

<div class="topic-metadata">

**Author:** [@nparham](https://igraph.discourse.group/u/nparham)\
**Replies:** 2\
**Last updated:** [10 June 2025 13:51 UTC](https://igraph.discourse.group/t/callback-in-python-igraph-traversal-algorithms/1517 "2025-06-10T13:51:25Z")

</div>

Is it not possible to specify a callback for BFS/DFS in igraph via the Python API? If not, is this not a feature on purpose? I am wondering why R seems to have more functionality than Python with respect to igraph featur…

---

## [Katz centrality](https://igraph.discourse.group/t/katz-centrality/2163)

<div class="topic-metadata">

**Author:** [@logion2000](https://igraph.discourse.group/u/logion2000)\
**Replies:** 3\
**Last updated:** [8 June 2025 16:55 UTC](https://igraph.discourse.group/t/katz-centrality/2163 "2025-06-08T16:55:03Z")

</div>

Eigenvector centrality cannot be calculated for a disconnected graph. Even though it can be calculated for each connected subgraph, the values cannot be compared across subgraphs. It is said that Katz centrality overcome…

---

## [Which method is better?](https://igraph.discourse.group/t/which-method-is-better/2149)

<div class="topic-metadata">

**Author:** [@logion2000](https://igraph.discourse.group/u/logion2000)\
**Replies:** 1\
**Last updated:** [8 June 2025 00:51 UTC](https://igraph.discourse.group/t/which-method-is-better/2149 "2025-06-08T00:51:11Z")

</div>

I have a list of nodes (Nodes), and a list of edges (Edges). Some nodes are isolated. I want to create a graph that includes all nodes, regardless whether the node is connected or isolated. I can think of two methods to …

---

## [Is there any way to find all cutsets of a graph using IGraphM?](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 6\
**Last updated:** [7 June 2025 03:50 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153 "2025-06-07T03:50:44Z")

</div>

Is there any way to find all cutsets of a graph using IGraphM? g = Graph\[{DirectedEdge\[0, 3, 1\], DirectedEdge\[2, 1, 2\], DirectedEdge\[2, 0, 3\], DirectedEdge\[0, 2, 4\], DirectedEdge\[3, 1, 5\], DirectedEdge\[3, 1, 6…

---

## [How to find the shortest path to a single target vertex?](https://igraph.discourse.group/t/how-to-find-the-shortest-path-to-a-single-target-vertex/2145)

<div class="topic-metadata">

**Author:** [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Replies:** 0\
**Last updated:** [31 May 2025 14:12 UTC](https://igraph.discourse.group/t/how-to-find-the-shortest-path-to-a-single-target-vertex/2145 "2025-05-31T14:12:34Z")

</div>

I saw this question come up in the Gurubase analytics, and thought it’s worth discussing here: How to find the shortest path to a single target vertex? The simple answer is: To achieve good performance, always find s…

---

## [Memory usage many multigraphs](https://igraph.discourse.group/t/memory-usage-many-multigraphs/2119)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 4\
**Last updated:** [29 May 2025 08:29 UTC](https://igraph.discourse.group/t/memory-usage-many-multigraphs/2119 "2025-05-29T08:29:17Z")

</div>

I have a large number of graphs—up to millions of multigraphs. The issue is that they consume too much memory, which likely causes slowdowns. I noticed that if I save only the edge lists instead of full graphs using Ed…

---

## [How can I get all options of a function from IGraphM?](https://igraph.discourse.group/t/how-can-i-get-all-options-of-a-function-from-igraphm/2131)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 4\
**Last updated:** [22 May 2025 17:07 UTC](https://igraph.discourse.group/t/how-can-i-get-all-options-of-a-function-from-igraphm/2131 "2025-05-22T17:07:15Z")

</div>

How can I get all options of a function from IGraphM? For example, I want to retrieve the options for the function IGLayoutPlanar, but Options\[IGLayoutPlanar\] returns an empty list {}, even though I believe it does have…

---

## [How to get which motifs each value corresponds to？](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96)

<div class="topic-metadata">

**Author:** [@ningfneng](https://igraph.discourse.group/u/ningfneng)\
**Replies:** 7\
**Last updated:** [13 May 2025 08:47 UTC](https://igraph.discourse.group/t/how-to-get-which-motifs-each-value-corresponds-to/96 "2025-05-13T08:47:31Z")

</div>

I’m using python-igraph to find the motifs in a graph with the method motifs\_randesu. And it returns a list of the number of each motif. However, I don’t know what kind of motif each number corresponds to. For example: …

---

## [Isomorphism Testing in Multigraphs Using Canonical Forms](https://igraph.discourse.group/t/isomorphism-testing-in-multigraphs-using-canonical-forms/2116)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 2\
**Last updated:** [7 May 2025 12:13 UTC](https://igraph.discourse.group/t/isomorphism-testing-in-multigraphs-using-canonical-forms/2116 "2025-05-07T12:13:46Z")

</div>

None of the three algorithms in IGraphM support canonical forms for isomorphism testing. Are there any algorithms that handle isomorphism testing for unlabeled-edge multigraphs or edge-colored multigraphs using canonica…

---

## [Can I run IGraphM on Wolfram Cloud](https://igraph.discourse.group/t/can-i-run-igraphm-on-wolfram-cloud/2113)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 1\
**Last updated:** [5 May 2025 09:22 UTC](https://igraph.discourse.group/t/can-i-run-igraphm-on-wolfram-cloud/2113 "2025-05-05T09:22:20Z")

</div>

I’m trying to use the IGraphM package on the Wolfram Cloud, but I encountered the following error: IGraph/M cannot run in the Wolfram Cloud because the cloud does not support LibraryLink. Aborting. Is there any way t…

---

## [How to perform SPQR-tree decomposition in IGraphM?](https://igraph.discourse.group/t/how-to-perform-spqr-tree-decomposition-in-igraphm/2109)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 3\
**Last updated:** [2 May 2025 17:58 UTC](https://igraph.discourse.group/t/how-to-perform-spqr-tree-decomposition-in-igraphm/2109 "2025-05-02T17:58:06Z")

</div>

I’m trying to perform an SPQR-tree decomposition on a given graph using IGraphM in Mathematica. However, it seems there is no built-in function for this in the current version. Is there any workaround or way to achieve …

---

## [How to test graph isomorphism with edge labels using IGraph?](https://igraph.discourse.group/t/how-to-test-graph-isomorphism-with-edge-labels-using-igraph/2104)

<div class="topic-metadata">

**Author:** [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Replies:** 7\
**Last updated:** [1 May 2025 05:19 UTC](https://igraph.discourse.group/t/how-to-test-graph-isomorphism-with-edge-labels-using-igraph/2104 "2025-05-01T05:19:47Z")

</div>

Is it possible to check for isomorphism of undirected graphs with edge labels (no vertex label) in IGraph? I have read the documentation on isomorphism in the package but haven’t figured out how to do it. Here is an ex…

---

## [Directed graph weighted harmonic centrality with cutoff](https://igraph.discourse.group/t/directed-graph-weighted-harmonic-centrality-with-cutoff/2099)

<div class="topic-metadata">

**Author:** [@road\_nx\_enthusiast](https://igraph.discourse.group/u/road_nx_enthusiast)\
**Replies:** 3\
**Last updated:** [25 April 2025 22:24 UTC](https://igraph.discourse.group/t/directed-graph-weighted-harmonic-centrality-with-cutoff/2099 "2025-04-25T22:24:03Z")

</div>

Hi there, I am using igraph to calculate centrality metrics in large directed road networks weighted by road segment length. To simulate the centrality with respect to typical trip lengths, I am using the cutoff parame…

---

## [Suggestions for implementing parallel runs of get\_shortest\_path in igraph Python](https://igraph.discourse.group/t/suggestions-for-implementing-parallel-runs-of-get-shortest-path-in-igraph-python/2029)

<div class="topic-metadata">

**Author:** [@mdb](https://igraph.discourse.group/u/mdb)\
**Replies:** 2\
**Last updated:** [25 April 2025 08:27 UTC](https://igraph.discourse.group/t/suggestions-for-implementing-parallel-runs-of-get-shortest-path-in-igraph-python/2029 "2025-04-25T08:27:43Z")

</div>

Hi! I’m using igraph Python to calculate shortest paths between a large set of nodes. The graph is around 2.2 mil. nodes and 4 mil. edges. I need to calculate for more than 100.000 sets of start and end nodes, the k sh…

---

## [Incidence matrix from bipartite graph in python-igraph](https://igraph.discourse.group/t/incidence-matrix-from-bipartite-graph-in-python-igraph/1270)

<div class="topic-metadata">

**Author:** [@jboynyc](https://igraph.discourse.group/u/jboynyc)\
**Replies:** 2\
**Last updated:** [23 April 2025 10:15 UTC](https://igraph.discourse.group/t/incidence-matrix-from-bipartite-graph-in-python-igraph/1270 "2025-04-23T10:15:25Z")

</div>

What is the most efficient way of returning the incidence matrix of a bipartite graph in Python? I see that the R interface comes with a helper function called as\_incidence\_matrix, but I don’t see anything comparable in …

---

## [trouble building the xml docs](https://igraph.discourse.group/t/trouble-building-the-xml-docs/2078)

<div class="topic-metadata">

**Author:** [@Krastanov](https://igraph.discourse.group/u/Krastanov)\
**Replies:** 2\
**Last updated:** [22 April 2025 01:22 UTC](https://igraph.discourse.group/t/trouble-building-the-xml-docs/2078 "2025-04-22T01:22:21Z")

</div>

I want to build the docs in a machine readable format for programmatically adding them to a julia wrapper library around igraph. I tried both the release tarball and the git repo (both master and the 0.10.15 tag). In a…

[Next page](https://igraph.discourse.group/c/usage/11.md?page=1)
