src/DSGRN/SaveDatabaseJSON.py
def parameter_graph_json(parameter_graph, vertices=None):
    """Return json data for parameter graph."""
    # Get list of vertices if none
    if vertices == None:
        vertices = list(range(parameter_graph.size()))
    all_edges = [(u, v) for u in vertices for v in parameter_graph.adjacencies(u, 'codim1') if v in vertices]
    # Remove double edges (all edges are double)
    edges = [(u, v) for (u, v) in all_edges if u > v]
    nodes = []
    for v in vertices:
        node = {"id" : v}
        # node = {"id" : str(v)}
        nodes.append(node)
    links = []
    for (u, v) in edges:
        link = {"source" : u, "target" : v}
        # link = {"source" : str(u), "target" : str(v)}
        links.append(link)
    parameter_graph_json_data = {"parameter_graph" : {"nodes" : nodes, "links" : links}}
    return parameter_graph_json_data
Return json data for parameter graph.
Return json data for parameter graph.
Return json data for parameter graph .
def parameter_graph_json(parameter_graph, vertices=None):
    if vertices == None:
        vertices = list(range(parameter_graph.size()))
    all_edges = [(u, v) for u in vertices for v in parameter_graph.adjacencies(u, 'codim1') if v in vertices]
    edges = [(u, v) for (u, v) in all_edges if u > v]
    nodes = []
    for v in vertices:
        node = {"id" : v}
        nodes.append(node)
    links = []
    for (u, v) in edges:
        link = {"source" : u, "target" : v}
        links.append(link)
    parameter_graph_json_data = {"parameter_graph" : {"nodes" : nodes, "links" : links}}
    return parameter_graph_json_data
def parameter_graph_json ( parameter_graph , vertices = None ) : if vertices == None : vertices = list ( range ( parameter_graph . size ( ) ) ) all_edges = [ ( u , v ) for u in vertices for v in parameter_graph . adjacencies ( u , 'codim1' ) if v in vertices ] edges = [ ( u , v ) for ( u , v ) in all_edges if u > v ] nodes = [ ] for v in vertices : node = { "id" : v } nodes . append ( node ) links = [ ] for ( u , v ) in edges : link = { "source" : u , "target" : v } links . append ( link ) parameter_graph_json_data = { "parameter_graph" : { "nodes" : nodes , "links" : links } } return parameter_graph_json_data
Return json data for parameter graph.
Return json data for parameter graph .
"""Return json data for parameter graph.""" # Get list of vertices if none # Remove double edges (all edges are double) # node = {"id" : str(v)} # link = {"source" : str(u), "target" : str(v)}
parameter_graph
vertices