Package edu.uci.ics.jung.graph.util
Class TestGraphs
- java.lang.Object
-
- edu.uci.ics.jung.graph.util.TestGraphs
-
public class TestGraphs extends java.lang.ObjectProvides generators for several different test graphs.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[][]pairsA series of pairs that may be useful for generating graphs.
-
Constructor Summary
Constructors Constructor Description TestGraphs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>createChainPlusIsolates(int chain_length, int isolate_count)Returns a graph consisting of a chain ofvertex_count - 1vertices plus one isolated vertex.static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>createDirectedAcyclicGraph(int layers, int maxNodesPerLayer, double linkprob)Creates a sample directed acyclic graph by generating several "layers", and connecting nodes (randomly) to nodes in earlier (but never later) layers.static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>createTestGraph(boolean directed)Creates a small sample graph that can be used for testing purposes.static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>getDemoGraph()Returns a bigger test graph with a clique, several components, and other parts.static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>getOneComponentGraph()Returns a bigger, undirected test graph with a just one component.static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number>getSmallGraph()Returns a small graph with directed and undirected edges, and parallel edges.
-
-
-
Method Detail
-
createTestGraph
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> createTestGraph(boolean directed)
Creates a small sample graph that can be used for testing purposes. The graph is as described in the section onpairs. IfisDirected, the graph is aDirectedSparseMultigraph, otherwise, it is anUndirectedSparseMultigraph.- Returns:
- a graph consisting of eight edges and ten nodes.
-
createChainPlusIsolates
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> createChainPlusIsolates(int chain_length, int isolate_count)Returns a graph consisting of a chain ofvertex_count - 1vertices plus one isolated vertex.
-
createDirectedAcyclicGraph
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> createDirectedAcyclicGraph(int layers, int maxNodesPerLayer, double linkprob)Creates a sample directed acyclic graph by generating several "layers", and connecting nodes (randomly) to nodes in earlier (but never later) layers. Each layer has some random number of nodes in it 1 less than n less than maxNodesPerLayer.- Returns:
- the created graph
-
getOneComponentGraph
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> getOneComponentGraph()
Returns a bigger, undirected test graph with a just one component. This graph consists of a clique of ten edges, a partial clique (randomly generated, with edges of 0.6 probability), and one series of edges running from the first node to the last.- Returns:
- the testgraph
-
getDemoGraph
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> getDemoGraph()
Returns a bigger test graph with a clique, several components, and other parts.- Returns:
- a demonstration graph of type UndirectedSparseMultigraph with 28 vertices.
-
getSmallGraph
public static edu.uci.ics.jung.graph.Graph<java.lang.String,java.lang.Number> getSmallGraph()
Returns a small graph with directed and undirected edges, and parallel edges.
-
-