Skip to content

Commit

Permalink
doc: subgraph for bipartite
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Mar 16, 2024
1 parent 28b076b commit 34e6efa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/basics/subgraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ end
@test_throws ArgumentError subgraph(N, [:D, :E])
end

"""
subgraph(N::SpeciesInteractionNetwork{<:Bipartite{T}, <:Interactions}, top::Vector{T}, bottom::Vector{T}) where {T}
We can induce a subgraph from a biparite network by specifying two arrays for
nodes to be included. Note that any array can instead be `:`, in which case the
entire series of nodes for this side of the network is used.
"""
function subgraph(N::SpeciesInteractionNetwork{<:Bipartite{T}, <:Interactions}, top::Vector{T}, bottom::Vector{T}) where {T}
topindexes = indexin(top, species(N,1))
botindexes = indexin(bottom, species(N,2))
Expand Down

0 comments on commit 34e6efa

Please sign in to comment.