Class RandomGraphFactory
Helpers related to graphs and randomness.
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms
Assembly: QuikGraph.dll
Syntax
public static class RandomGraphFactoryMethods
| Improve this Doc View SourceCreate<TVertex, TEdge>(IMutableUndirectedGraph<TVertex, TEdge>, VertexFactory<TVertex>, EdgeFactory<TVertex, TEdge>, Random, Int32, Int32, Boolean)
Fills the given graph with vertexCount vertices
and edgeCount edges created randomly between vertices (undirected graph).
Declaration
public static void Create<TVertex, TEdge>(IMutableUndirectedGraph<TVertex, TEdge> graph, VertexFactory<TVertex> vertexFactory, EdgeFactory<TVertex, TEdge> edgeFactory, Random rng, int vertexCount, int edgeCount, bool selfEdges)
    where TEdge : IEdge<TVertex>Parameters
| Type | Name | Description | 
|---|---|---|
| IMutableUndirectedGraph<TVertex, TEdge> | graph | Graph to fill. | 
| VertexFactory<TVertex> | vertexFactory | Vertex factory method. | 
| EdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. | 
| System.Random | rng | Random number generator. | 
| System.Int32 | vertexCount | Number of vertices to create. | 
| System.Int32 | edgeCount | Number of edges to create. | 
| System.Boolean | selfEdges | Indicates if self edge are allowed. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
Create<TVertex, TEdge>(IMutableVertexAndEdgeListGraph<TVertex, TEdge>, VertexFactory<TVertex>, EdgeFactory<TVertex, TEdge>, Random, Int32, Int32, Boolean)
Fills the given graph with vertexCount vertices
and edgeCount edges created randomly between vertices (directed graph).
Declaration
public static void Create<TVertex, TEdge>(IMutableVertexAndEdgeListGraph<TVertex, TEdge> graph, VertexFactory<TVertex> vertexFactory, EdgeFactory<TVertex, TEdge> edgeFactory, Random rng, int vertexCount, int edgeCount, bool selfEdges)
    where TEdge : IEdge<TVertex>Parameters
| Type | Name | Description | 
|---|---|---|
| IMutableVertexAndEdgeListGraph<TVertex, TEdge> | graph | Graph to fill. | 
| VertexFactory<TVertex> | vertexFactory | Vertex factory method. | 
| EdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. | 
| System.Random | rng | Random number generator. | 
| System.Int32 | vertexCount | Number of vertices to create. | 
| System.Int32 | edgeCount | Number of edges to create. | 
| System.Boolean | selfEdges | Indicates if self edge are allowed. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
GetEdge<TVertex, TEdge>(IEdgeSet<TVertex, TEdge>, Random)
Gets a random edge within the given graph.
Declaration
public static TEdge GetEdge<TVertex, TEdge>(IEdgeSet<TVertex, TEdge> graph, Random rng)
    where TEdge : IEdge<TVertex>Parameters
| Type | Name | Description | 
|---|---|---|
| IEdgeSet<TVertex, TEdge> | graph | The graph. | 
| System.Random | rng | Random number generator. | 
Returns
| Type | Description | 
|---|---|
| TEdge | Chosen vertex. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
GetEdge<TVertex, TEdge>(IEnumerable<TEdge>, Int32, Random)
Gets a random edge within the given set of edges.
Declaration
public static TEdge GetEdge<TVertex, TEdge>(IEnumerable<TEdge> edges, int count, Random rng)
    where TEdge : IEdge<TVertex>Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<TEdge> | edges | Set of edges. | 
| System.Int32 | count | Number of edges in the set. | 
| System.Random | rng | Random number generator. | 
Returns
| Type | Description | 
|---|---|
| TEdge | Chosen vertex. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
| System.InvalidOperationException | 
 | 
GetVertex<TVertex>(IVertexSet<TVertex>, Random)
Gets a random vertex within the given graph.
Declaration
public static TVertex GetVertex<TVertex>(IVertexSet<TVertex> graph, Random rng)Parameters
| Type | Name | Description | 
|---|---|---|
| IVertexSet<TVertex> | graph | The graph. | 
| System.Random | rng | Random number generator. | 
Returns
| Type | Description | 
|---|---|
| TVertex | Chosen vertex. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
GetVertex<TVertex>(IEnumerable<TVertex>, Int32, Random)
Gets a random vertex within the given set of vertices.
Declaration
public static TVertex GetVertex<TVertex>(IEnumerable<TVertex> vertices, int count, Random rng)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<TVertex> | vertices | Set of vertices. | 
| System.Int32 | count | Number of vertices in the set. | 
| System.Random | rng | Random number generator. | 
Returns
| Type | Description | 
|---|---|
| TVertex | Chosen vertex. | 
Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentOutOfRangeException | 
 | 
| System.InvalidOperationException | 
 |