src/DSGRN/SaveDatabaseJSON.py
def morse_sets_json(network, morse_graph, morse_decomposition):
    """Return json data for Morse sets."""
    # Get a mapping from DSGRN top cells to cc top cells
    cell2cc_cell = dsgrn_cell_to_cc_cell_map(network)
    # Get list of Morse nodes
    morse_nodes = range(morse_decomposition.poset().size())
    # Permutation that gives node index from Morse set index
    permutation = morse_graph.permutation()
    morse_sets_data = [] # Morse sets data
    for morse_node in morse_nodes:
        morse_cells = [cell2cc_cell[c] for c in morse_decomposition.morseset(morse_node)]
        # Get Morse graph node index
        morse_graph_node = permutation[morse_node]
        morse_set = {"index" : morse_graph_node, "cells" : morse_cells}
        morse_sets_data.append(morse_set)
    morse_sets_json_data = {"morse_sets" : morse_sets_data}
    return morse_sets_json_data
Return json data for Morse sets.
Return json data for Morse sets.
Return json data for Morse sets .
def morse_sets_json(network, morse_graph, morse_decomposition):
    cell2cc_cell = dsgrn_cell_to_cc_cell_map(network)
    morse_nodes = range(morse_decomposition.poset().size())
    permutation = morse_graph.permutation()
    morse_sets_data = [] 
    for morse_node in morse_nodes:
        morse_cells = [cell2cc_cell[c] for c in morse_decomposition.morseset(morse_node)]
        morse_graph_node = permutation[morse_node]
        morse_set = {"index" : morse_graph_node, "cells" : morse_cells}
        morse_sets_data.append(morse_set)
    morse_sets_json_data = {"morse_sets" : morse_sets_data}
    return morse_sets_json_data
def morse_sets_json ( network , morse_graph , morse_decomposition ) : cell2cc_cell = dsgrn_cell_to_cc_cell_map ( network ) morse_nodes = range ( morse_decomposition . poset ( ) . size ( ) ) permutation = morse_graph . permutation ( ) morse_sets_data = [ ] for morse_node in morse_nodes : morse_cells = [ cell2cc_cell [ c ] for c in morse_decomposition . morseset ( morse_node ) ] morse_graph_node = permutation [ morse_node ] morse_set = { "index" : morse_graph_node , "cells" : morse_cells } morse_sets_data . append ( morse_set ) morse_sets_json_data = { "morse_sets" : morse_sets_data } return morse_sets_json_data
Return json data for Morse sets.
Return json data for Morse sets .
"""Return json data for Morse sets.""" # Get a mapping from DSGRN top cells to cc top cells # Get list of Morse nodes # Permutation that gives node index from Morse set index # Morse sets data # Get Morse graph node index
network
morse_graph
morse_decomposition