Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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