Syntax
[NEL,CIL]=ELconnectedgroups(EL,vi)
Input Parameter
EL : | | Edge list |
vi : | | Optional list of interested vertices; default is '' |
Output Parameter
NEL : | | New Edge list; NOT SORTED ONLY GROUPED |
CIL : | | Group Index List |
Examples
ELconnectedgroups(FEofSG(SGsample(32)))
[NEL,CIL]=ELconnectedgroups( floor(rand(10,2)*10+1))
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, ELconnectedgroups
, processes an edge list to identify and group connected components. It is part of the SolidGeometry library.
Input Parameters
- EL: The primary input, an edge list represented as a matrix where each row is an edge connecting two vertices.
- vi: An optional parameter, a list of vertices of interest. If not provided, the default is an empty list.
Output Results
- NEL: A new edge list that is grouped but not sorted.
- CIL: A list of indices indicating the start and end of each group in
NEL
.
Algorithm Steps
- Initialize
vi
to an empty list if not provided.
- Determine the number of edges,
ne
, from the size of EL
.
- Initialize
NEL
and CIL
as zero matrices with dimensions based on ne
.
- Set counters
k
and l
to zero.
- Enter a loop that continues until
EL
is empty:
- If
vi
is empty, set i
to the first vertex of the first edge in EL
; otherwise, set i
to vi
.
- Initialize
nb
with i
.
- While
nb
is not empty, find all vertices connected to nb
and update i
with these vertices.
- Identify edges in
EL
that are connected to vertices in i
and store them in NEL
.
- Update
CIL
with the start and end indices of the current group.
- Remove the identified edges from
EL
.
- If
vi
was provided, exit the loop after processing the first group.
- Trim
CIL
and NEL
to remove unused rows.
- If no output arguments are specified, plot the grouped edge list using
ELplot
and display CIL
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:19. (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