Module Rand.Make
Random graphs
Parameters
B : Builder.INT
Signature
type graph
= B.G.t
type vertex
= B.G.V.t
type edge_label
= B.G.E.label
val graph : ?loops:bool -> v:int -> e:int -> unit -> graph
graph v e
generates a random graph with exactlyv
vertices ande
edges. Vertices are labeled with0
...v-1
. The booleanloops
indicates whether loops are allowed; default value is no loop (false
).- raises Invalid_argument
if
e
exceeds the maximal number of edges.
val labeled : (vertex -> vertex -> edge_label) -> ?loops:bool -> v:int -> e:int -> unit -> graph
labeled f
is similar tograph
except that edges are labeled using functionf
.- raises Invalid_argument
if there are too many edges.
val random_few_edges : loops:bool -> v:int -> e:int -> graph
val random_many_edges : loops:bool -> v:int -> e:int -> graph
val gnp : ?loops:bool -> v:int -> prob:float -> unit -> graph
random graph using the G(n,p) model.
gnp v prob
generates a random graph with exactlyv
vertices and where each edge is selected with probabilityprob
val gnp_labeled : (vertex -> vertex -> edge_label) -> ?loops:bool -> v:int -> prob:float -> unit -> graph
gnp_labeled add_edge v e
is similar tognp
except that edges are labeled using functionf
.