| 193 | hsgr_edges = list(hsgr_edges) |
| 194 | |
| 195 | def edge_params(e): |
| 196 | params = { |
| 197 | "label": e.weight, |
| 198 | "dir": "both", # not really, but enables arrowtail |
| 199 | # "constraint": "false", |
| 200 | } |
| 201 | if e.forward and e.backward: |
| 202 | params["arrowhead"] = "normal" |
| 203 | params["arrowtail"] = "dotnormal" |
| 204 | elif e.forward: |
| 205 | params["arrowhead"] = "normal" |
| 206 | params["arrowtail"] = "dot" |
| 207 | elif e.backward: |
| 208 | params["arrowhead"] = "none" |
| 209 | params["arrowtail"] = "dotnormal" |
| 210 | return params |
| 211 | |
| 212 | def draw_edge(e, params, sub): |
| 213 | dot.write(f" {sub}{e.source}->{sub}{e.target}[{join(params)}];\n") |