Function Repository Resource:

# RandomWeightedGraph

Create a random weighted graph

Contributed by: Peter Burbery
 ResourceFunction["RandomWeightedGraph"][{v,e},randomfunction] generates a random graph with v vertices and e edges with edge weights given by randomfunction. ResourceFunction["RandomWeightedGraph"][graphdistribution,randomfunction] generates a random graph following graphdistribution. ResourceFunction["RandomWeightedGraph"][spec,randomfunction,k] generates k random graphs. ResourceFunction["RandomWeightedGraph"][spec,randomfunction,dims] generates an array with dimensions dims.

## Details

randomfunction should be based on RandomReal or RandomInteger, for example RandomReal[{1,7}]&.
The function accepts the same options as Graph.

## Examples

### Basic Examples (2)

Make a random graph:

 In[1]:=
 Out[1]=

Make a random graph with edge weights between 1 and 7:

 In[2]:=
 Out[2]=

### Scope (5)

Make a random graph with integer weights:

 In[3]:=
 Out[3]=

Make a list of random graphs:

 In[4]:=
 Out[4]=

Make an array of random graphs:

 In[5]:=
 Out[5]=

Make a random graph with a graph distribution:

 In[6]:=
 Out[6]=

Create a random weighted graph with integer weights with edge labels:

 In[7]:=
 Out[7]=

### Properties and Relations (3)

Create a random weighted graph:

 In[8]:=
 Out[8]=

Find a solution to the undirected Chinese Postman problem for this graph:

 In[9]:=
 Out[9]=

Make a table highlighting the steps by constructing directed graphs:

 In[10]:=
 Out[11]=

Peter Burbery

## Version History

• 1.0.0 – 01 August 2022