Syntax
[CEL,CHN]=CELofEL(EL)
Input Parameter
EL : | | unsorted but correct edge list |
Output Parameter
CEL : | | Sorted Edge list of Contour or Line of Nodes |
CHN : | | Chain [n x 1] with nodes |
Examples
CELofEL([100 1; 100 2; 3 2; 1 3])
Copyright 2017-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 processes an unsorted edge list (EL) to produce a sorted edge list (CEL) and a chain of nodes (CHN) for a single contour without branches.
Input Parameters
- EL: An unsorted but correct edge list, represented as a matrix where each row is an edge connecting two nodes.
Output Results
- CEL: A sorted edge list of the contour or line of nodes.
- CHN: A chain of nodes represented as a column vector.
Algorithm Steps
- Call the function
treeNodesofEL(EL)
to obtain node information: vi
(valid nodes), bi
(branch nodes), and ti
(terminal nodes).
- Check for branches using
bi
. If branches exist, plot the edge list and raise an error, as branches are not allowed.
- If there are no valid nodes (
vi
is empty), return empty CEL
and CHN
.
- Initialize
CEL
as a NaN matrix with the same size as EL
and determine the number of edges ne
.
- Determine the starting node
si
. If terminal nodes exist, use the first terminal node; otherwise, use the first valid node.
- Iterate over each edge (from 1 to
ne
):
- Find edges connected to the current starting node
si
.
- Determine the next node
c
and update CEL
with the current edge.
- Mark the current edge as processed by setting it to
[NaN NaN]
.
- Update the starting node
si
to the next node c
.
- Construct the chain of nodes
CHN
by concatenating the first column of CEL
with the last node of the last edge in CEL
.
- If no output arguments are specified, display the original edge list
OEL
and the transposed chain of nodes CHN
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:09. (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