Liking cljdoc? Tell your friends :D
All platforms.

hodur-engine.utils


topological-sortclj/s

(topological-sort conn)
(topological-sort conn {:keys [direction] :as opts})

Returns either a topologically sorted vector with the ids of the nodes if the graph is acyclical or an empty vector if the graph is cyclical.

The first parameter conn is a meta-db atom and the second, optional is a map with :direction and :tag where the former contains the direction map to be used and the latter is an optional tag to filter the nodes by.

The direction map must contain the following entries:

  • :type->field-children - the relationship between types and their field children
  • :field->param-children - the relationship between fields and their param children
  • :type->field-return - the relationship between types and the fields returning them
  • type->param-return - the relationship between types and the params returning them
  • interface->type - the relationship between interfaces and the types implementing them
  • union->type - the relationship between union types and the types that the unify

The value must be either :ltr or :rtl which indicate the direction of the dependency arrow (i.e. a :rtl on :type->field-children means that the type's fields must be declared before the type itself while a :ltr signifies that the type must be defined prior to its field children.

If opts is not provided or a :direction entry is missing, a default direction with all dependencies set to :ltr will be used.

Returns either a topologically sorted vector with the ids of the
nodes if the graph is acyclical or an empty vector if the graph is
cyclical.

The first parameter `conn` is a meta-db atom and the second,
optional is a map with `:direction` and `:tag` where the former
contains the direction map to be used and the latter is an optional
tag to filter the nodes by.

The direction map must contain the following entries:

- `:type->field-children` - the relationship between types and their field children
- `:field->param-children` - the relationship between fields and their param children
- `:type->field-return` - the relationship between types and the fields returning them
- `type->param-return` - the relationship between types and the params returning them
- `interface->type` - the relationship between interfaces and the types implementing them
- `union->type` - the relationship between union types and the types that the unify

The value must be either `:ltr` or `:rtl` which indicate the
direction of the dependency arrow (i.e. a `:rtl` on
`:type->field-children` means that the type's fields must be
declared before the type itself while a `:ltr` signifies that the
type must be defined prior to its field children.

If `opts` is not provided or a `:direction` entry is missing, a
default direction with all dependencies set to `:ltr` will be used.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close