2.2. Embedded CW complex

class ect.embed_cw.EmbeddedCW[source]

A class to represent a straight-line-embedded CW complex. We assume that the coordinates for the embedding of the vertices are given, the 1-skeleton is in fact a graph (so not as general as a full CW complex) with straight line embeddings, and 2-Cells are the interior of the shape outlined by its boundary edges.

Faces should be passed in as a list of vertices, where the vertices are in order around the face. However, the ECT function will likely still work if the ordering is different. The drawing functions however might look strange. Note the class does not (yet?) check to make sure the face is valid, i.e. is a cycle in the graph, and bounds a region in the plane.

__init__()[source]

Initializes an empty EmbeddedCW object.

add_from_embedded_graph(G)[source]

Adds the edges and coordinates from an EmbeddedGraph object to the EmbeddedCW object.

Parameters:

embedded_graph (EmbeddedGraph) – The EmbeddedGraph object to add from.

add_face(face, check=True)[source]

Adds a face to the list of faces.

TODO: Do we want a check to make sure the face is legit? (i.e. is a cycle in the graph, and bounds a region in the plane)

Parameters:
  • face (list) – A list of vertices that make up the face.

  • check (bool) – Whether to check that the face is a valid addition to the cw complex.

g_omega_faces(theta)[source]

Calculates the function value of the faces of the graph by making the value equal to the max vertex value

Parameters:

theta (float) – The direction of the function to be calculated.

Returns:

dict

A dictionary of the function values of the faces.

sort_faces(theta, return_g=False)[source]

Function to sort the faces of the graph according to the function

\[g_\omega(\sigma) = \max \{ g_\omega(v) \mid v \in \sigma \}\]

in the direction of \(\theta \in [0,2\pi]\) .

Parameters:
  • theta (float) – The angle in \([0,2\pi]\) for the direction to sort the edges.

  • return_g (bool) – Whether to return the \(g(v)\) values along with the sorted edges.

Returns:

A list of edges sorted in increasing order of the \(g(v)\) values. If return_g is True, also returns the g dictionary with the function values g[vertex_name]=func_value.

plot_faces(theta=None, ax=None, **kwargs)[source]

Plots the faces of the graph in the direction of theta.

Parameters:
  • theta (float) – The angle in \([0,2\pi]\) for the direction to sort the edges.

  • ax (matplotlib.axes.Axes) – The axes to plot the graph on. If None, a new figure is created.

  • **kwargs – Additional keyword arguments to pass to the ax.fill function.

Returns:

matplotlib.axes.Axes

The axes object with the plot.

plot(bounding_circle=False, color_nodes_theta=None, ax=None, **kwargs)[source]

Plots the graph with the faces filled in.

Returns:

matplotlib.axes.Axes

The axes object with the plot.

ect.embed_cw.create_example_cw(centered=True, center_type='min_max')[source]

Creates an example EmbeddedCW object with a simple CW complex. If centered is True, the coordinates are centered around the center type, which could be mean, min_max or origin.

Returns:

EmbeddedCW

The example EmbeddedCW object.