Draw A graph with cubes

I have the following problem, where given a graph in the adjacency matrix, I need to simulate it with objects.
Node → Cube
Edge → Cube scaled and rotated and positioned between nodes

I Have done it, for example, the following picture
5943893--636443--1.PNG
The problem occurred when there is a node that came between 2 other nodes connected, where the edge passes through it, like the following pic.
5943893--636446--2.PNG
I need a way to handle it, maybe like the following pic, or other ideas …!!
5943893--636449--3.PNG

Easiest way would probably be to set up an algorithm that projects a sphere around the node that’s in the way, sets up a new invisible node on that sphere as a waypoint to go around. You’ll need to fiddle with the parameters a bit, and it could get messy with a lot of nodes, but it should be at least somewhat feasible. If you do this for every intersecting edge, it should even work if the result is again intersecting something.