Skip to content

How does the ancestry cache work? #130

@lunik1

Description

@lunik1

I am having trouble understanding how to use the ancestry cache, and the docs are not very clear. I assume it must be populated using ancestry-add however doing this the obvious way results in an error:

(ancestry-add (ancestry-new) :child1 :parent1 :parent2)
Execution error (IllegalArgumentException) at loom.alg-generic/ancestry-add (alg_generic.cljc:558).
Key must be integer

ancestry-add only seems to work if the parent nodes already exist in the cache, but then the cache does not properly reflect the hierarchy:

(ancestor? (ancestry-add (ancestry-add (ancestry-add (ancestry-new) :child) :parent) :child :parent) :child :parent)
false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions