edu.uci.ics.jung.algorithms.generators
Class Lattice2DGenerator<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.generators.Lattice2DGenerator<V,E>
-
- All Implemented Interfaces:
- com.google.common.base.Supplier<Graph<V,E>>, GraphGenerator<V,E>
- Direct Known Subclasses:
- KleinbergSmallWorldGenerator
public class Lattice2DGenerator<V,E> extends java.lang.Object implements GraphGenerator<V,E>
Simple generator of an m x n lattice where each vertex is incident with each of its neighbors (to the left, right, up, and down). May be toroidal, in which case the vertices on the edges are connected to their counterparts on the opposite edges as well.If the graph Supplier supplied has a default edge type of
EdgeType.DIRECTED, then edges will be created in both directions between adjacent vertices.
-
-
Constructor Summary
Constructors Constructor and Description Lattice2DGenerator(com.google.common.base.Supplier<? extends Graph<V,E>> graph_factory, com.google.common.base.Supplier<V> vertex_factory, com.google.common.base.Supplier<E> edge_factory, int latticeSize, boolean isToroidal)Constructs a generator of square lattices of sizelatticeSizewith the specified parameters.Lattice2DGenerator(com.google.common.base.Supplier<? extends Graph<V,E>> graph_factory, com.google.common.base.Supplier<V> vertex_factory, com.google.common.base.Supplier<E> edge_factory, int row_count, int col_count, boolean isToroidal)Creates a generator ofrow_countxcol_countlattices with the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Graph<V,E>get()Generates a graph based on the constructor-specified settings.intgetGridEdgeCount()Returns the number of edges found in a lattice of this generator's specifications.
-
-
-
Constructor Detail
-
Lattice2DGenerator
public Lattice2DGenerator(com.google.common.base.Supplier<? extends Graph<V,E>> graph_factory, com.google.common.base.Supplier<V> vertex_factory, com.google.common.base.Supplier<E> edge_factory, int latticeSize, boolean isToroidal)
Constructs a generator of square lattices of sizelatticeSizewith the specified parameters.- Parameters:
graph_factory- used to create theGraphfor the latticevertex_factory- used to create the lattice verticesedge_factory- used to create the lattice edgeslatticeSize- the number of rows and columns of the latticeisToroidal- if true, the created lattice wraps from top to bottom and left to right
-
Lattice2DGenerator
public Lattice2DGenerator(com.google.common.base.Supplier<? extends Graph<V,E>> graph_factory, com.google.common.base.Supplier<V> vertex_factory, com.google.common.base.Supplier<E> edge_factory, int row_count, int col_count, boolean isToroidal)
Creates a generator ofrow_countxcol_countlattices with the specified parameters.- Parameters:
graph_factory- used to create theGraphfor the latticevertex_factory- used to create the lattice verticesedge_factory- used to create the lattice edgesrow_count- the number of rows in the latticecol_count- the number of columns in the latticeisToroidal- if true, the created lattice wraps from top to bottom and left to right
-
-
Method Detail
-
getGridEdgeCount
public int getGridEdgeCount()
Returns the number of edges found in a lattice of this generator's specifications. (This is useful for subclasses that may modify the generated graphs to add more edges.)- Returns:
- the number of edges that this generator will generate
-
-
DataMelt 3.0 © DataMelt by jWork.ORG