Add support for induced bipartite subgraph
As part of a project, I had to use bipartite induced subgraphs of a graph.
Let $G=(V,E) $ be a graph and let $X,Y\subseteq V$ such that $X \cap Y = \emptyset$. The bipartite subgraph of G induced by $X$ and $Y$ is $$(X \cup Y, X \times Y \cap E) $$ In other words, it's the bipartite subgraph made of all the edges of $G$ that are between $X$ and $Y$. Such a construction is useful in, for example, the search of vertex separators.
I've made a simple implementation (30 lines or so) for it and I think it might be worth including it. Before making a pull request, I wanted to see if this is something people might find interesting to have in the package.
A function which more generally returns the induced subgraph of a set of vertices could be useful. It could also be a good idea to define views on graphs where we could filter the edges and vertices (by filtering vertices, we would get the induced subgraph), see https://github.com/JuliaGraphs/Graphs.jl/issues/128#issuecomment-1129995566.
I agree that it would be useful functionality. @Codsilla do you want to get started on a PR so we can help?
A function which more generally returns the induced subgraph of a set of vertices could be useful.
The function induced_subgraph does just that :) Views would be nice but are not exactly in the scope of what is proposed.
I agree that it would be useful functionality. @Codsilla do you want to get started on a PR so we can help?
Just did!