decompose an undirected edge list into maximal chains and walk each of them
Description
A chain is a maximal run of edges joined at vertices where exactly two edges meet; a vertex of any other degree is a junction and terminates a chain. Every chain is walked from one end to the other, which assigns each edge a position within its chain and tells at which of its two vertices the walk enters it.
Chains are numbered by increasing highest member edge index, and each is walked from its lower terminal half edge; a closed chain has no terminal and is cut at its lowest vertex. These tie breaks make the result unique, which is what lets the compiled and the MATLAB path be interchangeable.
Syntax
[cid,pos,firstEnd] = chainOrder(F,nV)
[cid,pos,firstEnd] = chainOrder(F,nV,'noMex')Input
| F | nF x 2 list of edges, one based vertex indices |
| nV | number of vertices |
Output
| cid | nF x 1 chain id, 1..nCh |
| pos | nF x 1 zero based position of the edge within its chain |
| firstEnd | nF x 1, 1 or 2 - the column of F holding the entry vertex |
Flags
| noMex | use the MATLAB implementation even if chainOrderC is available |