Check if the network is weighted

is_weighted(x)

Arguments

x

graph x of class network, igraph, matrix, or data.frame

Value

TRUE or FALSE

Details

This function checks if x is a weighted network.

For an x of class igraphor network, the function checks for the appropiate attribute in the graph x.

For a matrix the function returns TRUE if any of the elements is not or 1.

For a data.frame the function returns TRUE if it contains a numeric column called "weight", in addition to the first two columns of senders and receivers.