MeasureNetworkInformation: Measure how much a network informs a particular network...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/MeasureNetworkInformation.R

Description

Given an igraph network, repeatedly perturb the graph and take some measure of the network to see how much the measure varies, then return a measure that increases as the precision of the function values increases.

Usage

1
2
3
  MeasureNetworkInformation(g, FUN = betweenness,
    remove.share = 0.2, sample.size = 100,
    progress.bar = FALSE)

Arguments

g

igraph, graph to measure

FUN

function, a function that takes an igraph and returns a value for each node in the network.

remove.share

numeric, fraction of the edges that are removed randomly when perturbing the network.

sample.size

numeric, number of perturbed graphs to generate

progress.bar

logical, if TRUE then a progress bar is shown.

Details

This function can vary tremendously based on the network measure being considered and the other parameters. It is only recommended that this be used for comparing the informativeness of two networks on the same set of nodes, keeping all the parameters the same.

Here information is measured as 1 / mean across and perturbed graphs nodes of the relative error of a network node measure.

Specifically, FUN is applied to the graph g to generate reference values. Some sample.size copies of the igraph are generated. For each, round(remove.share * n.edges) randomly selected edges are dropped to generate a perturbed graph. For each perturbed graph FUN is applied, generating a value for each node in the network. For each node the relative error

abs( (measure of perturbed g - measure of g) / measure of g )

is calculated, then the mean of these across nodes and perturbed graphs is calculated, generating a mean relative error for the network. This value is reciprocated to get a measure of precision.

This measure appears to be very sensitive to the choice of FUN.

Value

numeric, mean precision of the measure FUN across the network

Author(s)

Stephen R. Haptonstahl srh@haptonstahl.org

References

https://github.com/shaptonstahl/dils

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
g.rand <- random.graph.game(100, 5/100)
m.rand <- MeasureNetworkInformation(g.rand)
m.rand

pf <- matrix( c(.8, .2, .3, .7), nr=2)
g.pref <- preference.game(100, 2, pref.matrix=pf)
m.pref <- MeasureNetworkInformation(g.pref)
m.pref

m.pref / m.rand  # Relative informativeness of this preference graph
                 # to this random graph with respect to betweenness
## Not run: 
prob.of.link <- c(1:50)/100
mnis <- sapply(prob.of.link, function(p)
  MeasureNetworkInformation(random.graph.game(100, p)))
plot(prob.of.link, mnis,
     type="l",
     main="Network Information of random graphs",
     xlab="probability of link formation",
     ylab="information")
mtext("with respect to betweenness measure", line=0.5)
## End(Not run)

dils documentation built on May 2, 2019, 8:28 a.m.