Click or drag to resize
GraphGenerator Class
The GraphGenerator class provides static methods for creating various graphs, including Erdos-Renyi random graphs, random bipartite graphs, random k-regular graphs, and random rooted trees.
Inheritance Hierarchy
SystemObject
  Algs4NetGraphGenerator

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class GraphGenerator

The GraphGenerator type exposes the following members.

Methods
  NameDescription
Public methodStatic memberBinaryTree
Returns a complete binary tree graph on V vertices.
Public methodStatic memberBipartite(Int32, Int32, Double)
Returns a random simple bipartite graph on V1 and V2 vertices, containing each possible edge with probability p.
Public methodStatic memberBipartite(Int32, Int32, Int32)
Returns a random simple bipartite graph on V1 and V2 vertices with E edges.
Public methodStatic memberComplete
Returns the complete graph on V vertices.
Public methodStatic memberCompleteBipartite
Returns a complete bipartite graph on V1 and V2 vertices.
Public methodStatic memberCycle
Returns a cycle graph on V vertices.
Public methodStatic memberEulerianCycle
Returns an Eulerian cycle graph on V vertices.
Public methodStatic memberEulerianPath
Returns an Eulerian path graph on V vertices.
Public methodStatic memberMainTest
Demo test the GraphGenerator library.
Public methodStatic memberPath
Returns a path graph on V vertices.
Public methodStatic memberRegular
Returns a uniformly random k-regular graph on V vertices (not necessarily simple). The graph is simple with probability only about e^(-k^2/4), which is tiny when k = 14.
Public methodStatic memberSimple(Int32, Double)
Returns a random simple graph on V vertices, with an edge between any two vertices with probability p. This is sometimes referred to as the Erdos-Renyi random graph model.
Public methodStatic memberSimple(Int32, Int32)
Returns a random simple graph containing V vertices and E edges.
Public methodStatic memberStar
Returns a star graph on V vertices.
Public methodStatic memberTree
Returns a uniformly random tree on V vertices. This algorithm uses a Prufer sequence and takes time proportional to V log V.
Public methodStatic memberWheel
Returns a wheel graph on V vertices.
Top
Remarks

For additional documentation, see Section 4.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class GraphGenerator implementation by the respective authors.

See Also