org._3pq.jgrapht.generate

Class WheelGraphGenerator

Implemented Interfaces:
GraphGenerator

public class WheelGraphGenerator
extends java.lang.Object
implements GraphGenerator

Generates a wheel graph of any size. Reminding a bicycle wheel, a wheel graph has a hub vertex in the center and a rim of vertices around it that are connected to each other (as a ring). The rim vertices are also connected to the hub with edges that are called "spokes".
Author:
John V. Sichi
Since:
Sep 16, 2003

Field Summary

static String
HUB_VERTEX
Role for the hub vertex.

Constructor Summary

WheelGraphGenerator(int size)
Creates a new WheelGraphGenerator object.
WheelGraphGenerator(int size, boolean inwardSpokes)
Construct a new WheelGraphGenerator.

Method Summary

void
generateGraph(Graph target, VertexFactory vertexFactory, Map resultMap)

Field Details

HUB_VERTEX

public static final String HUB_VERTEX
Role for the hub vertex.

Constructor Details

WheelGraphGenerator

public WheelGraphGenerator(int size)
Creates a new WheelGraphGenerator object. This constructor is more suitable for undirected graphs, where spokes' direction is meaningless. In the directed case, spokes will be oriented from rim to hub.
Parameters:
size - number of vertices to be generated.

WheelGraphGenerator

public WheelGraphGenerator(int size,
                           boolean inwardSpokes)
Construct a new WheelGraphGenerator.
Parameters:
size - number of vertices to be generated.
inwardSpokes - if true and graph is directed, spokes are oriented from rim to hub; else from hub to rim.

Method Details

generateGraph

public void generateGraph(Graph target,
                          VertexFactory vertexFactory,
                          Map resultMap)
Specified by:
generateGraph in interface GraphGenerator