Rethinking Hypergraphs
Copyright 2024. Kurt Cagle
When you look at your company, you likely see things - people, clients or customers, products, processes, roles, revenue, etc. Those things are connected in various ways, and those connections identify your business. In mathematical terms, these things collectively form a graph. A very simplistic graph of a business might end up looking like this.
?
Such a visual representation can be applied to anything but should be seen as a representation. You can think of the above as a map, just as an organization chart is a map. There are several domain-specific languages (or DSLs) that can encode this map as something that a computer can understand, just as a blueprint is a graphic representation (a map) of a house, a piece of machinery, or an organization that can also be encoded in DSLs (think CAD-CAM systems, for instance).
The problem with blueprints is that they are generally good at describing the state of things at a single point in time. They are, in essence, snapshots. However, in the real world, things change. In an organization, people join, leave, or get promoted to new positions. People are born, go to school, change schools, graduate, start jobs, have children, switch jobs, retire, and eventually die.
Factoring in time also means factoring in changes in relationships. Some of these changes are abrupt - a person joins or leaves a company, for instance - while others are associated with sampling, such as a publicly traded company's close-of-day price on their stock, for instance. In many cases, such changes can also represent an assertion's truthiness or similar attributes ("How certain are you that this relationship is true?" as one example).
Mathematicians have a precise meaning for the word hypergraph, primarily regarding how complex structures are represented. However, a secondary meaning is emerging: a hypergraph is a graph designed to change over time. Put another way, in a hypergraph, objects of various types produce histories of events, and those histories, in turn, reflect changes to the model itself as well as initiate other actions.
Events, ultimately, bind information together. Individually, they do not convey much information, though they do some. In the aggregate, however, events become history. Events are the foundation of time series, for instance. Events not only provide connections to those entities that participate in that event, but they can also indicate which attribute or set of attributes change, which can, in turn, affect the dependency graphs where other objects and their associated properties change in response to changes in the original attributes.
As an example, if you only wanted to show the information about Jane at the current time, this graph collapses to:
When taken in isolation, what can look fairly simple becomes considerably more complex when viewed as a sequence of events. For instance, our protagonist, Jane Doe, has worked at BigCo and InvestCo for twelve years.
The first graph represents the level of most knowledge graphs -- a snapshot of a particular set of facts at a specific time. Given that there are any number of kinds of events, temporal hypergraphs, in general, can get very complex. This complexity increases even more when dealing with projected time - events that have not yet happened, such as a scheduled conference. In hypergraphs, event instances often make up the overwhelming majority of all data in the system.
However, as the requirement for digital twins increases, these event-driven graphs will become far more common. Events are signals which tell the system something has occurred (or may occur). In the above example, the Role Event indicated that Jane Doe joined a new company (InvestCo) as a Partner.
The dashed relationships are pretty interesting. The property's current company and role, applied to Jane, are calculated - any previous links for those two properties are removed, and new ones are then added to the focus (the applies to the event, in this case, Jane). This approach means that you can ask the knowledge graph of the current job and company that Jane works for without having to do complex calculations on the fly.
Events can also act as envelopes containing metadata for processing. This is a well-established pattern in which metadata provides enough context to tell a hypergraph what to do with the data.
It’s also worth pointing out that events not only tell when something occurred, but they can also tell where something occurred. This is critical in tracking changes in locality (someone changes their current address, for example) or in movement (a tracked drone changes direction or otherwise accelerates or decelerates). The latter case is important, especially with digital twins of dynamic systems.
A Hypergraph is a Graph of Graphs (of Graphs of Graphs of ...)
A knowledge graph is a database, a hypergraph is a platform. A hypergraph can initiate actions, provide a consistent API ontology, and evolve. It can be thought of (and represented as) a graph containing other graphs, each of which exists for a particular reason and some of which contains operational semantics rather than domain semantics.
In a hypergraph, a graph is a somewhat more generalized concept than it is in a knowledge graph. It can be a container that holds sentence assertions (often known as tuples), the most basic level of information in a graph. In other cases, a graph can be a port or destination, a place in the outside world where information comes from or goes to. These can be web services, files, or LLMs. Others may be ports for reporting and intermediate file generation. These ports can also be configured from within the hypergraph to explain how such graphs deal with inbound or outbound content.
While specific semantics may vary between implementations, most hypergraphs have the structure given in the diagram above, with the following specific functionality:
Input Graphs
Data comes in a wide variety of forms and formats. The input graphs are generally transient, with data to be transformed and validated. Input graphs generally aren’t part of the canonical model.
The Canonical Graph
This is an umbrella graph holding the core or canonical model. In general content contained within the canonical graph is immutable – once written, content cannot be changed, only updated with newer versions of data. ?The canonical graph is, in turn, broken down into the following subgraphs:
Output Graphs.
As with input graphs, output graphs can hold containers for reports, output from processes or similar data, but can also be “ports” to external processes such as web services, files, prompts, and similar data.
In some cases, input and output graphs may be the same endpoint of the port – a request is made via an input point processed through the graph, and the corresponding response is returned asynchronously to the port as an output port. This is especially important in the case of Language Learning Models (LLMs), where the hypergraph can hold a continuous conversation with the LLM.
From Assertions to DOMs (and Back)
One of the more intriguing possibilities of Hypergraphs is in its ability to generate (and consume) document object models. An object model is an in-memory representation of an entity such as a business, department, product, or person that Python, Java or Javascript code can manipulate in either a disconnected or connected mode.
In a disconnected mode, the hypergraph can return a JSON object that can be resuscitated as a DOM model with its application interfaces. Users can work with this model, which is made up of various DOM submodels. This can be handy for data analytics or simulations, and while it can accept changes, most of the time, disconnected content is intended primarily for transmitting the state of the graph to other processes. (In essence, this creates a copy of the state of the graph)
In a connected mode, on the other hand, any change (mutation) to the DOM model will cause a corresponding change to the underlying hypergraph representation. This typically is used when needing to make continuous changes to the graph and is especially useful for managing digital twins. In this case, you’re creating a reference to the state of the graph itself, which also means that such changes typically involve orchestration in multi-user scenarios.
One advantage of such a DOM approach is that it can bind functions and methods to the underlying properties (typically via something like a Shape constraint language). Functions can effectively encapsulate and thus hide access to core data structures, create getters and setters, and validate, and hence control, attempts to pass invalid data. This creates an abstraction layer between the hypergraph and the users of the DOM, one of the more problematic areas of languages such as RDF.
From ?Hypergraphs to LLMs (and Back)
There are several pathways by which hypergraphs can interact with Language Learning Models (LLMs, also known as Large Language Models). These fit largely into writing and reading functions.
领英推荐
Writing to the LLM
Reading from the LLM
Generally, a hypergraph and its corresponding LLM should be considered a fairly tightly coupled system.
Hypergraphs and Vector Search / Embeddings
One of the more significant recent innovations in the graph world is coupling knowledge graphs (and hence hypergraphs) with vector stores. A vector store can be considered a thematic index – it converts a document into a sequence of tokens that can then be applied to a high-dimensional information space.
For instance, the following shows a three-dimensional example of this process, mapping various fictional captains to different attributes. Each vector can be translated into a set of coordinates (such as (0.8, 0.2, 0.9) for Captain Picard of the USS Enterprise, NCC-1701D series, from the Star Trek universe). If you have tens of thousands of such attributes, the same mapping would apply, but with that many dimensions rather than just three.
An LLM can then be thought of as a zipped collection of such vectors, coupled with a way of creating new vectors and determining how closely they match existing vectors. The longer the dimensionality of the vector, the more likely that what comes back is related to the test vector, and the more expensive the operation is computationally.
Vector search then works by encoding a prompt as a vector and seeing what the neighbourhood of that prompt looks like (the circle in the above diagram). For instance, if the prompt looks something like "Identify fictional captains that helm their own ships, while at the same time are depicted primarily as real characters." then the prompt would be encoded as the black vector in the above diagram. Its temperature sets the radius of the search hypersphere (here projected onto a circle) and would graph Captains Sparrow, Picard, Janeway, Kirk and Ahab but would exclude Captain America and Captain Kangaroo. It also picks up the topic of naval captains, not Army or Air Force Captains.
This is one reason a hypergraph is a natural complement to such LLMs. When you have 30,000 features (axes), the chances are high that many (if not most) of those features will be irrelevant to what you’re looking for. A hypergraph pares down the number of features (for instance, the feature “total amount of rainfall received per square kilometer compared to maximum rainfall received per square kilometer” is likely not going to be relevant to “person” in all but the most specialized of contexts (e.g., how wet is a given person likely to be in San Antonio, TX, USA vs Seattle, WA, USA?). This can make calculations far faster as the number of relevant dimensions drops considerably, likely by a couple of orders of magnitude.
If the hypergraph is feeding the LLM, this also assumes that some form of vector encoding is part of the functionality of the hypergraph, both in doing ad hoc similarity analysis within the hypergraph and in training the LLM directly. The similarity analysis is fairly critical, as most queries against hypergraphs involve finding similarity relationships. Most knowledge graph platforms pre-2022 do not have such features (or have very limited versions of such features), which meant that such queries had to be crafted by hand. That’s changing as knowledge graph platforms evolve into hypergraphs. In general, similarity searches can often significantly reduce the space of what needs to be queried, even within a hypergraph itself, then additional methods can be used to refine the searches accordingly.
Hypergraphs: State of the Art
Are there hypergraphs on the market today? Sort of. If you look at hypergraphs in the purely mathematical sense, most RDF-based graphs as well as several labeled property graphs (such as neo4J) have some hypergraph-like properties, especially in the ability to abstract out sets of graphs, provide service endpoints, and the ability to represent both enterprise and programmatic structures internally. A few have even managed to retrofit some limited generative AI capabilities in the last year, though for the most part, these are fairly simplistic.
At the same time, the trend is moving in that direction, and Hypergraphs as a product group will likely begin to differentiate themselves from knowledge graphs in the 2024 to 2025 timeframe.
The Wardley diagram for hypergraphs below illustrates the dependencies involved and indicates the maturity levels that need to exist for specific supporting technologies to make them feasible. (Note: the author is not an expert on Wardley Maps, so don’t necessarily to much about this from a business standpoint.
To summarize, there are several key technologies that a Hypergraph should have that differentiate it from a knowledge graph:
There are other factors involved that make hypergraphs a natural evolution from knowledge graphs, but they mostly have to do with technical issues that likely require both significant adaptation and the maturing of several core pieces of secondary technology.
The Business of Hypergraphs
Most of this paper has focused largely on architectural issues, albeit at a fairly high level. It’s worth, however, exploring why hypergraphs should be on every CTO’s radar screen.
Overall, hypergraphs will save money from reduced integration costs, better utilization of Generative AI systems, and integrating multiple systems’ data catalogs and master data management systems. They will make querying the canonical graph much easier (especially when tied into code generators), and provide better tools for integration with external applications.
Conclusion
There are a few products that are advertising themselves as hypergraphs, largely because it makes a great marketing term, but overall this is a field that will likely see significant evolution in the coming months and years, for the simple reason that it's needed. Hypergraphs fill a necessary balancing factor to LLMs, provide a way of keeping graphs (and LLMs) more or less current while simultaneously ensuring a degree of provenance and governance that LLMs are just not well set up to manage, and they do so in a way that provides this service while at the same time opening up accessibility to the graphs (and subsequent coding) that knowledge graphs right now are just not well positioned to do.
In media res,
Kurt Cagle
Editor, The Cagle Report
My Newsletters:
Technical Communicator ? Project Manager ? Analytic Researcher ? Sailing Enthusiast
11 个月This is a solution to the problem we discussed yesterday, Csaba Schmidtmayer.
Head of Operations at Ortelius, Transforming Data Complexity into Strategic Insights
12 个月Stefan Dageson, I like to hear your perspective here. I've seen similar materials from you.
Helping us all "Figure It Out" (Explore, Describe, Explain), many Differentiations + Integrations at any time .
1 年unfortunately, people are also unnecessarily being very esoteric about hypergraphs . a hypergraph is merely what your referring to as the "mathematical definition" ... thats it ... what i mean here is that we shouldn't confuse nor conflate the interrogatives regarding the affordances of (hyper)graphs ... people already did the exact same for semantic web and RDF and graphs and knowledge graphs etc versus any and all possible competition ... and we only got here just to do it again . it is one (type of) generalization of graph theory . there are also things like "metagraphs" for instance, which actually moreso resemble what your referring to in the diagrams (the demonstration of complex reification as a first class construct) . "hypergraph" theory itself does not mean nor imply nodes being edges / edges being nodes ... this tends to be more of a reification generalization of graph theory not specific to hypergraphs . #polygranularity
DIRECTEUR PROPERTY MANAGEMENT
1 年Very usefull, thank you! ??
Disambiguation Specialist
1 年This is brilliant, Kurt Cagle, and will likely become the 'go to' for anyone thinking about where graphs go next. I've had several conversations with my partners, Ruben Sardaryan and Marc Nolte, CDMP, CDP as well as Daniel Taylor, Philippe H?ij, Yaakov Belch, Joe Reis ?? among others and more recently Chaun Burnette. Really, really important and ultimately useful material - thanks very much for pulling this together!