Skip to content

Commit

Permalink
Fix representation of SimplexView
Browse files Browse the repository at this point in the history
  • Loading branch information
ffl096 committed Sep 14, 2023
1 parent cba7b4e commit 2bf961b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
12 changes: 2 additions & 10 deletions toponetx/classes/reportviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,19 +715,11 @@ def __contains__(self, item) -> bool:

def __repr__(self) -> str:
"""Return string representation that can be used to recreate it."""
all_simplices: list[tuple[int, ...]] = []
for i in range(len(self.faces_dict)):
all_simplices += [tuple(j) for j in self.faces_dict[i]]

return f"SimplexView({all_simplices})"
return f"SimplexView({[tuple(simplex.elements) for simplex in self._simplex_trie]})"

def __str__(self) -> str:
"""Return detailed string representation of the simplex view."""
all_simplices: list[tuple[int, ...]] = []
for i in range(len(self.faces_dict)):
all_simplices += [tuple(j) for j in self.faces_dict[i]]

return f"SimplexView({all_simplices})"
return f"SimplexView({[tuple(simplex.elements) for simplex in self._simplex_trie]})"


class NodeView:
Expand Down
1 change: 0 additions & 1 deletion toponetx/classes/simplex_trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ def skeleton(self, rank: int) -> Generator[SimplexNode, None, None]:
>>> sorted(map(lambda node: node.elements, trie.skeleton(2)))
[(1, 2, 3)]
"""
print(rank)
if rank < 0:
raise ValueError(f"`rank` must be a positive integer, got {rank}.")
if rank >= len(self.shape):
Expand Down
3 changes: 1 addition & 2 deletions toponetx/classes/simplicial_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def incidence_matrix(
raise ValueError(f"Input dimension must be positive, got {rank}.")
if rank > self.dim:
raise ValueError(
f"Input dimension cannot be larger than the dimension of the complex, got {rank}."
f"Input dimension {rank} cannot be larger than the complex dimension {self.dim}."
)

# TODO: Get rid of this special case...
Expand All @@ -671,7 +671,6 @@ def incidence_matrix(
simplex_dict_d = {
tuple(sorted(simplex)): i for i, simplex in enumerate(self.skeleton(rank))
}
print(simplex_dict_d)
simplex_dict_d_minus_1 = {
tuple(sorted(simplex)): i
for i, simplex in enumerate(self.skeleton(rank - 1))
Expand Down

0 comments on commit 2bf961b

Please sign in to comment.