rg_w

This function creates a random network with random edge weights.

Options:

  • number of nodes, default = 100
  • number of arcs, default = 300
  • maximum edge weight, default = 10
  • directed networks, default = TRUE
  • seed (reproducible), default = FALSE
 

Example

To create a random graph with 10 nodes, 30 undirected arcs and a maximum edge weight of 5 (reproducible example with seed 1), write the following:

## Load tnet
library(tnet)
## Run programme
rg_w(nodes=10,arcs=30,max.weight=5,directed=FALSE,seed=1)
       i  j w
 [1,]  3  5 4
 [2,]  4  9 5
 [3,]  6  7 3
 [4,]  3  6 2
 [5,]  1  8 4
 [6,]  3  7 1
 [7,]  2  5 2
 [8,]  7  9 1
 [9,]  4  5 2
[10,]  4  6 4
[11,]  3 10 5
[12,]  3  4 4
[13,]  4  7 2
[14,]  1  3 2
[15,]  5  9 2
[16,]  5  3 4
[17,]  9  4 5
[18,]  7  6 3
[19,]  6  3 2
[20,]  8  1 4
[21,]  7  3 1
[22,]  5  2 2
[23,]  9  7 1
[24,]  5  4 2
[25,]  6  4 4
[26,] 10  3 5
[27,]  4  3 4
[28,]  7  4 2
[29,]  3  1 2
[30,]  9  5 2
Last Updated ( Sunday, 14 October 2007 )