[m-rev.] for post-commit review: fix a perf regression for --generate-dependencies
Julien Fischer
jfischer at opturion.com
Fri Aug 15 13:47:32 AEST 2025
On Thu, 14 Aug 2025 at 19:46, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> > > + %
> > > +:- pred reachable_vertices_from(digraph(T)::in, T::in, set(T)::out) is det.
> >
> > Some alternative suggestions for names: reachable_vertex_set or
> > reachable_vertices.
>
> I think reachable_vertices_from is more descriptive than both of those.
I'm fine with that name as well.
> This module has significant naming problems anyway. The main one is
> the use of "vertex", when "node" is more commonly used, shorter,
> and has a regular plural form :-(
While "node" is used, most graph theory books I have ever looked at
define graphs to be collections of vertices and edges. It seems to be
a bit mixed in the software world, several graph libraries I am aware
of use vertex-edge, GraphViz appears to use node and edge.
Amusingly, if you look at the introductory comment in the digraph,
it seems we can't even be consistent in a single paragraph:
% This module defines a data type representing directed graphs. A directed
% graph of type digraph(T) is logically equivalent to a set of *vertices* of
% type T, and a set of edges of type pair(T). The endpoints of each edge
% must be included in the set of *vertices*. Cycles are allowed, including
% cycles consisting of only one edge (with both ends of the edge being
% the same *node*).
On balance, I would be inclined to stick with vertex / edge, while noting
the alternative names for those things (edges / links etc).
Julien.
More information about the reviews
mailing list