Weighted graphs

Hi, I would address the question to Jan, or to any older easy rider!

To my best remembrance, some 10-20-(30?) years ago there was another library module, beyond ugraphs, we’ve also had weighted graphs (wgraph, wgraphs, or simply graphs?)…

I don’t find it any more, neither on google… I find only Angelopoulos’ work (also in pack repository), but it focuses rather on visualization than algorithms, and it uses a different (incompatible, but transformable) notation than ugraps do.

Do you know what has happened with the module? Where could I find the sourcecode (git?) Or can you suggest some parallel implementation that I could use?

(To tell the truth, I am working with weighted planar graphs at the moment, somebodys work with that would be absolutely greetworthy!!!)

yours: Imre

I often work with graphs with SWI-Prolog but not always weighted graphs. While I understand your question, it is so wide open it is hard to give more than a general answer.

These are the options I would try.

  1. Search the SWI-Prolog packs for graphs.
  2. Search the GitHub repositories of users with established code for SWI-Prolog. They are listed as a subsection in the Wiki topic Useful Prolog References.
  3. Look for such code in Prolog books.
  4. Search all of the GitHub repositories that have some Prolog code. (query)


I don’t know if SWI-Prolog ever had one (haven’t been around that long yet), but some other Prolog systems have libraries for weighted graphs. SICStus has library(wgraphs) and YAP has library(wdgraphs) (plus a SICStus-compatible wrapper library(wgraphs)).

I haven’t tried it, but you can probably use the YAP library(wdgraphs) on SWI without much trouble. According to the YAP readme it should be under the Artistic License (weak copyleft). (GitHub’s “Show license” link for the repository points to the LGPL, but I think that only applies to the “LGPL” subdirectory in the repo.)