You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found another small issue originating from the fact that graph.nodes is not an object anymore but a dictionary.
In graph.py two functions: to_dict and get_mermaid both try to use self.nodes as an object:
defto_dict(self) ->dict[tuple[str, str], set[str]]:
"""Returns graph representing this instance's nodes and egdes as dictionary."""res= {}
fornodeinself.nodes:
node_type="tumor"ifisinstance(node, Tumor) else"lnl"res[(node_type, node.name)] = {o.child.nameforoinnode.out}
returnresdefget_mermaid(self) ->str:
"""Prints the graph in mermaid format. Example: >>> graph_dict = { ... ("tumor", "T"): ["II", "III"], ... ("lnl", "II"): ["III"], ... ("lnl", "III"): [], ... } >>> graph = Representation(graph_dict) >>> graph.edge_params["spread_T_to_II"].set_param(0.1) >>> graph.edge_params["spread_T_to_III"].set_param(0.2) >>> graph.edge_params["spread_II_to_III"].set_param(0.3) >>> print(graph.get_mermaid()) # doctest: +NORMALIZE_WHITESPACE flowchart TD T-->|10%| II T-->|20%| III II-->|30%| III <BLANKLINE> """mermaid_graph="flowchart TD\n"foridx, nodeinenumerate(self.nodes):
foredgeinself.nodes[idx].out:
mermaid_graph+=f"\t{node.name}-->|{edge.spread_prob:.0%}| {edge.child.name}\n"returnmermaid_graph
This does not work anmymore. For get_mermaid for example we need to fix it like this:
I found another small issue originating from the fact that
graph.nodes
is not an object anymore but a dictionary.In
graph.py
two functions:to_dict
andget_mermaid
both try to useself.nodes
as an object:This does not work anmymore. For
get_mermaid
for example we need to fix it like this:(idx would not be needed anymore)
The text was updated successfully, but these errors were encountered: