(-base-compilation graph parallel?)(-base-compilation graph input-ids parallel?)Base compilation used by sequential and parallel processors. When parallel? is false, the topology is flattened to be 1-dimensional. When no inputs specified, it will create a compilation for all input nodes of the graph.
Base compilation used by sequential and parallel processors. When parallel? is false, the topology is flattened to be 1-dimensional. When no inputs specified, it will create a compilation for all input nodes of the graph.
(-process-node graph node values inputs)Processor impl: processes a single node on a graph with given accumulated values and inputs from processor process.
If node throws exception, wraps the exception in ex-info containing paths.
Processor impl: processes a single node on a graph with given accumulated values and inputs from processor process. If node throws exception, wraps the exception in ex-info containing `paths`.
(-sources-values compute-node values inputs)Returns a map of {<source-label> <source-value>}, given a node, current processor accumulated values
and currently processing inputs.
Useful for implementing graph-processors.
Returns a map of {<source-label> <source-value>}, given a `node`, current processor accumulated `values`
and currently processing `inputs`.
Useful for implementing graph-processors.(-topological-sort graph input-ids)Returns a parallel topological sort of the graph, as a collection of steps, where each step is a collection of node ids that can be run in parallel. Useful as a base for certain processor compilations.
Returns a parallel topological sort of the graph, as a collection of steps, where each step is a collection of node ids that can be run in parallel. Useful as a base for certain processor compilations.
(add graph label node)Adds node to graph with the given label.
Recursively adds all sources of node that do not exist yet on graph, without label.
Adds `node` to `graph` with the given `label`. Recursively adds all sources of `node` that do not exist yet on `graph`, without label.
(-compute this curr-val sources)Computes the new value of a compute-node
Computes the new value of a compute-node
(-sources this)Returns a map of {<source-label> <source-node>}
Returns a map of {<source-label> <source-node>}
(compute-node sources handler)Returns a graph node that computes a new value from the values of its sources using handler.
sources is a map as {<source-label> <soure-node>}.
handler is a 2-arity function accepting the current node value and a map of {<source-label> <source-value>}.
Sources that are inputs to the graph will be nil unless specified as inputs to process.
Returns a graph node that computes a new value from the values of its `sources` using `handler`.
`sources` is a map as {<source-label> <soure-node>}.
`handler` is a 2-arity function accepting the current node value and a map of {<source-label> <source-value>}.
Sources that are inputs to the graph will be nil unless specified as inputs to [[process]].(compute-node? x)Returns true iff x is a compute node
Returns true iff x is a compute node
(context graph)(context graph processor)Returns a context to execute the given graph with processor.
If processor is not specified, it will use a sequential-processor.
Returns a context to execute the given `graph` with `processor`. If `processor` is not specified, it will use a `sequential-processor`.
(graph)(graph nodes-map)Returns a graph, empty or from a map of {label node}.
Returns a graph, empty or from a map of {label node}.
(input-node)Returns a graph node that can be used to input values when processing the graph context.
input-nodes do not hold their values through calls to [process], and only have a non-nil value
when they are specified as inputs to process.
Returns a graph node that can be used to input values when processing the graph context. input-nodes do not hold their values through calls to [[[process]]], and only have a non-nil value when they are specified as inputs to [[process]].
(input-node? x)Checks if x is an input node
Checks if x is an input node
(-id this)Returns id of this node. ID must be unique on a graph.
Returns id of this node. ID must be unique on a graph.
(node? x)Checks if x is any type of graph node
Checks if x is any type of graph node
(parallel-processor)Only CLJ: Returns a parallel processor that will execute each parallel step of the topological sort using pmap.
Only CLJ: Returns a parallel processor that will execute each parallel step of the topological sort using pmap.
(precompile context input-labels)Creates a compilation for the given inputs-labels, and stores the result into context to
be used when processing the graph with the same input-labels in future calls to process.
Creates a compilation for the given `inputs-labels`, and stores the result into `context` to be used when processing the graph with the same `input-labels` in future calls to `process`.
(process {:keys [processor graph values] :as context} labelled-inputs)Processes the given context using labelled-inputs as {<input-node-label> <input-value>}.
If a compilation didn't exist for the current set of inputs, it will create one and store it in context.
Returns updated context.
Processes the given `context` using `labelled-inputs` as {<input-node-label> <input-value>}.
If a compilation didn't exist for the current set of inputs, it will create one and store it in `context`.
Returns updated `context`.Compiles and processes a graph context for the given inputs.
Compiles and processes a graph context for the given inputs.
(-compile this graph input-set)Creates a compilation to traverse the graph for the given input-set (set of input-nodes ids).
The result will be passed to -process as compilation.
Creates a compilation to traverse the `graph` for the given `input-set` (set of input-nodes ids). The result will be passed to -process as `compilation`.
(-process this graph compilation values inputs-map)Processes the graph traversing the given compilation,
using the current values of the context and the given
inputs-map as {<input-id> <value>}. Returns the new values
of the context as {<compute-id> <value>}.
Processes the `graph` traversing the given `compilation`,
using the current `values` of the context and the given
`inputs-map` as {<input-id> <value>}. Returns the new values
of the context as {<compute-id> <value>}.(sequential-processor)Returns a sequential processor that processes nodes sequentially.
Returns a sequential processor that processes nodes sequentially.
(value {:keys [graph values]} label)Returns the value of node identified by label in context.
Slightly faster than (get (values context) label), as it only needs to translate label->id
for the requested label.
Returns the value of node identified by `label` in `context`. Slightly faster than `(get (values context) label)`, as it only needs to translate label->id for the requested label.
(values {:keys [graph values]})Returns current context values as {label value}.
Returns current `context` values as {label value}.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |