Reference

Base.mapMethod
map(fun, bm::Blockmodel)

Map function fun over the blocks of the Blockmodel bm and return a k by k matrix, where k is the number of groups constituting the blockmodel.

Example

using Graphs, BlockmodelUtils

g = erdos_renyi(20, 0.1)
gs = rand(['a', 'b'], 20)
bm = blockmodel(g, gs)

map(sum, bm) # number of edges in each block
source
BlockmodelUtils.blockmodelMethod
blockmodel(g, groups; by=identity)

Create a Blockmodel from Graphs.AbstractGraph g and vector of group memberships groups. The function passed to by used to order the groups in the blockmodel.

Example

using Graphs, BlockmodelUtils

g = erdos_renyi(20, 0.1)
gs = rand(['a', 'b'], 20)
bm = blockmodel(g, gs)
source
BlockmodelUtils.densityplotFunction
densityplot!(ax, bm)
densityplot(bm)

Plot the block density matrix as a heatmap.

Attributes

  • xticklabels = bm.labels
  • yticklabels = bm.labels
  • rotate_xlabels = false
  • kwargs... are passed to Makie.heatmap
source
BlockmodelUtils.densityplot!Function
densityplot!(ax, bm)
densityplot(bm)

Plot the block density matrix as a heatmap.

Attributes

  • xticklabels = bm.labels
  • yticklabels = bm.labels
  • rotate_xlabels = false
  • kwargs... are passed to Makie.heatmap
source
BlockmodelUtils.ei_indexMethod
ei_index(g, groups; level=:graph, mode=:both)

Compute Krackhardt's EI-index (Krackhardt & Stern 1988) for graph g and vector of group affiliations groups, defined as (E - I) / (E + I) for external (between group) edges E and internal (withing group) edges I.

Specify the level at wich to compute the index by setting the respective keyword to graph, group, or node. For directed g, specify the mode as both, in, or out. For level=graph, the three modes will be the same.

Example

using Graphs, BlockmodelUtils

g = erdos_renyi(20, 0.1);
gs = rand('a':'c', 20);
ei_index(g, gs; level=:group)
source
BlockmodelUtils.flowerplotFunction
flowerplot!(ax, bm)
flowerplot(bm)

Plot the network with nodes positioned in circles according to the blockmodel groups. The first group is placed in the center.

Attributes

  • edgecolor = :grey70
  • edgewidth = 1
  • nodecolor = :black
  • showlabels = true
  • radii = fill(1, length(bm.labels))
  • args... further arguments are passed to Makie.scatter
source
BlockmodelUtils.flowerplot!Function
flowerplot!(ax, bm)
flowerplot(bm)

Plot the network with nodes positioned in circles according to the blockmodel groups. The first group is placed in the center.

Attributes

  • edgecolor = :grey70
  • edgewidth = 1
  • nodecolor = :black
  • showlabels = true
  • radii = fill(1, length(bm.labels))
  • args... further arguments are passed to Makie.scatter
source
BlockmodelUtils.permuteplotFunction
permuteplot!(ax, bm)
permuteplot(bm)

Plot the permuted adjacency matrix with a grid outlining the blockmodel blocks.

Attributes

  • cellcolor = :black
  • linecolor = :black
  • framecolor = linecolor
  • rotate_xlabels = fale
  • xticklabels = bm.labels
  • yticklabels = bm.labels
source
BlockmodelUtils.permuteplot!Function
permuteplot!(ax, bm)
permuteplot(bm)

Plot the permuted adjacency matrix with a grid outlining the blockmodel blocks.

Attributes

  • cellcolor = :black
  • linecolor = :black
  • framecolor = linecolor
  • rotate_xlabels = fale
  • xticklabels = bm.labels
  • yticklabels = bm.labels
source
Graphs.densityMethod
density(bm::Blockmodel)

Compute the blockdensity matrix for Blockmodel bm. For diagonal blocks, the diagonal is subtracted from the number of possible edges.

source