Package org.jungrapht.samples.util
Class TestGuavaNetworks
- java.lang.Object
-
- org.jungrapht.samples.util.TestGuavaNetworks
-
public class TestGuavaNetworks extends Object
Provides generators for several different test graphs.
-
-
Constructor Summary
Constructors Constructor Description TestGuavaNetworks()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.common.graph.MutableNetwork<String,Integer>createChainPlusIsolates(int chain_length, int isolate_count)static com.google.common.graph.MutableNetwork<String,Integer>createDirectedAcyclicNetwork(int layers, int maxVerticesPerLayer, double linkprob)Creates a sample directed acyclic graph by generating several "layers", and connecting vertices (randomly) to vertices in earlier (but never later) layers.static com.google.common.graph.MutableNetwork<String,Integer>createSmallNetwork(boolean directed)static com.google.common.graph.MutableNetwork<String,Integer>createTestNetwork(boolean directed)Creates a small sample network that can be used for testing purposes.static com.google.common.graph.MutableNetwork<String,Integer>getDemoNetwork()Returns a bigger test graph with a clique, several components, and other parts.static com.google.common.graph.MutableNetwork<String,Integer>getGeneratedNetwork()static com.google.common.graph.MutableNetwork<String,Integer>getOneComponentNetwork()Returns a bigger, undirected test network with a just one component.
-
-
-
Field Detail
-
pairs
public static String[][] pairs
A series of pairs that may be useful for generating graphs. The miniature graph consists of 8 edges, 10 vertices, and is formed of two connected components, one of 8 vertices, the other of 2.
-
-
Method Detail
-
createTestNetwork
public static com.google.common.graph.MutableNetwork<String,Integer> createTestNetwork(boolean directed)
Creates a small sample network that can be used for testing purposes. The network is as described in the section onpairs.- Parameters:
directed- true iff the network created is to have directed edges- Returns:
- a network consisting of eight edges and ten vertices.
-
createChainPlusIsolates
public static com.google.common.graph.MutableNetwork<String,Integer> createChainPlusIsolates(int chain_length, int isolate_count)
- Parameters:
chain_length- the length of the chain of vertices to add to the returned graphisolate_count- the number of isolated vertices to add to the returned graph- Returns:
- a network consisting of a chain of
chain_lengthvertices andisolate_countisolated vertices.
-
createDirectedAcyclicNetwork
public static com.google.common.graph.MutableNetwork<String,Integer> createDirectedAcyclicNetwork(int layers, int maxVerticesPerLayer, double linkprob)
Creates a sample directed acyclic graph by generating several "layers", and connecting vertices (randomly) to vertices in earlier (but never later) layers. The number of vertices in each layer is a random value in the range [1, maxVerticesPerLayer].- Parameters:
layers- the number of layers of vertices to create in the graphmaxVerticesPerLayer- the maximum number of vertices to put in any layerlinkprob- the probability that this method will add an edge from a vertex in layer k to a vertex in layer k+1- Returns:
- the created graph
-
getOneComponentNetwork
public static com.google.common.graph.MutableNetwork<String,Integer> getOneComponentNetwork()
Returns a bigger, undirected test network with a just one component. This network 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 vertex to the last.- Returns:
- the testgraph
-
getDemoNetwork
public static com.google.common.graph.MutableNetwork<String,Integer> getDemoNetwork()
Returns a bigger test graph with a clique, several components, and other parts.- Returns:
- a demonstration graph of type UndirectedSparseMultiGraph with 28 vertices.
-
createSmallNetwork
public static com.google.common.graph.MutableNetwork<String,Integer> createSmallNetwork(boolean directed)
-
-