({{, (RefLink[UniformGraphDistribution, paclet:ref/UniformGraphDistribution])[n,m] 
represents a uniform graph distribution on n-vertex, m-edge graphs.}})

OpenersNotesSection(Spacer1)Details and Options

The sample space is all simple graphs on n vertices and m edges.

The following options can be given:

(RefLink[UniformGraphDistribution, paclet:ref/UniformGraphDistribution]) can be used with such functions as (RefLink[RandomGraph, paclet:ref/RandomGraph]) and (RefLink[GraphPropertyDistribution, paclet:ref/GraphPropertyDistribution]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (15)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Generate a pseudorandom graph:

RandomGraph[UniformGraphDistribution[5,6]]

Probability density functions of the degree of a vertex:

𝒟[n_,m_]:=GraphPropertyDistribution[VertexDegree[g,v],g\[Distributed]UniformGraphDistribution[n,m]]

DiscretePlot[Evaluate @ Table[PDF[𝒟[40,m],x],{m,10,780,152}],{x,0,40},PlotRange->All,ExtentSize->1/2]

OpenersExampleSection1(Spacer1)Scope  (4)

Generate simple undirected graphs:

RandomGraph[UniformGraphDistribution[5,6]]

Simple directed graphs:

RandomGraph[UniformGraphDistribution[5,6,DirectedEdges->True]]

Generate a set of pseudorandom graphs:

RandomGraph[UniformGraphDistribution[5,7],4]

Compute probabilities and statistical properties:

𝒟=GraphPropertyDistribution[VertexDegree[g,1],g\[Distributed]UniformGraphDistribution[5,7]];

Expectation[x^2,x\[Distributed]𝒟]

OpenersExampleSection2(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)DirectedEdges  (2)

By default, undirected graphs are generated:

RandomGraph[UniformGraphDistribution[10,20]]

UndirectedGraphQ[%]

Use (RefLink[DirectedEdges, paclet:ref/DirectedEdges])->(RefLink[True, paclet:ref/True]) to generate directed graphs:

RandomGraph[UniformGraphDistribution[10,20,DirectedEdges->True]]

DirectedGraphQ[%]

OpenersExampleSection3(Spacer1)Applications  (2)

On a duet night at the karaoke club, 85 songs are performed by 40 guests selected randomly. Find the expected number of people who sang at least 3 songs:

𝒢=UniformGraphDistribution[40,85];

f[g_]:=Count[VertexDegree[g],d_/;d≥  3]

NExpectation[x,x\[Distributed]GraphPropertyDistribution[f[g],g\[Distributed]𝒢]]

Find the largest component fraction when the mean vertex degree is approximately β:

𝒟[n_,β_]:=GraphPropertyDistribution[Length[First[ConnectedComponents[g]]]/n,g\[Distributed]UniformGraphDistribution[n,⌈β n/2⌉]]

Table[RandomVariate[𝒟[10,β]],{β,0,3}]

Average the result over 100 runs and plot it for different numbers of vertices:

Table[Plot[Mean[RandomVariate[𝒟[n,β],100]],{β,0,3},MaxRecursion->2,PlotLabel->n],{n,{10,100}}]

OpenersExampleSection4(Spacer1)Properties & Relations  (4)

Distribution of the number of vertices:

𝒟[n_,m_]=GraphPropertyDistribution[VertexCount[g],g\[Distributed]UniformGraphDistribution[n,m]]

Distribution of the number of edges:

𝒟[n_,m_]=GraphPropertyDistribution[EdgeCount[g],g\[Distributed]UniformGraphDistribution[n,m]]

Distribution of the degree of a vertex:

𝒟[n_,m_]=GraphPropertyDistribution[VertexDegree[g,v],g\[Distributed]UniformGraphDistribution[n,m]]

Probability density function:

DiscretePlot[Evaluate @ Table[PDF[𝒟[40,m],x],{m,10,780,152}],{x,0,40},PlotRange->All,ExtentSize->1/2]

The mean vertex degree is 2m/n:

Mean[𝒟[10,30]]==2 30/10

Use (RefLink[RandomSample, paclet:ref/RandomSample]) to simulate a (RefLink[UniformGraphDistribution, paclet:ref/UniformGraphDistribution]):

uniform[n_,m_]:=
Graph[Range[n],RandomSample[EdgeList[CompleteGraph[n]],m]]

uniform[7,10]

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Randomly colored vertices:

HighlightGraph[RandomGraph[UniformGraphDistribution[10^2,250]],Table[Style[i,RandomChoice[ColorData[45,"ColorList"]]],{i,10^2}]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BernoulliGraphDistribution, paclet:ref/BernoulliGraphDistribution])  ▪  (RefLink[BarabasiAlbertGraphDistribution, paclet:ref/BarabasiAlbertGraphDistribution])  ▪  (RefLink[PriceGraphDistribution, paclet:ref/PriceGraphDistribution])  ▪  (RefLink[DegreeGraphDistribution, paclet:ref/DegreeGraphDistribution])  ▪  (RefLink[WattsStrogatzGraphDistribution, paclet:ref/WattsStrogatzGraphDistribution])  ▪  (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution])  ▪  (RefLink[PoissonDistribution, paclet:ref/PoissonDistribution])  ▪  (RefLink[SeedRandom, paclet:ref/SeedRandom])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Construction & Representation, paclet:guide/GraphConstructionAndRepresentation])}, {▪(RefLinkPlain[Random Graphs, paclet:guide/RandomGraphs])}})}})