Random Graph Layout Method
Options
Description
Examples
distribution=function
This option can take any value understood by the RandomTools distribution generator. See RandomTools/flavor/distribution. This method will generate n+n1d points and check if there were n unique points generated. If not, it will try again. If both distribution and generator options are given, only generator will be used.
generator=function
This option can take a custom procedure that generates points (as lists) of the appropriate dimension. This method will generate n+n1d points and check if there were n unique points generated. If not, it will try again. If both distribution and generator options are given, only generator will be used.
seed=posint
Specify a seed to send to randomize before generating the random points.
The random layout method uses RandomTools:-Generate to generate random positions for the vertices of the graph. By default, this method randomly populates a 2⁢n1dd grid with the graph vertices (with an additional small random perturbation added to reduce the likelihood of overlapping edges).
This layout method works in two and three dimensions.
with⁡GraphTheory:
with⁡SpecialGraphs:
G≔Graph⁡undirected,1,2,1,4,2,3,3,4
G≔Graph 1: an undirected graph with 4 vertices and 4 edge(s)
DrawGraph⁡G,layout=random
DrawGraph⁡G,layout=random,layoutoptions=distribution=Normal⁡0,0.5
A custom procedure to create random points can also be used
R≔RandomTools:-Generate⁡list⁡distribution⁡Uniform⁡−0.97,0.97,2,makeproc:
DrawGraph⁡G,layout=random,layoutoptions=generator=R
H≔HypercubeGraph⁡3
H≔Graph 2: an undirected graph with 8 vertices and 12 edge(s)
DrawGraph⁡H,layout=random,dimension=3
See Also
GraphTheory[DrawGraph]
Download Help Document