https://github.com/jfb-h/blockmodelutils.jl
Julia package for representing and plotting network blockmodels
https://github.com/jfb-h/blockmodelutils.jl
blockmodeling julia network-analysis
Last synced: 27 days ago
JSON representation
Julia package for representing and plotting network blockmodels
- Host: GitHub
- URL: https://github.com/jfb-h/blockmodelutils.jl
- Owner: jfb-h
- License: mit
- Created: 2025-02-23T17:22:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-26T19:48:07.000Z (over 1 year ago)
- Last Synced: 2025-02-26T20:29:17.161Z (over 1 year ago)
- Topics: blockmodeling, julia, network-analysis
- Language: Julia
- Homepage: https://jfb-h.github.io/BlockmodelUtils.jl/
- Size: 231 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# BlockmodelUtils.jl
[](https://jfb-h.github.io/BlockmodelUtils.jl/stable)
[](https://jfb-h.github.io/BlockmodelUtils.jl/dev)
[](https://github.com/jfb-h/BlockmodelUtils.jl/actions)
[](https://github.com/jfb-h/BlockmodelUtils.jl/actions/workflows/Test.yml?query=branch%3Amain)
[](https://github.com/jfb-h/BlockmodelUtils.jl/actions/workflows/Docs.yml?query=branch%3Amain)
[](https://codecov.io/gh/jfb-h/BlockmodelUtils.jl)
[](https://github.com/JuliaBesties/BestieTemplate.jl)
Represent, analyse, and plot [network blockmodels](https://en.wikipedia.org/wiki/Blockmodeling), i.e., blocked graph adjacency matrices based on some node partition. As of now, this package does *not* contain functionality to infer node partitions (i.e., clusters or equivalence-based) from network structure. Its main purpose is instead to provide a simple representation of blockmodels and some plotting utilities.
# Getting started
For a graph `g` and a vector of group labels `groups`, create a blockmodel with the `blockmodel` function:
```julia
using Graphs, BlockmodelUtils
n = 20
g = erdos_renyi(n, 0.1)
groups = rand('a':'d', n)
bm = blockmodel(g, groups)
```
The resulting `Blockmodel` prints the blockdensity matrix:
```julia-repl
Blockmodel{Int64, SimpleGraph{Int64}}
4 groups with sizes [6, 7, 4, 3]
┌───┬───────┬───────┬───────┬───────┐
│ │ 1 │ 2 │ 3 │ 4 │
├───┼───────┼───────┼───────┼───────┤
│ a │ 0.200 │ 0.214 │ 0.250 │ 0.278 │
├───┼───────┼───────┼───────┼───────┤
│ b │ 0.214 │ 0.095 │ 0.179 │ 0.286 │
├───┼───────┼───────┼───────┼───────┤
│ c │ 0.250 │ 0.179 │ 0.167 │ 0.083 │
├───┼───────┼───────┼───────┼───────┤
│ d │ 0.278 │ 0.286 │ 0.083 │ 0.000 │
└───┴───────┴───────┴───────┴───────┘
```
## How to Cite
If you use BlockmodelUtils.jl in your work, please cite using the reference given in [CITATION.cff](https://github.com/jfb-h/BlockmodelUtils.jl/blob/main/CITATION.cff).