def stg2dot(stg: networkx.DiGraph, fname_dot: Optional[str] = None) -> str: """ Creates a *dot* file from a state transition graph. Graph, node and edge attributes are passed to the *dot* file by adding the respective key and value pairs to the graph, node or edge data. Node and edge defaults are set by the specials graph keys *"node"* and *"edge"* and must have attribute dictionaries as values. For a list of attributes see http://www.graphviz.org/doc/info/attrs.html. **arguments**: * *stg*: state transition graph * *fname_dot*: name of *dot* file or *None* **returns**: * *text_dot*: content of dot file **example**:: >>> stg = primes2stg(primes, update, init) >>> stg.graph["label"] = "IRMA Network - State Transition Graph" >>> stg.graph["node"] = {"style":"filled", "color":"red"} >>> stg.graph["edge"] = {"arrowsize": 2.0} >>> stg.nodes["001000"]["fontsize"] = 20 >>> stg.adj["001110"]["001010"]["style"] = "dotted" >>> stg2image(stg, "irma_stg.pdf") """ return digraph2dot(stg, fname_dot)
def igraph2dot(igraph: networkx.DiGraph, fname_dot: Optional[str] = None) -> str: """ Generates a *dot* file from *igraph* and saves it as *fname_dot* or returns it as a string. **arguments**: * *igraph*: interaction graph * *fname_dot*: name of *dot* file **returns**: * *dot*: contents of dot file as text **example**:: >>> igraph2dot(igraph, "irma.dot") >>> dotfile = igraph2dot(igraph) """ return digraph2dot(igraph, fname_dot)
def htg2dot(htg: networkx.DiGraph, fname_dot: str = None) -> str: """ Creates a *dot* file of the *HTG*. **arguments**: * *HTG*: HTG * *fname_dot*: name of *dot* file or *None* **returns**: * *text_dot*: text content of dot file **example**:: >>> htg2dot(cgraph, "mapk_htg.dot") """ graph = htg.copy() convert_nodes_to_anonymous_strings(graph) return digraph2dot(graph, fname_dot)
def condensationgraph2dot(cgraph: networkx.DiGraph, fname_dot: str = None): """ Creates a *dot* file from a condensation graph. **arguments**: * *cgraph*: state transition graph * *fname_dot*: name of *dot* file or *None* **returns**: * *text_dot*: file as string if not *FnameDOT is None*, otherwise it returns *None* **example**:: >>> condensationgraph2dot(cgraph, "mapk_cgraph.dot") """ graph = cgraph.copy() convert_nodes_to_anonymous_strings(graph) return digraph2dot(graph, fname_dot)