Skip to content

TrophicSpecies() is order-sensitive to predator/resource lists, causing under-lumping of trophic species #50

Description

@DanaReuter

Not sure if I missed a cleaning step in my community setup, but today, while using cheddar v0.1.639, I encountered unexpected behavior in TrophicSpecies() / LumpTrophicSpecies() where nodes that share identical sets of prey and predators are not lumped into the same trophic species.

The issue appears to arise because TrophicSpecies() compares prey and predator vectors using order-sensitive equality rather than set equality. As a result, two nodes with identical prey/predator memberships but different internal ordering of those vectors are treated as distinct trophic species.

I found this issue because I was trying to write a sensitivity analysis of a community and discovered I would get very large differences in trophic species.

Again, I am not sure if there is a step earlier that forces the ordering.

Thanks.

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