amount of chordless cycles

Is there a way to compute the number of chordless cycles in a given graph with igraph (in particular with the C library) ?

There are ways you can use, but they will be slow.

Take a look at igraph_subisomorphic_lad(). It has an option to find only induced subgraphs. You can then look for induced (i.e. chordless) cycles for each size one by one. Note that this function computes subgraph isomorphsms, not subgraphs. There are 2n ways to map an n-cycle onto itself (n rotations and a reversal). Thus, the counts for n-cycles need to be divided by 2n.

Also look at igraph_motifs_randesu(). This functions counts “motifs”, i.e. connected induced subgraphs of a given size. It is implemented only for size-3 and size-4 motifs, but it will be the fastest way to count size-4 induced cycles.

I don’t recall any other simple way using existing functions.

If you are aware of good algorithms for solving this problem, please open a feature request and provide referenced along with a brief summary of the topic.

Some relevant links:

(Peer reviewed version of the above.)

(Did not find a peer-reviewed version.)

(It might be good to look at, but do not trust StackOverflow on topics like this one.)

For now it sounds heavy indeed.


Are you feeling up to implementing an algorithm for this?

Amortized Õ(|V|)-Delay Algorithm for Listing Chordless Cycles in Undirected Graph

Thanks, I added it to the feature request issue.

Can you comment on the use cases, so we can fill that section out as well (see issue on GitHub)?