Calculate D3 Graphviz height and width before rendering

I am fairly new to using GraphViz so I apologize if the answer to this seems obvious. For some background, I am working on a website where users can display varying sizes of graphs using d3 graphviz.

I am having issues where graphs with a small number of nodes, say 3 or 4, is right in the users’ face, since graphviz sets initial zoom to fit. But, for bigger graphs, the initial zoom setting to fit is no problem.

I had already tried using the minimum size attribute size="500!,500!", but it did not seem to work (maybe I’m using it wrong).

My initial thought was to try to compare the graph’s width to the user’s viewport width, but am having trouble finding a function to compute the graph’s width before rendering.

So is there a way that I’m completely missing to limit the maximum scale of the initial fit zoom so that small graphs maintain a reasonable, readable size on the screen, while still allowing large graphs to scale down and fit within the container?

size uses inches for units, a much smaller value would work better

Additionally, both the svg and the dot output formats provide dimensions of the resulting graph (width & height for svg, bb for dot). You could produce either format and then make desired adjustments before actually displaying the result (yes, you would have to rerun if you produced dot at first)