merkle-db.tools.graph

Common utilities for working with MerkleDAG graphs.

find-nodes

(find-nodes store visited root follow?)

Explore the DAG by following links from the given root node. The follow? function will be called with the source node :data/type and a link, and should determine whether to follow the link or not. Returns a map of multihash ids to loaded node maps.

find-nodes-2

(find-nodes-2 store visited roots f)

Generate a sequence of values by exploring the DAG structure. Starting with the targeted root node, the function f will be called with each node, and should return a tuple containing two values: the results to emit in the sequence and a collection of links to follow for more loads.

Any node ids in the visited set will be ignored.