Ortho splines problem

What could be the problem with these graphs when using graph_attr={‘splines’: ‘ortho’}
image
Python code for example:

            case ast.Assign(targets, value):
                assign_id = getid("assignment")
                label = f"Присвоить {ast.unparse(targets[0])} значение {ast.unparse(value)}"
                parent_node = get_parent_node(root_ast_node,
                                              ast_node)
                print(tail_id)
                graph.node(assign_id, label, shape="box", width="2.5", fixedsize="true", headport="n", tailport="s")
                if tail_id and not tail_id.startswith("cond"):  
                    graph.edge(tail_id, assign_id, dir="forward", headport="n")
                elif tail_id.startswith("cond"):
                    if isinstance(parent_node, ast.If):
                        if ast_node in parent_node.orelse:
                            graph.edge(tail_id, assign_id, label="no", dir="forward", headport="n", tailport="e")
                        else:
                            graph.edge(tail_id, assign_id, label="yes", dir="forward", headport="n", tailport="s")

                return assign_id
...
graph = graphviz.Graph(format='png', graph_attr={'splines': 'ortho'})

ortho does not work with ports. There are multiple issues concerning this problem

Here is a possible work-around. Ortho edges and ports - a partial work-around

Thanks for the solution. Despite the fact that it has become many times better, if each block in the initial script has “headport”=“n”, in the final form there are arrows, if several graphs need to come to one block (and even to one point), then you can watch something like this


I hope for your help, because I have a great desire to improve, as far as I understand, your method of solving this problem.

Will you share the source input?

As planned, this product should convert python code into a flowchart (according to Russian GOST, you know). The current implementation is still far from perfect. I do not pursue selfish goals, but to share the source code I need contacts

I do not need the Python, just the Graphviz that it can produce.

Graph.gv (2.3 KB)
myFile.dot (3.5 KB)
myfileFixed.dot (23.9 KB)

Well… Anyway, I’ll be looking forward to an update for this fix.