Network::random
-- generates a
random networkNetwork::random
generates a random network.
Network::random()
Network::random(In,D,Kn)
In |
- | list with two integers |
D |
- | real number between 0 and 1 |
Kn |
- | list with two integers |
A Network
Network::random
(In, D, Kn)
generates a
random network and returns a list [N, q, s]
where
N
is the network and q
and s
are
two nodes in N
.Network::random
are undirected,
i.e., if [s, q]
is an edge of the network, so is [q,
s]
.In = [a, b]
, then number of nodes K
in
N
is between a
and b
.D
specifies the density of N
, i.e. the
number of edges in N
is K^2 * D * 2.Kn = [a, b]
, the capacities of the edges in the
Network generated my Network::random
will be between
a
and b
, inclusive.Network::random
() =
Network::random
([5, 10], 0.5, [1, 10])
.Your results may differ in the following example.
>> N1 := Network::random(): Network::printGraph(N1[1])
Vertices: [1, 2, 3, 4, 5, 6, 7, 8] Edges: [[7, 2], [2, 7], [1, 3], [3, 1], [1, 2], [2, 1], [8, 4]\ , [4, 8], [6, 5], [5, 6], [4, 6], [6, 4], [7, 3], [3, 7], [6, \ 7], [7, 6], [8, 2], [2, 8], [4, 3], [3, 4], [3, 6], [6, 3], [7\ , 1], [1, 7], [6, 8], [8, 6], [5, 4], [4, 5], [2, 6], [6, 2], \ [1, 4], [4, 1]] Vertex weights: table(8=0,7=0,6=0,5=0,4=0,3=0,2=0,1=0) Edge capacities: table([2, 8]=1,[8, 2]=1,[3, 7]=10,[7, 3]=10,[\ 6, 4]=7,[4, 6]=7,[4, 5]=4,[5, 4]=4,[6, 3]=1,[3, 6]=1,[2, 7]=4,\ [7, 2]=4,[6, 2]=8,[2, 6]=8,[1, 7]=4,[7, 1]=4,[3, 4]=4,[4, 3]=4\ ,[4, 1]=6,[1, 4]=6,[3, 1]=6,[1, 3]=6,[2, 1]=10,[1, 2]=10,[8, 6\ ]=2,[6, 8]=2,[7, 6]=7,[6, 7]=7,[4, 8]=8,[8, 4]=8,[5, 6]=2,[6, \ 5]=2) Edge weights: table([2, 8]=1,[8, 2]=1,[3, 7]=1,[7, 3]=1,[6, 4]\ =1,[4, 6]=1,[4, 5]=1,[5, 4]=1,[6, 3]=1,[3, 6]=1,[2, 7]=1,[7, 2\ ]=1,[6, 2]=1,[2, 6]=1,[1, 7]=1,[7, 1]=1,[3, 4]=1,[4, 3]=1,[4, \ 1]=1,[1, 4]=1,[3, 1]=1,[1, 3]=1,[2, 1]=1,[1, 2]=1,[8, 6]=1,[6,\ 8]=1,[7, 6]=1,[6, 7]=1,[4, 8]=1,[8, 4]=1,[5, 6]=1,[6, 5]=1) Adjacency list (out): table(8=[4, 2, 6],7=[2, 3, 6, 1],6=[5, 4\ , 7, 3, 8, 2],5=[6, 4],4=[8, 6, 3, 5, 1],3=[1, 7, 4, 6],2=[7, \ 1, 8, 6],1=[3, 2, 7, 4]) Adjacency list (in): table(8=[4, 2, 6],7=[2, 3, 6, 1],6=[5, 4,\ 7, 3, 8, 2],5=[6, 4],4=[8, 6, 3, 5, 1],3=[1, 7, 4, 6],2=[7, 1\ , 8, 6],1=[3, 2, 7, 4])
Network::Random