com.kuka.graph.generate
Class GridGraphGenerator<N,E>

java.lang.Object
  extended by com.kuka.graph.generate.GridGraphGenerator<N,E>
Type Parameters:
N - the type of the nodes.
E - the type of the edges.

public final class GridGraphGenerator<N,E>
extends Object

Generates a grid graph where every node is connected to each of its neighbouring nodes in the grid.


Nested Class Summary
static class GridGraphGenerator.Coordinate
          Represents the coordinate of a node in the grid graph, i.e. the row and column of the node.
 
Constructor Summary
GridGraphGenerator(Graph<N,E> graph, int rows, int cols)
          Constructor.
 
Method Summary
 GridGraphGenerator.Coordinate getCoord(N node)
          Returns the coordinate of the given node in the grid graph, i.e. the row and column of the node.
 N getNode(int i, int j)
          Get the node that has the given coordinates in the grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridGraphGenerator

public GridGraphGenerator(Graph<N,E> graph,
                          int rows,
                          int cols)
Constructor.

Parameters:
graph - the graph for which a grid graph shall be created.
rows - the number of rows in the grid.
cols - the number of columns in the grid.
Method Detail

getNode

public N getNode(int i,
                 int j)
Get the node that has the given coordinates in the grid.

Parameters:
i - the first coordinate.
j - the second coordinate.
Returns:
the node.

getCoord

public GridGraphGenerator.Coordinate getCoord(N node)
Returns the coordinate of the given node in the grid graph, i.e. the row and column of the node.

Parameters:
node - the node for which to return the coordinates
Returns:
the coordinates of the given node


Copyright © 2019. All rights reserved.