Random Edge Graph
A function to create random graphs according to a random edge model.
The user supplies the set of nodes for the graph as
either a probability,
p, that is used for each edge or the
number of edges,
edges they want to have in the resulting graph.
randomEGraph(V, p, edges)
- The nodes for the graph.
- The probability of an edge being selected.
- The number of edges wanted.
The user must specify the set of nodes and either a probability for
edge selection or the number of edges wanted, but not both.
nV denote the
number of nodes. There are
choose(nV, 2) edges in the complete
p is specified then a biased coin (probability of
p) is tossed for each edge and if it is heads that
edge is selected. If
edges is specified then that many edges
are sampled without replacement from the set of possible edges.
An object of class
graphNEL-classthat contains the nodes and edges.
set.seed(123) V <- letters[14:22] g1 <- randomEGraph(V, .2) g2 <- randomEGraph(V, edges=30)