@@ -251,45 +251,47 @@ static igraph_error_t triangular_lattice_hex_shape(
251251 *
252252 * \experimental
253253 *
254- * Creates a triangular lattice whose vertices have the form (i, j) for non-negative integers i and j
255- * and (i, j) is generally connected with (i + 1, j), (i, j + 1), and (i - 1, j + 1).
256- * The function constructs a planar dual of the graph constructed by \ref igraph_hexagonal_lattice().
257- * In particular, there a one-to-one correspondence between the vertices in the constructed graph
258- * and the cycles of length 6 in the graph constructed by \ref igraph_hexagonal_lattice()
254+ * Creates a triangular lattice whose vertices have the form (i, j) for non-negative
255+ * integers i and j and (i, j) is generally connected with (i + 1, j), (i, j + 1),
256+ * and (i - 1, j + 1). The function constructs a planar dual of the graph
257+ * constructed by \ref igraph_hexagonal_lattice(). In particular, there a one-to-one
258+ * correspondence between the vertices in the constructed graph and the cycles of
259+ * length 6 in the graph constructed by \ref igraph_hexagonal_lattice()
259260 * with the same \p dims parameter.
260261 *
261262 * </para><para>
262- * The vertices of the resulting graph are ordered lexicographically with the 2nd coordinate being
263- * more significant, e.g., (i, j) < (i + 1, j) and (i + 1, j) < (i, j + 1)
263+ * The vertices of the resulting graph are ordered lexicographically with the 2nd
264+ * coordinate being more significant, e.g., (i, j) < (i + 1, j) and
265+ * (i + 1, j) < (i, j + 1)
264266 *
265267 * \param graph An uninitialized graph object.
266- * \param dims Integer vector, defines the shape of the lattice. (Below the "edge length"s are in terms of graph theoretical path lengths.)
267- * If \p dims is of length 1, the resulting lattice has a triangular shape
268- * where each side of the triangle contains <code>dims[0]</code> vertices.
269- * If \p dims is of length 2, the resulting lattice has a
270- * "quasi rectangular" shape with the sides containing <code>dims[0]</code> and
271- * <code>dims[1]</code> vertices, respectively.
272- * If \p dims is of length 3, the resulting lattice has a hexagonal shape
273- * where the sides of the hexagon contain <code>dims[0]</code>, <code>dims[1]</code> and
274- * <code>dims[2]</code> vertices.
275- * All coordinates must be non-negative.
268+ * \param dims Integer vector, defines the shape of the lattice.
269+ * If \p dims is of length 1, the resulting lattice has a triangular shape
270+ * where each side of the triangle contains <code>dims[0]</code> vertices.
271+ * If \p dims is of length 2, the resulting lattice has a
272+ * "quasi rectangular" shape with the sides containing <code>dims[0]</code> and
273+ * <code>dims[1]</code> vertices, respectively.
274+ * If \p dims is of length 3, the resulting lattice has a hexagonal shape
275+ * where the sides of the hexagon contain <code>dims[0]</code>, <code>dims[1]</code>
276+ * and <code>dims[2]</code> vertices. All dimensions must be non-negative.
276277 * \param directed Boolean, whether to create a directed graph.
277- * If the \c mutual argument is not set to true,
278- * edges will be directed from lower-index vertices towards
279- * higher-index ones.
278+ * If the \c mutual argument is not set to true, edges will be directed from
279+ * lower-index vertices towards higher-index ones.
280280 * \param mutual Boolean, if the graph is directed this gives whether
281- * to create all connections as mutual.
281+ * to create all connections as mutual.
282282 * \return Error code:
283- * \c IGRAPH_EINVAL: The size of \p dims must be either 1, 2, or 3 with all the components
284- * at least 1.
285- * \sa \ref igraph_hexagonal_lattice() for creating a triangular lattice.
283+ * \c IGRAPH_EINVAL: The size of \p dims must be either 1, 2, or 3 with all
284+ * the components at least 1.
285+ *
286+ * \sa \ref igraph_hexagonal_lattice() and \ref igraph_square_lattice() for creating
287+ * other types of lattices; \ref igraph_regular_tree() to create a Bethe lattice.
286288 *
287289 * Time complexity: O(|V|), where |V| is the number of vertices in the generated graph.
288290 *
289291 */
290292igraph_error_t igraph_triangular_lattice (
291- igraph_t * graph , const igraph_vector_int_t * dims , igraph_bool_t directed ,
292- igraph_bool_t mutual ) {
293+ igraph_t * graph , const igraph_vector_int_t * dims ,
294+ igraph_bool_t directed , igraph_bool_t mutual ) {
293295 igraph_integer_t num_dims = igraph_vector_int_size (dims );
294296 if (igraph_vector_int_any_smaller (dims , 0 )) {
295297 IGRAPH_ERROR ("Invalid dimension vector." , IGRAPH_EINVAL );
@@ -534,46 +536,46 @@ static igraph_error_t hexagonal_lattice_hex_shape(
534536 *
535537 * \experimental
536538 *
537- * Creates a hexagonal lattice whose vertices have the form (i, j) for non-negative integers i and j
538- * and (i, j) is generally connected with (i + 1, j), and if i is odd also with (i - 1, j + 1).
539- * The function constructs a planar dual of the graph constructed by \ref igraph_triangular_lattice().
540- * In particular, there a one-to-one correspondence between the cycles of length 6 in the constructed graph
541- * and the vertices of the graph constructed by \ref igraph_triangular_lattice() function
539+ * Creates a hexagonal lattice whose vertices have the form (i, j) for non-negative
540+ * integers i and j and (i, j) is generally connected with (i + 1, j), and if i is
541+ * odd also with (i - 1, j + 1). The function constructs a planar dual of the graph
542+ * constructed by \ref igraph_triangular_lattice(). In particular, there a one-to-one
543+ * correspondence between the cycles of length 6 in the constructed graph and the
544+ * vertices of the graph constructed by \ref igraph_triangular_lattice() function
542545 * with the same \p dims parameter.
543546 *
544547 * </para><para>
545- * The vertices of the resulting graph are ordered lexicographically with the 2nd coordinate being
546- * more significant, e.g., (i, j) < (i + 1, j) and (i + 1, j) < (i, j + 1)
548+ * The vertices of the resulting graph are ordered lexicographically with the 2nd
549+ * coordinate being more significant, e.g., (i, j) < (i + 1, j) and
550+ * (i + 1, j) < (i, j + 1)
547551 *
548552 * \param graph An uninitialized graph object.
549- * \param dims Integer vector, defines the shape of the lattice. (Below the "edge length"s are in terms of graph theoretical path lengths.)
550- * If \p dims is of length 1, the resulting lattice has a triangular shape
551- * where each side of the triangle contains <code>dims[0]</code> vertices.
552- * If \p dims is of length 2, the resulting lattice has a
553- * "quasi rectangular" shape with the sides containing <code>dims[0]</code> and
554- * <code>dims[1]</code> vertices, respectively.
555- * If \p dims is of length 3, the resulting lattice has a hexagonal shape
556- * where the sides of the hexagon contain <code>dims[0]</code>, <code>dims[1]</code> and
557- * <code>dims[2]</code> vertices.
558- * All coordinates must be non-negative.
553+ * \param dims Integer vector, defines the shape of the lattice.
554+ * If \p dims is of length 1, the resulting lattice has a triangular shape
555+ * where each side of the triangle contains <code>dims[0]</code> vertices.
556+ * If \p dims is of length 2, the resulting lattice has a "quasi rectangular"
557+ * shape with the sides containing <code>dims[0]</code> and <code>dims[1]</code>
558+ * vertices, respectively. If \p dims is of length 3, the resulting lattice has
559+ * a hexagonal shape where the sides of the hexagon contain <code>dims[0]</code>,
560+ * <code>dims[1]</code> and <code>dims[2]</code> vertices. All coordinates must
561+ * be non-negative.
559562 * \param directed Boolean, whether to create a directed graph.
560- * If the \c mutual argument is not set to true,
561- * edges will be directed from lower-index vertices towards
562- * higher-index ones.
563- * \param mutual Boolean, if the graph is directed this gives whether
564- * to create all connections as mutual.
563+ * If the \c mutual argument is not set to true, edges will be directed from
564+ * lower-index vertices towards higher-index ones.
565+ * \param mutual Boolean, if the graph is directed this gives whether to create
566+ * all connections as mutual.
565567 * \return Error code:
566- * \c IGRAPH_EINVAL: The size of \p dims must be either 1, 2, or 3 with all the components
567- * at least 1.
568- * \sa \ref igraph_triangular_lattice() for creating a triangular lattice.
568+ * \c IGRAPH_EINVAL: The size of \p dims must be either 1, 2, or 3 with all
569+ * the components at least 1.
569570 *
570- * Time complexity: O(|V|), where |V| is the number of vertices in the generated graph.
571+ * \sa \ref igraph_triangular_lattice() and \ref igraph_square_lattice() for creating
572+ * other types of lattices; ; \ref igraph_regular_tree() to create a Bethe lattice.
571573 *
574+ * Time complexity: O(|V|), where |V| is the number of vertices in the generated graph.
572575 */
573576igraph_error_t igraph_hexagonal_lattice (
574- igraph_t * graph , const igraph_vector_int_t * dims , igraph_bool_t directed ,
575- igraph_bool_t mutual
576- ) {
577+ igraph_t * graph , const igraph_vector_int_t * dims ,
578+ igraph_bool_t directed , igraph_bool_t mutual ) {
577579 igraph_integer_t num_dims = igraph_vector_int_size (dims );
578580 if (igraph_vector_int_any_smaller (dims , 0 )) {
579581 IGRAPH_ERROR ("Invalid dimension vector." , IGRAPH_EINVAL );
0 commit comments