Function creates a mixing matrix by graph vertex attribute.

mixmat(g, attrib, use_density = TRUE)

Arguments

g

igraph graph object.

attrib

Character string. Vertex attribute or category.

use_density

Logical. Use edge density. Default is TRUE.

Value

A mixing matrix.

Note

Mixing matrix original function written by Gary Weissman. See: https://gist.github.com/gweissman/2402741.

Examples

if (FALSE) {
# create a mixing matrix of the demonstration network based on vertex 
# categorical attribute for political stance "vosonCA_Stance"
g <- loadPackageGraph("DividedTheyBlog_40Alist_release.graphml")

mm <- mixmat(g, "vosonCA_Stance", use_density = FALSE)
}