Check if the network is bipartite

is_bipartite(x)

Arguments

x

graph x of class network or igraph

Value

TRUE or FALSE

Details

This function simply checks if x is a bipartite network. This is only possible by checking whether the bipartite attributes are set in the x. Hence, if the network is bipartite, but the researcher neglected to include this information in the graph x, the result of this functions will be FALSE. Of course, this is how it should be: neglecting to include the bipartite attribute in the x is bad practice.

Examples

net <- igraph::sample_bipartite(10, 5, p =.1)
is_bipartite(net)  # TRUE
#> [1] TRUE

net <- igraph::erdos.renyi.game(10, p.or.m = .1, type = "gnp")
is_bipartite(net)  # FALSE
#> [1] FALSE

mat <- sna::rgraph(10, m = 1, tprob = .1)
net <- network::as.network.matrix(mat)
is_bipartite(net)  # FALSE
#> [1] FALSE