Skip to content

Predictable sorting in simplicial_complex.py #26931

@jdemeyer

Description

@jdemeyer

#25932 introduced code of the form

try:
    vertices = tuple(sorted(vertex_set))
except TypeError:
    vertices = tuple(sorted(vertex_set, key=str))

The problem here is that sorting is not predictable: adding a vertex or considering a face containing only sortable vertices could suddenly change the ordering.

Instead, the sorting key should be explicitly given and the same key should always be used for the same simplicial complex.

CC: @jhpalmieri

Component: python3

Author: Jeroen Demeyer

Branch: 154b615

Reviewer: John Palmieri

Issue created by migration from https://trac.sagemath.org/ticket/26931

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions