Skip to content

Commit

Permalink
Allow passing root node for cycle search in get_cm_cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed May 15, 2024
1 parent c84c231 commit 7ff4a89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions indra/assemblers/pysb/kappa_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,24 @@ def cm_json_to_networkx(cm_json):
return graph


def get_cm_cycles(cm_graph):
def get_cm_cycles(cm_graph, root_node=None):
"""Return cycles from a model's Kappa contact map graph representation.
Parameters
----------
cm_graph : networkx.Graph
A networkx graph produced by cm_json_to_networkx.
root_node : Optional[str]
The root node of the graph. If None, the root node will be determined
by networkx.cycle_basis.
Returns
-------
list
A list of base cycles found in the contact map graph. Each cycle
is represented as a list of strings of the form Monomer(site).
"""
cycles = cycle_basis(cm_graph)
cycles = cycle_basis(cm_graph, root_node)
processed_cycles = []
for cycle in cycles:
processed_cycle = []
Expand Down

0 comments on commit 7ff4a89

Please sign in to comment.