I created about one hundred randomly scattered circles. Now I want every single one of them connected by a line, depending on how far the circles are away from each other. In other words, if a single circle is surrounded by 10 other ones a centimeter away, I want them to be connected with lines.

Basically, I am creating a figure that looks like a large network and then cluster it.

  • 1
    This sounds like you need to solve a clustering problem. I am not sure if Inkscape can do this. How did you create these circles?
    – m00am
    Jul 28, 2016 at 8:49
  • I have a few ideas that might speed this up if it's just a final "constellation" network look you're going for. However, the technique generates dots from user drawn lines, which is different to your question... Would this be helpful?
    – johnp
    Jul 28, 2016 at 16:55
  • I made the circles in inkscape using the paint tool. Jul 29, 2016 at 16:12

2 Answers 2


No, Inkscape can't do this on its own.

Drawing the lines manually can be made a little easier with a few tricks.

  • Enable snap other points and snap centers of objects.
    With these enabled, you can draw directly between the centers of two circles.
  • Use the Measure tool M.
    If snapping is enabled, this will quickly tell you if two circles are within the desired range.
  • Draw your lines on a layer below the circles.
    If you draw the lines on the same layer as the circles, they will on top by default and you'll need to manually send them backwards. If you put the lines on a separate layer, you can just move that layer below whatever layer contains the circles.

It is possible for Inkscape to do this with an extension, but you're asking to do something very specific, so an extension does not exist. A script would need to iterate through each circle and calculate it's center, compare it to the centers of other circles and create new paths. If you know Python, writing an extension might be an option for you. For more about scripts in Inkscape, see How to get started on writing extensions.


Are there just your circles or do you have other objects in your image as well?
In the first case, I would generate the random distribution of points in my favorite programming language, do the calculation there, and output the xml-code for simple circles

 <circle cx="50" cy="50" r="40" stroke="none" fill="red" />

and connections with that, embed the whole thing in a SVG-file and do the finish/control (border, background color, image size, export to png, ...) in Inkscape. The connections can be done with a line:

 <line x1="50"  y1="50" x2="250"   y2="200" style="stroke:#006600;"/>
  • What about the connections? This is what the OP is looking to create
    – johnp
    Jul 28, 2016 at 15:38
  • They can be done with a line, for example. Jul 28, 2016 at 21:28
  • I see, but how does this generate the connections without having to enter it manually for each one? Not trying to be overly critical. I'm just curious for an answer to this also
    – johnp
    Jul 28, 2016 at 22:04
  • 1
    @johnp: I don't know how Goldname made his 100 circles. My suggestion is, to do them programmatically. An alternative would be, to read the values with a program. The distance can be calculated with Pythagoras. Jul 28, 2016 at 22:17
  • I made the circles in inkscape using the paint tool. Jul 29, 2016 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.