# Find k-cliques in a graph

**URL:** <https://discourse.julialang.org/t/find-k-cliques-in-a-graph/24022>\
**Category:** Specific Domains\
**Created:** [May 9, 2019, 11:11am UTC](https://discourse.julialang.org/t/find-k-cliques-in-a-graph/24022 "2019-05-09T11:11:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pablosanjose](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablosanjose/32/7006_2.png) [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Post date:** [May 9, 2019, 11:11am UTC](https://discourse.julialang.org/t/find-k-cliques-in-a-graph/24022/1 "2019-05-09T11:11:48Z")

</div>

I have an undirected graph, given for the sake of simplicity as a list of edges `(n,m)`, where `n` and `m` are integers corresponding to nodes. I need to find all possible k-cliques (groups of `k` nodes wherein all members are connected to all other members). I see that in LightGraphs.jl there is an algorithm (inherited, I believe, from Graphs.jl, which inherited it from the NetworkX package) for finding all _maximal_ cliques (i.e. k-cliques with a maximum k). But that is a much more difficult problem (NP complete, I think).

The question: is there in the Julia ecosystem a package/algorithm for finding only the k-cliques I need, and that is hopefully more efficient than first computing all maximal cliques? If not, what is the best known algorithm to do that?

(For context: I need this to find all k-simplices in a discretized Brillouin Zone mesh, to compute electronic structure of a generic system in the [github.com/pablosanjose/Elsa.jl](http://github.com/pablosanjose/Elsa.jl) package)

---

_[View the full topic](https://discourse.julialang.org/t/find-k-cliques-in-a-graph/24022)._
