Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added third embedding in Cubegraph for oblique projection of hypercubes #37045

Merged
merged 6 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/sage/graphs/generators/families.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,13 @@ def CubeGraph(n, embedding=1):
vertices in each column represents rows in Pascal's triangle. See for
instance the :wikipedia:`10-cube` for more details.

- ``3``: oblique projection of the `n`-cube. Oblique projection involves
aligning one face parallel to the viewer and projecting at a specified
angle, maintaining equal size for edges parallel to one axis while
applying fixed foreshortening to others. This method simplifies the
representation of a four-dimensional hypercube onto a two-dimensional
plane, offering a geometrically consistent visualization.

- ``None`` or ``O``: no embedding is provided

EXAMPLES:
Expand Down Expand Up @@ -1214,15 +1221,20 @@ def CubeGraph(n, embedding=1):
sage: g.show(figsize=[12,12],vertex_labels=False, vertex_size=20) # long time, needs sage.plot
sage: g = graphs.CubeGraph(9, embedding=2)
sage: g.show(figsize=[12,12],vertex_labels=False, vertex_size=20) # long time, needs sage.plot
sage: g = graphs.CubeGraph(9, embedding=3)
sage: g.show(figsize=[12,12],vertex_labels=False, vertex_size=20) # long time, needs sage.plot

AUTHORS:

- Robert Miller
- David Coudert
"""
if embedding == 1:
if embedding == 1 or embedding == 3:
# construct recursively the adjacency dict and the embedding
theta = float(pi/n)
if embedding == 3 and n > 2:
theta = float(pi/(2*n-2))

d = {'': []}
dn = {}
p = {'': (float(0), float(0))}
Expand Down Expand Up @@ -3264,7 +3276,7 @@ def GeneralizedSierpinskiGraph(G, k, stretch=None):

- ``stretch`` -- integer (default: ``None``); stretching factor used to
determine the positions of the vertices of the output graph. By default
(``None``), this value is set to twice the maximum Euclidian distance
(``None``), this value is set to twice the maximum Euclidean distance
between the vertices of `G`. This parameter is used only when the vertices
of `G` have positions.

Expand Down