For what it's worth, some time ago I played around with similar things. It's not an npm, not animating something along the arrow path, also no labels (counting arc instead of line as minor detail?).
https://gitlab.com/publishing-systems/experimental/-/tree/master/graph/html5-canvas/1/ and
https://gitlab.com/publishing-systems/experimental/-/blob/master/graph-traversal-svg.xhtml (this one was made on request, as someone wanted to flip an org chart or something but ended up not wanting/needing such a thing). I guess it doesn't really matter that much if the rendering is a HTML5 Canvas, SVG or plain HTML via CSS.
One time I found a neat module that generated railroad diagrams, that was nice too, I likely still have it somewhere (maybe it's still online at some place).
Christopher Shank's first reply is pointing out that these things easily (naturally?) lead into the classic area of graph visualization, where there's a big potentially unsolved or unsolvable problem of computing good positioning, how to visualize big graphs well, not doing the force-directed spring thing, avoiding too many lines crossing, facing rendering + navigation issues, etc. In the good case, towards a
draw.io/Kumu/MetaMaps.cc clone. Here's a short list of ideally libre-freely licensed graph visualization modules
https://groupware-systems.org/skreutzer/graph_visualization_components.xhtml and why not add yours if it qualifies? Things like
https://www.patreon.com/posts/2023-03-27-for-80661106 didn't make this list, because isn't really componentized, despite I made + then used a somewhat componentized version of it, but not updated. There's lots of these, even more if looking at proprietary ones. Things that draw lines and boxes.
OK, for the 3 problems explored here, I have different answers for my own needs, so let's not go into it. Sometimes I wonder a little bit, if/as visual programming often utilizes these kinds of graph representations, if that's of help or essential to visual programming or visualization of programs, or it's more of a distraction and there could be something else that's more useful. Haven't decided/concluded - similar issue with text files of source code. It's not that either one makes the dealing with code/programs significantly better, just exchanges one representation with another?