BernoulliGraphDistribution[n,p]
表示关于边概率为 p 的 具有 n 个顶点的图的伯努利图分布.
BernoulliGraphDistribution
BernoulliGraphDistribution[n,p]
表示关于边概率为 p 的 具有 n 个顶点的图的伯努利图分布.
更多信息和选项
- 伯努利图的构建方法如下:首先从具有 n 个顶点的完全图开始,通过概率为 p 的独立伯努利试验选择每条边.
- 可以给出下列选项:
-
DirectedEdges False 是否生成有向边 - BernoulliGraphDistribution 可以与诸如 RandomGraph 和 GraphPropertyDistribution 等函数一起使用.
范例
打开所有单元 关闭所有单元基本范例 (2)
RandomGraph[BernoulliGraphDistribution[10, 0.6]]𝒟[n_, p_] = GraphPropertyDistribution[EdgeCount[g], gBernoulliGraphDistribution[n, p]]PDF[𝒟[n, p], m]DiscretePlot[Evaluate @ Table[PDF[𝒟[n, 1 / 2], m], {n, 3, 12, 3}], {m, 0, 50}, PlotRange -> All, ExtentSize -> 1 / 2]范围 (4)
RandomGraph[BernoulliGraphDistribution[5, 0.6]]RandomGraph[BernoulliGraphDistribution[5, 0.6, DirectedEdges -> True]]RandomGraph[BernoulliGraphDistribution[5, 0.8], 4]𝒟 = GraphPropertyDistribution[GlobalClusteringCoefficient[g], gBernoulliGraphDistribution[5, 0.4]];N[Mean[𝒟]]选项 (2)
DirectedEdges (2)
RandomGraph[BernoulliGraphDistribution[10, 0.3]]UndirectedGraphQ[%]设置 DirectedEdges->True,生成有向伯努利图:
RandomGraph[BernoulliGraphDistribution[10, 0.3, DirectedEdges -> True]]DirectedGraphQ[%]应用 (3)
20个孩子在幼儿园度过第一周之后,两个孩子成为朋友的概率是 0.2:
𝒢 = BernoulliGraphDistribution[20, 0.2];RandomGraph[𝒢]NProbability[x == 1, xGraphPropertyDistribution[Boole[ConnectedGraphQ[g]], g𝒢]]在一次有 15 个人参与的雪战中,每个人向其他所有人投掷雪球,被其他参与者投中的概率是0.4:
𝒢 = BernoulliGraphDistribution[15, 0.4, DirectedEdges -> True];RandomGraph[𝒢]Length[First[FindClique[%]]]𝒟[n_, β_] := GraphPropertyDistribution[Length[First[ConnectedComponents[g]]] / n, gBernoulliGraphDistribution[n, β / (n - 1)]]Table[RandomVariate[𝒟[10, β]], {β, 0, 3}]在100次运行中求结果的平均值,并且为其绘制对应不同顶点数的曲线:
Table[Plot[Mean[RandomVariate[𝒟[10, β], 100]], {β, 0, 3}, MaxRecursion -> 2, PlotLabel -> n], {n, {10, 100}}]属性和关系 (6)
GraphPropertyDistribution[VertexCount[g], gBernoulliGraphDistribution[n, p]]𝒟[n_, p_] = GraphPropertyDistribution[EdgeCount[g], gBernoulliGraphDistribution[n, p]]PDF[𝒟[n, p], m]DiscretePlot[Evaluate @ Table[PDF[𝒟[n, 0.4], x], {n, 3, 12, 3}], {x, 0, 40}, PlotRange -> All, ExtentSize -> 1 / 2]Mean[𝒟[n, p]]𝒟[n_, p_] = GraphPropertyDistribution[VertexDegree[g, v], gBernoulliGraphDistribution[n, p]]PDF[𝒟[n, p], k]DiscretePlot[Evaluate @ Table[PDF[𝒟[n, 0.3], x], {n, 5, 50, 15}], {x, 0, 25}, PlotRange -> All, ExtentSize -> 1 / 2]Mean[𝒟[n, p]]𝒟[n_, p_] := GraphPropertyDistribution[Boole[ConnectedGraphQ[g]], gBernoulliGraphDistribution[n, p]]NProbability[x == 0, x𝒟[500, 0.01], Method -> {"MonteCarlo", PrecisionGoal -> 1}]NProbability[x == 1, x𝒟[500, 0.02], Method -> {"MonteCarlo", PrecisionGoal -> 1}]使用 BernoulliDistribution 来模拟 BernoulliGraphDistribution:
bernoulli[n_, p_] :=
Graph[Range[n], Pick[EdgeList[CompleteGraph[n]],
RandomVariate[BernoulliDistribution[p], n(n - 1) / 2], 1]]Table[bernoulli[10, p], {p, 0.3, 1, 0.2}]边概率 1 产生 CompleteGraph:
RandomGraph[BernoulliGraphDistribution[5, 1]]CompleteGraphQ[%]RandomGraph[BernoulliGraphDistribution[5, 0]]EmptyGraphQ[%]文本
Wolfram Research (2010),BernoulliGraphDistribution,Wolfram 语言函数,https://reference.wolfram.com/language/ref/BernoulliGraphDistribution.html.
CMS
Wolfram 语言. 2010. "BernoulliGraphDistribution." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/BernoulliGraphDistribution.html.
APA
Wolfram 语言. (2010). BernoulliGraphDistribution. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/BernoulliGraphDistribution.html 年
BibTeX
@misc{reference.wolfram_2026_bernoulligraphdistribution, author="Wolfram Research", title="{BernoulliGraphDistribution}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/BernoulliGraphDistribution.html}", note=[Accessed: 19-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_bernoulligraphdistribution, organization={Wolfram Research}, title={BernoulliGraphDistribution}, year={2010}, url={https://reference.wolfram.com/language/ref/BernoulliGraphDistribution.html}, note=[Accessed: 19-August-2026]}