|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Functor to build a 2D grid graph with 8-connectivity. More...
#include <grid.H>
Public Member Functions | |
| void | operator() (GT &g, const size_t &width, const size_t &height) |
| Build a grid graph. | |
Functor to build a 2D grid graph with 8-connectivity.
Creates a rectangular grid of nodes where each node is connected to all its neighbors: left, right, up, down, and all four diagonals.
| GT | Graph type (e.g., List_Graph, Array_Graph) |
| Operation_On_Node | Callback for node initialization |
| Operation_On_Arc | Callback for arc initialization |
| Position | Connections |
|---|---|
| Corner | 3 |
| Edge | 5 |
| Interior | 8 |
|
inline |
Build a grid graph.
Creates a width × height grid of nodes with 8-connectivity.
| g | Graph to populate (must be empty) |
| width | Number of columns (≥ 2) |
| height | Number of rows (≥ 2) |
| std::domain_error | if graph is not empty |
| std::length_error | if width or height < 2 |
Definition at line 182 of file grid.H.
References ah_domain_error_if, ah_length_error_if, Aleph::clear_graph(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and Aleph::maps().