Skip to content

Algorithm for filtering tree search results by whether they are related #6

@Sternbach-Software

Description

@Sternbach-Software

Use KotlinFunctionLibrary.recursiveMap

fun PersonNode.getSurroundingPeople(includeSpouseFamily: Boolean = true) = origin.parents + origin.siblings + origin.children + (if(includeSpouseFamily) listOf(origin.spouse) else listOf())
origin.getSurroundingPeople().recursiveMapNotNull({ it.getSurroundingPeople()) { if(it.matchesConstraint(...)) it else null }

If I'm not mistaken, this will use depth first search starting with the parents.

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