Skip to content

Commit

Permalink
docstring for subgraph method
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbybp committed Feb 5, 2024
1 parent adfc543 commit da47a8b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pyomo/contrib/incidence_analysis/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,18 @@ def _extract_subgraph(self, variables, constraints):
return subgraph

def subgraph(self, variables, constraints):
# TODO: copy=True argument we can use to optionally modify in-place?
"""Extract a subgraph defined by the provided variables and constraints
Underlying data structures are copied, and constraints are not reinspected
for incidence variables (the edges from this incidence graph are used).
Returns
-------
``IncidenceGraphInterface``
A new incidence graph containing only the specified variables and
constraints, and the edges between pairs thereof.
"""
nx_subgraph = self._extract_subgraph(variables, constraints)
subgraph = IncidenceGraphInterface((nx_subgraph, variables, constraints), **self._config)
return subgraph
Expand Down

0 comments on commit da47a8b

Please sign in to comment.