Digraphs
Digraphs copied to clipboard
Add a `FollowPath` operation
Something like the following, where D is digraph, src is the start node of the path, and path is a list of edge indices.
FollowPath := function(D, src, path)
local result, pos, out;
result := [src];
pos := 1;
out := OutNeighbours(D);
while pos <= Length(path) and IsBound(out[src]) and IsBound(out[src][path[pos]]) do
src := out[src][path[pos]];
pos := pos + 1;
Add(result, src);
od;
return result;
end;