# Is there any way to find all cutsets of a graph using IGraphM?

**URL:** <https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153>\
**Category:** Usage\
**Tags:** Mathematica\
**Created:** [5 June 2025 15:54 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153 "2025-06-05T15:54:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anhnha](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/anhnha/32/1169_2.png) [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Post date:** [5 June 2025 15:54 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/1 "2025-06-05T15:54:34Z")

</div>

Is there any way to find all cutsets of a graph using IGraphM?

```auto
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], 
    DirectedEdge[0, 4, 1], DirectedEdge[4, 5, 1], 
    DirectedEdge[0, 5, 1]}, VertexLabels -> "Name"];

```

`IncidenceMatrix` from Mathematica is helpful, but it doesn’t include all possible cutsets.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [5 June 2025 16:30 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/2 "2025-06-05T16:30:28Z")

</div>

Have a look at `IGFindMinimalCuts` and `IGFindMinimumCuts`. These finds minimal or minimum edge cuts between two specific vertices.

---

<div class="post-metadata">

**Author:** ![anhnha](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/anhnha/32/1169_2.png) [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Post date:** [5 June 2025 18:39 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/3 "2025-06-05T18:39:32Z")

</div>

> [@szhorvat](#):
>
> `IGFindMinimalCuts`

Thanks for the info. I tried, but it doesn’t seem to work — or did I misunderstand something?

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/f/fe44ef4fd5064e5164e75ab6560e95c1c917ee3e.png)

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [5 June 2025 23:30 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/4 "2025-06-05T23:30:29Z")

</div>

What is the result that you are expecting? There is only one minimal edge cut between 0 and 3, and it is returning that.

---

<div class="post-metadata">

**Author:** ![anhnha](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/anhnha/32/1169_2.png) [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Post date:** [6 June 2025 13:24 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/5 "2025-06-06T13:24:50Z")

</div>

I’m sorry—I probably misunderstood the concept of connectedness in a directed graph.  
I converted it to an undirected graph, and now it seems to work fine.

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/c/c2b121fb2bdaee90a0c1751967989316eae3708a.png)

However, for directed multigraphs, how can I get all the cutsets in a format similar to Kirchhoff’s current law equations in electrical circuits (similar to `IncidenceMatrix`)?  
The conversion to an undirected graph allows me to find the cutsets, but they are just sets of edges without any reference direction.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [6 June 2025 14:01 UTC](https://igraph.discourse.group/t/is-there-any-way-to-find-all-cutsets-of-a-graph-using-igraphm/2153/6 "2025-06-06T14:01:48Z")

</div>

Do you mean that you want the result to be set of directed edges, but you want to compute cuts while ignoring edge directions?

I think it would be a useful feature to have a `DirectedEdges` option that allows ignoring edge directions in directed graphs. Can you open an issue to suggest this feature, so I wouldn’t forget?

---

<div class="post-metadata">

**Author:** ![anhnha](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/anhnha/32/1169_2.png) [@anhnha](https://igraph.discourse.group/u/anhnha)\
**Post date:** [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/7 "2025-06-07T03:50:44Z")

</div>

Sorry, that’s not exactly what I meant. But if you think it would be helpful, I will open a feature request.

What I actually want is something like this:

 ![image](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/9/999c71e8b552e4b17650f1381dee893b738aacd7.jpeg)  
(a random image I found from google search)

Assume that for a cutset in a directed graph, you can write an equation like  
**e1 + e4 - e5 - e6 = 0**  
where e1 and e4 go in one direction across the cut, and e5 and e6 go in the opposite direction.

So instead of just a list of edge cut like `{e1, e4, e5, e6}`, I want something that also captures the direction of each edge relative to the cut, such as:  
**e1 + e4 - e5 - e6 = 0** , or **{e1, e4, -e5, -e6}** , or **{-e1, -e4, e5, e6}** , etc.
