# Bundle diameter calculation algorithm with different wire sizes?

I would like to ask if anyone happens to know an algorithm or idea how to implement a way to calculate the bundle diameter given a multiple wires with different sizes. Something similar to graphical solution below

• @D.W. thanks for the suggestion - I submitted an answer with elaboration
– JimN
Commented May 3, 2023 at 5:53
• @JimN, outstanding, thank you! And for the future, it's fine to submit a short answer if that's all you have to say (in my opinion, you don't have to feel bad about submitting a short answer, such as your original comment).
– D.W.
Commented May 3, 2023 at 5:57
• Should the wires be packed optimally, or do they come in random "order" ?
– user16034
Commented May 3, 2023 at 7:16

Your problem is studied under the terminology of "circle packing." Specifically, packing unequal circles in a circle.

Beware that many resources that study 'circle packing' in a circle often consider just the problem of uniform-sized circles (as this problem is hard enough!) rather than your more general framework of unequal circles. See, for example, the Wikipedia page on circle packing: https://en.wikipedia.org/wiki/Circle_packing This mostly refers to uniform circles in a circle, but it does link to a page on packing unequal spheres (which is different than just your circular cross-section).

Here is a presentation that surveys a number of algorithms/strategies for packing circles in bounded spaces: https://www.math.uwaterloo.ca/~ervrscay/talks/Jiang-AMMCS-CAIMS-2015.pdf

Here is a Python implementation of unequal circle packing in a circle: https://scipython.com/blog/packing-circles-in-a-circle/ This solution produces a set of random circles, so if you have a specific problem instance with your wire widths, you would use those as input instead of the randomly-generated circles it creates. The algorithm works by sorting the circles by their size and placing the largest circles first.