Skip to contents

Convenience helpers that build small undirected graph families as two-column integer edge matrices suitable for grip(). These helpers are meant for examples, experiments, and reproducible tests.

Usage

edges.path(n)

edges.cycle(n)

edges.mesh(h, w = h, connectivity = c("orthogonal", "diagonal"))

edges.cylinder(h, w = h)

edges.torus(h, w = h)

edges.cube(side = 2)

edges.kary.tree(k = 2, depth = 2)

edges.sierpinski.triangle(level = 2)

edges.sierpinski.tetrahedron(level = 2)

edges.sierpinski.carpet(level = 2)

Arguments

n

Number of vertices.

h

Number of rows.

w

Number of columns. Defaults to h.

connectivity

Mesh neighborhood rule. "orthogonal" keeps the 4-neighbor grid; "diagonal" also adds both diagonals of every unit square.

side

Number of lattice points along each cube edge.

k

Branching factor.

depth

Number of levels below the root.

level

Recursion depth for the Sierpinski graph families. Must be at least 1.

Value

A two-column integer matrix of undirected edges. Vertex labels are consecutive integers starting at 1.

Details

The exported generators cover primitive paths, cycles, regular meshes, cylinders, tori, cubes, trees, and the standard Sierpinski families. Specialized weighted benchmark families are exposed through complete *.surface.graph() and *.solid.graph() bundles instead of separate edge-list and embedding functions. edges.sierpinski.triangle() builds the 2-simplex family, edges.sierpinski.tetrahedron() builds the 3-simplex family, and edges.sierpinski.carpet() builds a 2D cell-adjacency carpet graph.

Functions

  • edges.path(): Path graph on n vertices.

  • edges.cycle(): Cycle graph on n vertices.

  • edges.mesh(): Rectangular grid graph with h rows and w columns.

  • edges.cylinder(): Cylindrical grid graph with h rows and wrapped width w.

  • edges.torus(): Toroidal grid graph with wrapped height and width.

  • edges.cube(): Cube surface graph on the boundary of a side x side x side lattice.

  • edges.kary.tree(): Full k-ary tree of depth depth.

  • edges.sierpinski.triangle(): Two-dimensional Sierpinski triangle graph at recursion depth level.

  • edges.sierpinski.tetrahedron(): Three-dimensional tetrahedral Sierpinski graph at recursion depth level.

  • edges.sierpinski.carpet(): Two-dimensional Sierpinski carpet graph whose vertices are occupied cells and whose edges connect orthogonally adjacent cells.

Examples

cube_edges <- edges.cube(3)
cycle_edges <- edges.cycle(6)
cylinder_edges <- edges.cylinder(3, 4)
tree_edges <- edges.kary.tree(k = 2, depth = 2)
mesh_edges <- edges.mesh(3, 4)
carpet_edges <- edges.sierpinski.carpet(level = 1)
tetrahedron_edges <- edges.sierpinski.tetrahedron(level = 1)
torus_edges <- edges.torus(3, 4)
edges <- edges.path(6)
coords <- grip(edges, n = 6, dim = 2, seed = 1)
plot.layout(coords, edges, main = "Path graph", pch = 16, cex = 0.8)

edges <- edges.sierpinski.triangle(2)
n <- max(edges)
coords <- grip(edges, n = n, dim = 2,
                      placement = "circle",
                      seed = 1)
plot.layout(coords, edges, main = "Sierpinski triangle", pch = 16, cex = 0.7)