What's a good way to take a graph of nodes and draw it in your UI as a map?
I already have a graph and I'm happy with how it's generated. However, it doesn't have any positional data for the nodes -- just their connections. How can I use it to draw a map along the lines of Slay The Spire:
I've seen examples (Procedural Dungeon Generation #3, stsmapgen) that populate a space with nodes and connect those nodes, but I want to have more control over how often I branch so I would prefer if my generation wasn't based derived from random node positions.
So far most answers I've found were to use graphviz, but obviously that's not feasible at runtime.
My graph starts at an entrance node, terminates at an exit node, all transitions are unidirectional, and each node can have at most four connections (one in and three out). Paths through the tree can branch off and merge back in to a later path.
My naïve approach of giving an offset for each of the three out transitions, doing a breadth-first walk of the tree, and assigning node positions based on the source node and the offset produced overlapping nodes. It seems like I'd need to push nodes away that are overlapping, but I'm hoping there's a simpler solution and one that doesn't require physics.