ELunsort

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 1.0, Creation date: 2013-01-09, Last change: 2025-09-14

TEST and Development fnct for unsorting edge or facet lists

Description

This important function is used for testing in different application, the functionality. It randomly exchanges rows of an edge list.
unsortrand(EL,dim,n)
The new name is unsortrows

See Also: unsortNaN , unsortrows , CPLunsort

Example Illustration

 missing image of ELunsort(EL)

Syntax

EL=ELunsort(EL)

Input Parameter

EL: Original edge list

Output Parameter

EL: Unsorted edge list;

Examples

EL=ELofn(10); [EL ELunsort(EL)]



Copyright 2013-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm is designed to randomly unsort an edge list by swapping its rows. It is primarily used for testing purposes in various applications.

Input Parameters

Output

Algorithm Steps

  1. Determine the number of rows n in the edge list EL using size(EL,1).
  2. If n is greater than 2, proceed with the unsorting process.
  3. For each row in the edge list, perform the following:
    • Call the swapind function to get two random indices k and m.
    • Swap the rows at indices k and m in the edge list EL.

Function: swapind

This function generates two distinct random indices for swapping rows in the edge list.

Steps

  1. Check if n is less than 2. If true, return empty indices i1 and i2.
  2. Generate a random index i1 using ceil(rand*n) and ensure it is at least 1.
  3. Generate a second random index i2 using ceil(rand*n) and ensure it is distinct from i1 and at least 1.
Algorithm explaination created using ChatGPT on 2025-08-19 00:18. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21