Digraphs icon indicating copy to clipboard operation
Digraphs copied to clipboard

Add a `FollowPath` operation

Open james-d-mitchell opened this issue 7 months ago • 0 comments

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;

james-d-mitchell avatar Aug 18 '25 10:08 james-d-mitchell