# \[ANN\] Benchmark networks/graphs with LFRBenchmarkGraphs.jl

**URL:** https://discourse.julialang.org/t/ann-benchmark-networks-graphs-with-lfrbenchmarkgraphs-jl/111204
**Category:** Package Announcements
**Tags:** package, announcement, graphs, network, community-detection
**Created:** [March 5, 2024, 4:14pm UTC](https://discourse.julialang.org/t/ann-benchmark-networks-graphs-with-lfrbenchmarkgraphs-jl/111204 "2024-03-05T16:14:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fcdimitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fcdimitr/32/26613_2.png) [@fcdimitr](https://discourse.julialang.org/u/fcdimitr)
#### Post date: [March 5, 2024, 4:14pm UTC](https://discourse.julialang.org/t/ann-benchmark-networks-graphs-with-lfrbenchmarkgraphs-jl/111204/1 "2024-03-05T16:14:42Z")

</div>

This is a package for generating [Lancichinetti-Fortunato-Radicchi model](https://en.wikipedia.org/wiki/Lancichinetti-Fortunato-Radicchi_benchmark) benchmarks graphs. Such graphs are widely used in benchmarking community detection algorithms. The [LFRBenchmarkGraphs.jl](https://github.com/fcdimitr/LFRBenchmarkGraphs.jl) package is a simple wrapper to the original `C/C++` implementation by the authors [[1]](#1),[[2]](#2).

## Example usage

### Dependencies for this demo

Import the necessary packages.

```julia
using GraphMakie, CairoMakie, LFRBenchmarkGraphs, Graphs

```

### Graph generation

Generate an example LFR graph using the LFRBenchmarkGraphs.jl package. The output is a tuple with the graph and the membership/community ID of each vertex.

```julia
g,cid = lancichinetti_fortunato_radicchi(1000, 15, 40);

```

### Visualize graph

We use the GraphMakie.jl package to visualize the graph, with the default layout algorithm.

```julia
f = Figure()
ax = Axis(f[1, 1], title = "LFR graph", xticklabelsvisible = false, yticklabelsvisible = false)
graphplot!(ax, g; edge_width = 0.1, node_color = cid, node_size = 6)
colsize!(f.layout, 1, Aspect(1, 1.0))
resize_to_layout!(f)
f

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/9/6/96c19a77cf43e2491f36ae8a0c61f4a61ca7ceec.png)

Enjoy!

## References

[1] Benchmarks for testing community detection algorithms on directed and weighted graphs with overlapping communities, Andrea Lancichinetti and Santo Fortunato, 2009. [https://doi.org/10.1103/PhysRevE.80.016118](https://doi.org/10.1103/PhysRevE.80.016118)  
[2] Benchmark graphs for testing community detection algorithms, Andrea Lancichinetti, Santo Fortunato, and Filippo Radicchi, 2008. [https://doi.org/10.1103/PhysRevE.78.046110](https://doi.org/10.1103/PhysRevE.78.046110)
