Replies: 1 comment 1 reply
-
Hi Dave!
There are some forthcoming C++ papers on our proposed graph library — D3126 (overview) and D3127 (terminology and conceptual background) will answer many of your questions I think. In some cases we made explicit what was implicit in BGL. In other cases we jettisoned some things — and also added some things. The feedback I have gathered over the years is that BGL is too complicated and too slow to be useful.
A quick summary.
One of the biggest revelations was that there is a difference between a graph and its representation. A graph has vertices and edges — whereas a representation of a graph encodes the structure of a graph in a form that is amenable to computation. One example of the difference between a graph and its representation is an adjacency matrix. While on would never use that for actual computation, it encodes the adjacency of vertices, based on an enumeration of the vertices — which is different from the vertices themselves. That is if you have a graph G = {V, E}, the elements in set V can be enumerated as { v0, v1, … } — the adjacency matrix is in terms of the numbers {0, 1, 2} rather than {v0, v1, …} — it doesn’t matter what the vs are, just that we have enumerated them. The adjacency matrix does not have the vertices or edges from the graph — in fact it doesn’t have vertices or edges at all. As is done in linear algebra, for efficiency we can represent the adjacency matrix in sparse form, either in coordinate form (COO) or in compressed form (ala CSR). In graph terms, the former is an edge list, while the latter is usually referred to as an adjacency. Since these representations are just compressed forms of the adjacency matrix, they also don’t contain vertices or edges per se. Now, given an enumeration, we can get the vertices and/or edges (and their properties) from a graph — though it is typically only the properties we are interested in. There may not be a materialized vertex or materialized edges anywhere at all.
Another big thing was a change in emphasis on how the library is used. Rather than providing lots of machinery for creating a graph, working with its properties, and so forth — the new library is algorithm-centric arranged around a set of concepts and the assumption is that users will bring their own containers. Most importantly, compositions of standard library containers are suitable for use as a graph for most algorithms. That is, a vector of tuples (or a tuple of vectors) is an edge list representation and a vector of vectors is an adjacency list representation. There is no general-purpose graph generator.
Conceptually, a graph representation is a range of ranges — in general a random-access range of forward ranges (depending on what algorithms require). We also accommodate “hyper sparse” graphs in the framework by allowing a map of ranges to be used for the graph. A hyper sparse graph representation is one for which the enumeration of vertices is not contiguous — this comes up a lot in real-world applications.
We also don’t have property maps — the algorithms that require access to properties within an algorithm (and there aren’t that many that do) are parameterized with a property accessor function. Also, many things in graph algorithms are used for book-keeping in an algorithms, but aren’t properties per se. The black/grey/white map used by the CLRS form of BFS for example is simply an algorithm implementation detail (which is not at all needed for BFS — in fact the queue is not needed for BFS, but that is another story). There are many other examples of things that don’t need to be in the interface of a graph algorithm.
We still have visitors, though much more accessible (we don’t require a complete callback structure be created when only one or a few of the callbacks are required). We experimented with using coroutines as a mechanism for visitors, which is really cool, but there was some overhead that probably would not be acceptable. There is a proposal for “const coroutines” which may eliminate that overhead however, so we may bring coroutines back for visitor functionality.
We have views of graphs (and their constituents) to ease traversal — for instance there is a breadth-first view of a graph that can be iterated with a range-based for loop.
I think we need to understand a bit better what you mean by memoization in your case, but I think we have a mechanism for that (currently called “descriptors”, which is a collision with BGL terminology that will need to be changed). OTOH, it sounds like this is a data structure issue rather than an algorithm issue so it may be orthogonal to our framework — meaning it is up to the user to provide a graph representation meeting the algorithm concepts in the library — the algorithms would not be concerned with memoizing — the graph data structure does that. To the algorithm, it just needs to behave according to the graph concepts. (We are planning a “CSR” graph as a separate proposal, but that is the only actual data structure being contemplated.)
PS — We should have a zoom call to catch up on things. Send me an email and we can set up a time.
Sincerely,
Andrew Lumsdaine
On Dec 24, 2024, at 2:28 PM, Dave Abrahams ***@***.***> wrote:
I'm interested in generic graph libraries for Swift; there are several, but they don't seem to have learned from the Boost Graph Library; I might try to coax them along, or might try to write something myself. This library I know was written by people familiar with the BGL (hi @lums658<https://urldefense.com/v3/__https://github.com/lums658__;!!K-Hz7m0Vt54!i9L4uSW8UQG9-jHQQ-1PiAUxu_XXmEudlRHmBBIOElNy7biB3cZhMiIaRJTKwGvLFvsx4YBTcLfwsyAB-GZO9w$>!) and I assume newly-discovered truths have been incorporated—I don't mean things at the language level, obviously, but fundamental things about how to address the graph domain generically. I'd like to get an idea of what those new truths might be.
Thanks,
Dave
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/stdgraph/graph-v2/discussions/141__;!!K-Hz7m0Vt54!i9L4uSW8UQG9-jHQQ-1PiAUxu_XXmEudlRHmBBIOElNy7biB3cZhMiIaRJTKwGvLFvsx4YBTcLfwsyAT_JHycQ$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AGKPFDLWI5LKYMW24BGQ6XL2HHNZ5AVCNFSM6AAAAABUFHRVR2VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXG42DCNRRG4__;!!K-Hz7m0Vt54!i9L4uSW8UQG9-jHQQ-1PiAUxu_XXmEudlRHmBBIOElNy7biB3cZhMiIaRJTKwGvLFvsx4YBTcLfwsyAv8fLYhg$>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm interested in generic graph libraries for Swift; there are several, but they don't seem to have learned from the Boost Graph Library; I might try to coax them along, or might try to write something myself. This library I know was written by people familiar with the BGL (hi @lums658!) and I assume newly-discovered truths have been incorporated—I don't mean things at the language level, obviously, but fundamental things about how to address the graph domain generically. I'd like to get an idea of what those new truths might be.
Thanks,
Dave
Beta Was this translation helpful? Give feedback.
All reactions