-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for loops & disconnected species. #83
Conversation
I think yes to the warning for users delivering non-niche model networks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is your review! That's a good job again, and I find that the quality of your code is improving PR after PR :)
I see no major concern with your implementation, and my comments only points to possible minor ameliorations.
I agree that it would make sense that the error thrown in case of a cyclic/disconnected structural model be downgraded to a simple warning because a user inputting A
or a graph
directly possibly knows what they are doing. For instance, I would be glad to "paralellize" the simulation of two small systems by merging them into a single disconnected network.
I hear you are crafting a new commit to add the warning rn. Let's see this when it's ready :)
Here is the commit to throw a warning if the food web has cycle(s) or disconnected species, when not using structural models. Note that the warning can be silent with the FoodWeb([0 0; 0 0]) # throw a warning, because sp. are disconnected
FoodWeb([0 0; 0 0], quiet = true) # do not throw a warning thanks to 'quiet' |
@iago-lito here is the commit integrating your suggestions, everything should be in there (hope I missed nothing). ✨ |
Great! Let's land this now. Congratulations :) |
Answer #76.
When creating a
FoodWeb
with a structural model (e.g. niche model), we check that the generatedFoodWeb
:tol
keyword argument (the same applies if the user provides a connectance instead of a number of links)For point 1. and 2. I used functions from Graphs.jl as these operations are not trivial (see also #77).
For now, the checks for cycle(s) and disconnected species are only if the user use a structural model. However if the user build the
FoodWeb
with another method, for instance by providing directly an adjacency matrix, I don't check for cycle(s) and disconnected species. Should I add these checks and throw a warning if they do not pass? (Throwing an error would be too rough IMO, an informed user might want to model a food web with cycles).