Search⌘ K

Build a Dynamic Process Graph

Explore how to build a dynamic process graph in Elixir by transforming graph nodes into supervised processes. Learn to maintain node state, create mappings between node IDs and process IDs, and manage edges, while considering techniques to handle edge properties. This lesson helps you understand dynamic supervision in graph processing and state management within process graphs.

Now that we’ve defined some of the machinery for creating and maintaining a supervision tree, we can turn to the process graph itself.

The ProcessGraph module

Let’s create a new module:

Elixir
defmodule GraphCompute.ProcessGraph do
# ...
end

We should now have a module library tree that looks like this:

The graph_up/1 function

We want to add now a simple function—let’s call it graph_up/1—that will map any %Graph{} struct to a new %Graph{} struct, where nodes are replaced by supervised ...