treeNodesofEL
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - EL/Edge Lists
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-06, Last change: 2025-09-14
returns the tree structure from a given edge list
Description
Function removes lines with Nan first: In a list there are:
- single used points (Terminals)
- doubled used points (Links)
- three or more times used points (Branches)
See Also: CELofEL
Example Illustration
Syntax
[vi,vc,bi,ti,li]=treeNodesofEL(EL)
Input Parameter
Output Parameter
vi: | | list of vertices [vi n] |
vc: | | vertes use counter [bi ti li] |
bi: | | branch index |
ti: | | terminal index |
li: | | link index |
Examples
A=SGbox([30,20,10]); EL=FEofSG(A); treeNodesofEL(EL)
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 function, treeNodesofEL, processes an edge list (EL) to determine the structure of a graph in terms of its vertices and their connections. It categorizes vertices into branches, terminals, and links based on their usage frequency.
Input Parameters
- EL: An edge list, which is a matrix where each row represents an edge between two vertices.
Output Results
- vi: A list of unique vertices with a count of how many times each vertex is used.
- vc: A matrix indicating the type of each vertex: branch, terminal, or link.
- bi: Indices of branch vertices in the list
vi.
- ti: Indices of terminal vertices in the list
vi.
- li: Indices of link vertices in the list
vi.
Algorithm Steps
- Remove any NaN values from the edge list using the helper function
woNaN.
- Identify unique vertices from the cleaned edge list and initialize a count column for each vertex.
- If there are no vertices, return empty arrays for all outputs.
- Flatten the edge list to a single column vector
el containing all vertex indices.
- For each unique vertex, count its occurrences in
el and store this count in the second column of vi.
- Determine the type of each vertex based on its usage count:
- Branches: vertices used more than twice.
- Terminals: vertices used exactly once.
- Links: vertices used exactly twice.
- Create a logical matrix
vc to classify each vertex as a branch, terminal, or link.
- Find indices of branch, terminal, and link vertices in
vi and store them in bi, ti, and li respectively.
Algorithm explaination created using ChatGPT on 2025-08-19 06:46. (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