39
\$\begingroup\$

Draw lines between every pair of distinct points for n points arranged in a circle, producing something like the below result. Shortest code (in bytes) wins! Your lines don't have to be transparent, but it looks better that way. The output must be a vector graphic, or be an image at least 600 pixels by 600 pixels (either saved to a file or displayed on the screen). To complete the challenge you must draw at least 20.

enter image description here

\$\endgroup\$
18
  • 7
    \$\begingroup\$ It'd be cool if you had to take in a number n and draw lines for n points. \$\endgroup\$
    – Yodle
    Commented Dec 1, 2016 at 17:45
  • 2
    \$\begingroup\$ I second this idea. Change it before someone gets the first answer. \$\endgroup\$
    – shooqie
    Commented Dec 1, 2016 at 17:53
  • 2
    \$\begingroup\$ @shooqie Then the title wouldn't make sense though, unless that can be edited by the mods? \$\endgroup\$
    – Yodle
    Commented Dec 1, 2016 at 17:54
  • 2
    \$\begingroup\$ I don't think changing 37 to an arbitrary n would add much to the challenge as I expect most solutions to work with any number anyway, especially because 37 is odd and hence there are no mirror symmetries. \$\endgroup\$
    – Laikoni
    Commented Dec 1, 2016 at 18:01
  • 3
    \$\begingroup\$ Do we take n as input or just pick an arbitrary n over 20? \$\endgroup\$
    – Riker
    Commented Dec 1, 2016 at 18:16

23 Answers 23

26
\$\begingroup\$

Mathematica, 13 bytes

CompleteGraph

lined-up-circle-37-points

Looks like this only fails to give a circular embedding for n=4, but the question states n>=20

\$\endgroup\$
6
  • 1
    \$\begingroup\$ ...and there was me trying to find the correct way to make a function to take n (I had the answer ready from the fixed 37) :( \$\endgroup\$ Commented Dec 1, 2016 at 18:23
  • 6
    \$\begingroup\$ @carusocomputing This function has nothing to do with "graphing" in the sense of plotting. Mathematica is also very good for graph theory problems and having a built-in to generate a complete graph seems like the first thing I would add if I added support for graphs to my language. The only reason this function happens to be useful for this challenge is that complete graphs are by default rendered with all vertices arranged in a circle. \$\endgroup\$ Commented Dec 1, 2016 at 18:46
  • 2
    \$\begingroup\$ If you're gonna support graphs, you better have a built in complete graph function, IMO. \$\endgroup\$
    – user61980
    Commented Dec 1, 2016 at 18:47
  • 2
    \$\begingroup\$ @carusocomputing Welcome to Mathematica, the language that has a built-in for every existing function. :-P \$\endgroup\$
    – hyperneutrino
    Commented Dec 2, 2016 at 1:47
  • 1
    \$\begingroup\$ I was downloading NetLogo because I thought "multi-turtle will make short work of this!" then remembered you Mathematicans are using the grown-up version. \$\endgroup\$ Commented Dec 2, 2016 at 15:48
13
\$\begingroup\$

MATL, 16 14 bytes

As I'm not terribly fluent with MATL I expect that this is somewhat more golfable. (Would be nice to at least beat Mathematica :-) I.e. the the flip w is not optimal, it could probably be avoided...

:G/4*Jw^2Z^!XG

Test it Online! (Thanks @Suever for this service, thanks @DrMcMoylex for -2 bytes.)

Explanation (for N=3):

  :               Generate Range 1:input:       [1,2,3]
   G/             Divide By the first input     [0.333,0.666,1]
     4*           Multiply by 4                 [1.33,2.66,4.0]
       Jw^        i ^ (the result so far)       [-0.49+ 0.86i,-.5-0.86i,1.00]
                  (This results in a list of the n-th roots of unity)
          2Z^     Take the cartesian product with itself (i.e. generate all 2-tuples of those points)
             !XG  Transpose and plot

It is worth noting that for generating the N-th roots of unity you can use the formula exp(2*pi*i*k/N) for k=1,2,3,...,N. But since exp(pi*i/2) = i you could also write i^(4*k/N) for k=1,2,3,...,N which is what I'm doing here.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You can change XH:H to :G \$\endgroup\$
    – DJMcMayhem
    Commented Dec 1, 2016 at 22:08
  • 1
    \$\begingroup\$ Aaah I forgot about G thank you very much! \$\endgroup\$
    – flawr
    Commented Dec 1, 2016 at 22:10
13
\$\begingroup\$

PICO-8, 131 bytes

I wasn't really sure if I'd be breaking any rules, but I did it anyway!

Golfed

p={}for i=0,19 do add(p,{64+64*cos(i/20),64+64*sin(i/20)})end for x in all(p)do for y in all(p)do line(x[1],x[2],y[1],y[2])end end

Ungolfed

points={}

for i=0,19 do 
  x=64+64*cos(i/20)
  y=64+64*sin(i/20)
  add(points,{x,y})
end

for x in all(points) do
  for y in all(points) do
    line(x[1],x[2],y[1],y[2])
  end
end

128x128 madness

PICO-8 is a Lua based fantasy console with a native resolution of 128x128. I made the circle as big as I could...

\$\endgroup\$
9
\$\begingroup\$

Mathematica, 42 bytes

Creates a set of 37 points arranged in a circle, and then draws lines between all possible subsets of two points. Someone posted a shorter answer that takes advantage of CompleteGraph, but I believe this is the shortest one aside from those relying on CompleteGraph.

Graphics@Line@Subsets[CirclePoints@37,{2}]

enter image description here

\$\endgroup\$
2
  • 3
    \$\begingroup\$ There's no need to avoid drawing lines from a point to itself, so you could save 3 bytes by using Tuple. You also need to update this to accept arbitrary n, but conveniently that won't cost you any bytes. \$\endgroup\$
    – user61980
    Commented Dec 1, 2016 at 19:45
  • 1
    \$\begingroup\$ Meant to say Tuples \$\endgroup\$
    – user61980
    Commented Dec 1, 2016 at 20:30
9
\$\begingroup\$

HTML + JS (ES6), 34 + 177 164 162 = 196 bytes

Using the HTML5 Canvas API.

See it on CodePen.

f=n=>{with(Math)with(c.getContext`2d`)for(translate(S=300,S),O=n;O--;)for(rotate(a=PI*2/n),N=n;N--;)beginPath(stroke()),lineTo(0,S),lineTo(sin(a*N)*S,cos(a*N)*S)}


/* Demo */
f(20)
<canvas id=c width=600 height=600>

-13 bytes: Removed closePath(), moved stroke() inside beginPath()

-2 bytes: Defined variable a inside rotate()

\$\endgroup\$
8
\$\begingroup\$

Java, 346 338 322 301 Bytes

This solution works for all n>1, even though the original post didn't require that, it does.

My favorite is n=5, don't ask why, also, if you want a cooler GUI, use:

int a=Math.min(this.getHeight(),this.getWidth())/2;

In place of the hard-coded 300, it'll use the width or height of the frame as the diameter.

Saved 8 bytes thanks to Shooqie. Saved 21 bytes thanks to Geobits.

import java.awt.*;void m(final int n){new Frame(){public void paint(Graphics g){Point[]p=new Point[n];int a=300;for(int i=1;i<n+1;i++){p[i-1]=new Point(a+(int)(a*Math.cos(i*2*Math.PI/n)),a+(int)(a*Math.sin(i*2*Math.PI/n)));for(int j=0;j<i;j++){g.drawLine(p[i-1].x,p[i-1].y,p[j].x,p[j].y);}}}}.show();}

Output for n=37:

enter image description here

\$\endgroup\$
15
  • \$\begingroup\$ You can drop Frame x= and final (I think?) \$\endgroup\$
    – shooqie
    Commented Dec 1, 2016 at 18:26
  • \$\begingroup\$ @shooqie oops, Frame x was from another solution that involved a thread. You need the final though as it's an internal class reference to an external variable in the owning class. \$\endgroup\$ Commented Dec 1, 2016 at 18:27
  • \$\begingroup\$ It works just fine on my machine. BTW I think you can shave off some bytes by moving int declarations outside the for loops \$\endgroup\$
    – shooqie
    Commented Dec 1, 2016 at 18:29
  • \$\begingroup\$ @shooqie in Java 6 it's saying "Cannot refer to the non-final local variable n in an enclosing scope" at compile time. \$\endgroup\$ Commented Dec 1, 2016 at 18:34
  • \$\begingroup\$ It worked for me on Java 8, but after you edited your post I'm only getting white screen. \$\endgroup\$
    – shooqie
    Commented Dec 1, 2016 at 18:36
7
\$\begingroup\$

Python 2, 258 235 229 Bytes

import itertools as T,math as M
from PIL import Image as I,ImageDraw as D
s=300
n=input()
t=2*M.pi/n
o=I.new('RGB',(s*2,)*2)
for x in T.combinations([(s*M.cos(t*i)+s,s*M.sin(t*i)+s)for i in range(n)],2):D.Draw(o).line(x)
o.show()

Output for n=37
n=37

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Wouldn't be from PIL import* shorter? \$\endgroup\$ Commented Dec 2, 2016 at 19:57
  • \$\begingroup\$ @RomanGräf PIL is a weird package, you can't import *, depending on how you install, you could skip the PIL and import Image/ImageDraw directly \$\endgroup\$
    – Rod
    Commented Dec 5, 2016 at 10:38
6
\$\begingroup\$

Octave, 88 69 bytes

N=input('');t=0:2*pi/N:N;k=nchoosek(1:N,2)';line(cos(t)(k),sin(t)(k))

Output for N=37:

enter image description here

Output for N=19:

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Oh, I didn't even notice that there was already another Octave answer:) \$\endgroup\$
    – flawr
    Commented Dec 1, 2016 at 21:31
  • \$\begingroup\$ Anyway, beat ya :-) \$\endgroup\$
    – flawr
    Commented Dec 1, 2016 at 22:21
  • \$\begingroup\$ By a mile! My first thought was gplot too, but I didn't manage to make it short enough... \$\endgroup\$ Commented Dec 2, 2016 at 9:05
6
\$\begingroup\$

Perl, 229 bytes

It uses the same formula as most languages that don't have convenient builtin for this challenge (even if I didn't look at them to find it, but that's a fairly easy to find formula). So not very interesting, but there are usually not a lot of Perl answers to this kind of challenges, so I just wanted to propose one.

$i=new Imager xsize=>700,ysize=>700;for$x(1..$_){for$y(1..$_){$i->line(color=>red,x1=>350+300*cos($a=2*pi*$x/$_),x2=>350+300*cos($b=2*pi*$y/$_),y1=>350+300*sin$a,y2=>350+300*sin$b)}}$i->write(file=>"t.png")

And you'll need -MImager (9 bytes), -MMath::Trig (providing pi, 13 bytes), and -n (1 byte) ==> + 23 bytes.

To run it :

perl -MImager -MMath::Trig -ne '$i=new Imager xsize=>700,ysize=>700;for$x(1..$_){for$y(1..$_){$i->line(color=>red,x1=>350+300*cos($a=2*pi*$x/$_),x2=>350+300*cos($b=2*pi*$y/$_),y1=>350+300*sin$a,y2=>350+300*sin$b)}}$i->write(file=>"t.png")' <<< 27

It will create a file named t.png which contains the image.

You'll need to install Imager though, but no worries, it's quite easy :

(echo y;echo) | perl -MCPAN -e 'install Imager'

(The echos will configure you cpan if you've never used it before. (actually that will only work if your perl is recent enough, I think for most of you it will be, and I'm sorry for the others!)).

And the more readable version (yes, it's fairly readable for a Perl script!) :

#!/usr/bin/perl -n
use Imager;
use Math::Trig;
$i=Imager->new(xsize=>700,ysize=>700);
for $x (1..$_){
    for $y (1..$_){
    $i->line(color=>red,x1=>350+300*cos($a=2*pi*$x/$_), x2=>350+300*cos($b=2*pi*$y/$_),
         y1=>350+300*sin($a), y2=>350+300*sin($b));
    }
}
$i->write(file=>"t.png");

enter image description here

-1 byte thanks to Titus.

\$\endgroup\$
4
  • \$\begingroup\$ Does Perl require braces around single commands? \$\endgroup\$
    – Titus
    Commented Dec 4, 2016 at 13:07
  • \$\begingroup\$ @Titus If you refer to the braces after the for loops, then yes, they are mandatory. \$\endgroup\$
    – Dada
    Commented Dec 4, 2016 at 19:10
  • \$\begingroup\$ There´s a blank before y2. I bet you don´t need that. And can you write to STDOUT? \$\endgroup\$
    – Titus
    Commented Dec 5, 2016 at 23:19
  • \$\begingroup\$ @Titus hmm indeed, thanks. I think I my terminal put a newline here so i didn't saw the space. \$\endgroup\$
    – Dada
    Commented Dec 5, 2016 at 23:23
5
\$\begingroup\$

GeoGebra, 92 bytes

a=polygon((0,0),(1,0),20)
sequence(sequence(segment(vertex(a,i),vertex(a,j)),j,1,20),i,1,20)

Each line is separately entered into the input bar. Here is a gif showing the execution:

Execution

How it works

The polygon command creates a 20-sided polygon, with the vertices of the baseline at (0,0) and (1,0). The next command then iterates over each vertex of the polygon with index i, using the sequence and vertex commands, and for each vertex with index i, draws a line segment to every other vertex with index j using the segment command.

\$\endgroup\$
4
\$\begingroup\$

PHP, 186 184 196 bytes

imagecolorallocate($i=imagecreate(601,601),~0,~0,~0);for(;$a<$p=2*M_PI;)for($b=$a+=$p/=$argv[1];$b>0;)imageline($i,(1+cos($a))*$r=300,$r+$r*sin($a),$r+$r*cos($b-=$p),$r+$r*sin($b),1);imagepng($i);

writes the image to STDOUT

breakdown

// create image with white background
imagecolorallocate($i=imagecreate(601,601),~0,~0,~0);

// loop angle A from 0 to 2*PI
for(;$a<$p=2*M_PI;)
    // loop angle B from A down to 0
    for($b=$a+=$p/=$argv[1];$b;)    // ($a pre-increment)
        // draw black line from A to B
        imageline($i,                           // draw line
            (1+cos($a))*$r=300,$r+$r*sin($a),   // from A
            $r+$r*cos($b-=$p),$r+$r*sin($b),    // to B ($b pre-decrement)
            1                                   // undefined color=black
        );
// output
imagepng($i);

-12 bytes for fixed n=20

Replace $p=2*M_PI with 6 (-8), /=$argv[1] with =M_PI/10 (-2), and $b>0 with $b (-2)

Using exact PI/10 doesn´t hurt. With .3142, the rounding errors from the parametrized version remained, but with M_PI/10 they vanished and I can check $b(<>0) instead of $b>0. I could have saved two bytes with .314, but that would have off-set the points.

The limit $a<6 is sufficiently exact for 20 points.

exact PI graph

174 bytes for fixed n=314

imagecolorallocate($i=imagecreate(601,601),~0,~0,~0);for(;$a<314;)for($b=$a++;$b--;)imageline($i,(1+cos($a))*$r=300,$r+$r*sin($a),$r+$r*cos($b),$r+$r*sin($b),1);imagepng($i);

Using 314 points results in a filled circle in that resolution (as do 136,140, every even number above that, and everything above 317).

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Good answer, but it seems you've hardcoded 20 instead of taking that as input? \$\endgroup\$
    – Riking
    Commented Dec 1, 2016 at 23:09
  • 1
    \$\begingroup\$ @Riking: True. But I can see no demand in the challenge for parametrizing it. \$\endgroup\$
    – Titus
    Commented Dec 2, 2016 at 11:41
4
\$\begingroup\$

NetLogo - 44 bytes

cro 20[create-links-to other turtles fd 20]

NetLogo output

\$\endgroup\$
4
\$\begingroup\$

R, 127 123 bytes

plot((e=cbind(sin(t<-seq(0,2*pi,l=(n=21)))*2,cos(t)*2)));for(i in 2:n)for(j in 1:i)lines(c(e[i,1],e[j,1]),c(e[i,2],e[j,2]))

Produces :

Nice axis' labels uh ?

-4 bytes thanks to @Titus !

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Not shorter, but it could be faster with for(i in 2:n){for(j in 1:i)...}. Does Rrequire the braces? \$\endgroup\$
    – Titus
    Commented Dec 4, 2016 at 13:05
  • \$\begingroup\$ @Titus You're right ! And no, no braces needed there. Thanks ! \$\endgroup\$
    – Rudier
    Commented Dec 18, 2016 at 13:18
3
\$\begingroup\$

BBC BASIC, 98 ascii characters

Tokenised filesize 86 bytes

r=600V.5142;29,r;r;:I.n:t=2*PI/n:F.i=1TOn*n:a=i DIVn*t:b=i MODn*t:L.r*SINa,r*COSa,r*SINb,r*COSb:N.

Dowload interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

There's nothing wrong with drawing every line twice, the appearance is identical :-P

Ungolfed

  r=600                              :REM Radius 600 units. 2 units per pixel, so 300 pixels
  VDU5142;29,r;r;                    :REM Set mode 20 (600 pixels high) and move origin away from screen corner
  INPUTn                             :REM Take input.
  t=2*PI/n                           :REM Step size in radians.
  FORi=1TOn*n                        :REM Iterate through all combinations.
    a=i DIVn*t                       :REM Get two angles a and b
    b=i MODn*t                       :REM by integer division and modlo
    LINEr*SINa,r*COSa,r*SINb,r*COSb  :REM calculate cartesian coordinates and draw line
  NEXT

Output n=21

This looks much better in the original rendering than in the browser.

<code>enter image description here</code>

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for reminding me of the LINE function. Beats DRAW... \$\endgroup\$
    – steenbergh
    Commented Dec 1, 2016 at 22:04
3
\$\begingroup\$

Octave, 50 48 46 45 bytes

@(N)gplot((k=0:2*pi/N:N)+k',[cos(k);sin(k)]')

This is an anyonmous function that plots the graph we're looking for.

Explanation:

(k=0:2*pi/N:N)+k' Makes a full N+1 x N+1 adjecency matrix and simultaneously defines the vector k of angles, which we we use then for [cos(k);sin(k)]', a matrix of coordinates where each graph node is positioned. gplot just plots the graph that we want.

For N = 29 we get:

enter image description here

\$\endgroup\$
2
\$\begingroup\$

JavaScript (ES5)/SVG (HTML5), 181 bytes

document.write('<svg viewBox=-1e3,-1e3,2e3,2e3><path stroke=#000 fill=none d=M1e3,0')
with(Math)for(i=37;--i;)for(j=37;j--;)document.write('L'+1e3*cos(a=i*j*PI*2/37)+','+1e3*sin(a))

Only works for prime numbers, such as the original suggestion of 37. You can halve (rounded up) the initial value of i to obtain a fainter image. You can also consistently adjust the 1e3,2e3 to other values to taste (I started with 300,600 but decided that it was too coarse).

\$\endgroup\$
2
\$\begingroup\$

MATLAB, 36 bytes

@(n)plot(graph(ones(n),'Om'),'La','c')

This is an anoymous function that creates the plot.

@(n)                                     Define an anonymous fuction of 𝘯
               ones(n)                   Create an 𝘯×𝘯 matrix of ones
         graph(       ,'Om')             Create a graph object with that adjacency
                                         matrix, omitting self-loops
    plot(                   ,'La','c')   Plot the graph with a circular layout

Example:

enter image description here

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ I'm surprised graph is not part of the bioinformatic toolbox... didn't even know it existed... Nice :) \$\endgroup\$ Commented Dec 2, 2016 at 13:08
1
\$\begingroup\$

QBasic 4.5, 398 271 bytes

CLS:SCREEN 11:DEFSTR M-Z:DEFDBL A-L
INPUT"N",A:I=(360/A)*.0175:J=230
Q=",":FOR E=0 TO A
FOR F=E TO A
M=x$(COS(I*E)*J+J):N=x$(SIN(I*E)*J+J):O=x$(COS(I*F)*J+J):P=x$(SIN(I*F)*J+J):DRAW "BM"+M+Q+N+"M"+O+Q+P
NEXT:NEXT
FUNCTION x$(d):x$=LTRIM$(STR$(CINT(d))):END FUNCTION

The screen in QBasic can onl be 640x480, so the circle has a radius of only 230 px, unfortunately. Also, there's some artifacting because of float-to-int precision loss. Looks like this for N=36: enter image description here

EDIT: I didn't need the storage, the type declaration and all the looping. Calculating all Carthesians from Polars in place is 50% cheaper in byte count...

\$\endgroup\$
1
\$\begingroup\$

QBIC, 98 94 bytes

$SCREEN 11|:i=6.3/a j=230[0,a|[b,a|line(cos(b*i)*j+j,sin(b*i)*j+j)-(cos(c*i)*j+j,sin(c*o)*j+j)

I've converted my original QBasic answer @LevelRiverSt 's answer to QBIC. I thought this would rely too heavily on functions that are not built into QBIC to be feasible, but as it turns out, it saves another 90 bytes. Substituting the DRAW for LINE saves another 80 bytes. I knew I was forgetting something simple...

When run with a command line parameter of 36, it looks like this:

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Processing, 274 bytes (239 + size call and function call)

void d(int s){float a=2*PI/s,x=0,y=-400,m,n;float[][]p=new float[2][s];translate(400,400);for(int i=0;i<s;i++){m=x*cos(a)-y*sin(a);n=x*sin(a)+y*cos(a);x=m;y=n;p[0][i]=x;p[1][i]=y;for(int j=0;j<i;j++)line(p[0][j],p[1][j],p[0][i],p[1][i]);}}
void setup(){size(800,800);d(50);}

I honestly don't know why, but setup had to be on the second line. I used https://en.wikipedia.org/wiki/Rotation_matrix to help me calculate the maths for rotation. This program calculates the points and pushes them to an array, with which we are using to draw lines.

Here is a picture of a polygon with 50 edges (the 100 edges one was almost completely black)

50 points

You can add stroke(0,alpha); to have transparent edges, where alpha is the opacity of the line. Here's the same polygon with alpha of 20.

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Bash + Jelly + GraphViz, 52 characters, 52 or 63 bytes

Given that the programs in question disagree on which character encoding to use, the program is full of control characters. Here's what it looks like under xxd, in Latin-1 encoding (which represents each character in one byte):

00000000: 6a65 6c6c 7920 6520 2793 5213 636a 0c8e  jelly e '.R.cj..
00000010: 2d2d 59fe 9a3f 1d15 dc65 34d3 8442 7f05  --Y..?...e4..B..
00000020: 1172 80cf fb3b ff7d 277c 6369 7263 6f20  .r...;.}'|circo 
00000030: 2d54 7073                                -Tps

I couldn't actually get the program to run, though, without converting the input into UTF-8 for some reason (which would make it 63 bytes long). Logically it should work as Latin-1 – none of the characters are outside the range 0 to 255 – but I keep getting "string index out of range" errors no matter how I configure the character encoding environment variables. So this will have to be counted as 63 bytes unless someone can figure out a way to run it without re-encoding it.

The program might be slightly more readable if we interpret it in Jelly's encoding:

jelly e 'ƓRŒcj€⁾--Y“Ȥ?øßṇe4ạ⁴B¶¦×r°Ẇ»;”}'|circo -Tps

The program takes the number of points on standard input and outputs a PostScript image on standard output. (It can trivially be adapted to output in any format GraphViz supports by changing the -Tps at the end; it's just that PostScript has the shortest name. Arguably, you can save five characters by removing the -Tps, but then you get output in GraphViz's internal image format that nothing else supports, which probably doesn't count for the purposes of the question.)

Fundamentally, this is just a Jelly program that calls into GraphViz to do the drawing; however, Jelly doesn't seem to have any capabilities for running external programs, so I had to use bash to link them together. (This also means that it's cheaper to make Jelly request input from stdin manually; normally it takes input from the command line, but that would mean extra bytes in the bash wrapper.) circo will automatically arrange all the points it's asked to draw in a circle, so the Jelly code just has to ask it to draw a list of points, all of which are connected to each other. Here's how it works:

ƓRŒcj€⁾--Y“Ȥ?øßṇe4ạ⁴B¶¦×r°Ẇ»;”}
Ɠ                               read number from stdin
 R                              produce range from 1 to that number
                                (here used to produce a list with
                                that many distinct elements)
  Œc                            select all unordered pairs from that
      ⁾--                       a string consisting of two hyphens
    j€                          join each pair via the string
         Y                      join on newlines
                            ;   prepend (in this context)
          “Ȥ?øßṇe4ạ⁴B¶¦×r°Ẇ»    "graph{node[shape=point]"
                             ”} follow output with a "}" character

The use of Jelly lets us slightly compress the string that configures the GraphViz output via its built-in dictionary. The dictionary has graph, node, and point. Annoyingly, it doesn't have shape (it has SHAPE, but GraphViz is case-sensitive), so we have to encode that character-by-character.

Here's the output for input 21 (with a slight modification to the program to make it output in a format that can be uploaded to Stack Exchange):

complete graph on 21 points

\$\endgroup\$
0
\$\begingroup\$

PHP + HTML SVG, 316 263 bytes

Golfed version with hardcoded n points and no input n parameter:

<svg height="610" width="610"><?for($i=1;$i<33;$i++){$x[]=300*sin(2*M_PI/32*$i)+305;$y[]=300*cos(2*M_PI/32)+305;}foreach($x as$j=>$w){foreach($y as$k=>$z){echo'<line x1="'.$x[$j].'" y1="'.$y[$j].'" x2="'.$x[$k].'" y2="'.$y[$k].'" style="stroke:red;"/>';}}?></svg>

Previous golfed version with input parameter for n points, 316 bytes:

<svg height="610" width="610"><?$n=$_GET[n];$d=2*M_PI/$n;$r=300;$o=305;for($i=1;$i<=$n;$i++){$x[]=$r*sin($d*$i)+$o;$y[]=$r*cos($d*$i)+$o;}foreach($x as$j=>$w){foreach($y as$k=>$z){echo'<line x1="'.$x[$j].'" y1="'.$y[$j].'" x2="'.$x[$k].'" y2="'.$y[$k].'" style="stroke:rgba(0,0,0,.15);stroke-width:1;" />';}}?></svg>

Usage: save in a file and call from the browser:

http://localhost/codegolf/circle.php?n=32

Ungolfed version with input parameter for n points and CSS:

<style>
line {
    stroke: rgba(0,0,0,.15);
    stroke-width:1;
}
</style>
<svg height="610" width="610">
<?php
$n=$_GET[n]; // number of points
$d=2*M_PI/$n; // circle parts
$r=300; // circle radius
$o=305; // offset x,y
for ($i=1;$i<=$n;$i++){
    $x[]=$r*sin($d*$i)+$o; // store x,y coordinates in array
    $y[]=$r*cos($d*$i)+$o;
}
foreach($x as $j => $w){ // iterate all x,y points and connect to each other
    foreach($y as $k => $z) {
        echo '<line x1="'.$x[$j].'" y1="'.$y[$j].'" x2="'.$x[$k].'" y2="'.$y[$k].'" />'."\n";   
    }
}
?>
</svg>

Couldn't attach a 32 points fully functional snippet because of the 30k characters limit for a single post. Here is a screenshot:

enter image description here

The attached snippet is limited to 18 points because of the 30k single post limit.

line {
stroke: rgba(0,0,0,.15);
stroke-width:1;
}
<svg height="610" width="610">
<line x1="407.6060429977" y1="586.90778623577" x2="407.6060429977" y2="586.90778623577" />
<line x1="407.6060429977" y1="586.90778623577" x2="497.83628290596" y2="534.81333293569" />
<line x1="407.6060429977" y1="586.90778623577" x2="564.80762113533" y2="455" />
<line x1="407.6060429977" y1="586.90778623577" x2="600.44232590366" y2="357.09445330008" />
<line x1="407.6060429977" y1="586.90778623577" x2="600.44232590366" y2="252.90554669992" />
<line x1="407.6060429977" y1="586.90778623577" x2="564.80762113533" y2="155" />
<line x1="407.6060429977" y1="586.90778623577" x2="497.83628290596" y2="75.186667064307" />
<line x1="407.6060429977" y1="586.90778623577" x2="407.6060429977" y2="23.092213764227" />
<line x1="407.6060429977" y1="586.90778623577" x2="305" y2="5" />
<line x1="407.6060429977" y1="586.90778623577" x2="202.3939570023" y2="23.092213764227" />
<line x1="407.6060429977" y1="586.90778623577" x2="112.16371709404" y2="75.186667064307" />
<line x1="407.6060429977" y1="586.90778623577" x2="45.192378864669" y2="155" />
<line x1="407.6060429977" y1="586.90778623577" x2="9.5576740963376" y2="252.90554669992" />
<line x1="407.6060429977" y1="586.90778623577" x2="9.5576740963376" y2="357.09445330008" />
<line x1="407.6060429977" y1="586.90778623577" x2="45.192378864668" y2="455" />
<line x1="407.6060429977" y1="586.90778623577" x2="112.16371709404" y2="534.81333293569" />
<line x1="407.6060429977" y1="586.90778623577" x2="202.3939570023" y2="586.90778623577" />
<line x1="407.6060429977" y1="586.90778623577" x2="305" y2="605" />
<line x1="497.83628290596" y1="534.81333293569" x2="407.6060429977" y2="586.90778623577" />
<line x1="497.83628290596" y1="534.81333293569" x2="497.83628290596" y2="534.81333293569" />
<line x1="497.83628290596" y1="534.81333293569" x2="564.80762113533" y2="455" />
<line x1="497.83628290596" y1="534.81333293569" x2="600.44232590366" y2="357.09445330008" />
<line x1="497.83628290596" y1="534.81333293569" x2="600.44232590366" y2="252.90554669992" />
<line x1="497.83628290596" y1="534.81333293569" x2="564.80762113533" y2="155" />
<line x1="497.83628290596" y1="534.81333293569" x2="497.83628290596" y2="75.186667064307" />
<line x1="497.83628290596" y1="534.81333293569" x2="407.6060429977" y2="23.092213764227" />
<line x1="497.83628290596" y1="534.81333293569" x2="305" y2="5" />
<line x1="497.83628290596" y1="534.81333293569" x2="202.3939570023" y2="23.092213764227" />
<line x1="497.83628290596" y1="534.81333293569" x2="112.16371709404" y2="75.186667064307" />
<line x1="497.83628290596" y1="534.81333293569" x2="45.192378864669" y2="155" />
<line x1="497.83628290596" y1="534.81333293569" x2="9.5576740963376" y2="252.90554669992" />
<line x1="497.83628290596" y1="534.81333293569" x2="9.5576740963376" y2="357.09445330008" />
<line x1="497.83628290596" y1="534.81333293569" x2="45.192378864668" y2="455" />
<line x1="497.83628290596" y1="534.81333293569" x2="112.16371709404" y2="534.81333293569" />
<line x1="497.83628290596" y1="534.81333293569" x2="202.3939570023" y2="586.90778623577" />
<line x1="497.83628290596" y1="534.81333293569" x2="305" y2="605" />
<line x1="564.80762113533" y1="455" x2="407.6060429977" y2="586.90778623577" />
<line x1="564.80762113533" y1="455" x2="497.83628290596" y2="534.81333293569" />
<line x1="564.80762113533" y1="455" x2="564.80762113533" y2="455" />
<line x1="564.80762113533" y1="455" x2="600.44232590366" y2="357.09445330008" />
<line x1="564.80762113533" y1="455" x2="600.44232590366" y2="252.90554669992" />
<line x1="564.80762113533" y1="455" x2="564.80762113533" y2="155" />
<line x1="564.80762113533" y1="455" x2="497.83628290596" y2="75.186667064307" />
<line x1="564.80762113533" y1="455" x2="407.6060429977" y2="23.092213764227" />
<line x1="564.80762113533" y1="455" x2="305" y2="5" />
<line x1="564.80762113533" y1="455" x2="202.3939570023" y2="23.092213764227" />
<line x1="564.80762113533" y1="455" x2="112.16371709404" y2="75.186667064307" />
<line x1="564.80762113533" y1="455" x2="45.192378864669" y2="155" />
<line x1="564.80762113533" y1="455" x2="9.5576740963376" y2="252.90554669992" />
<line x1="564.80762113533" y1="455" x2="9.5576740963376" y2="357.09445330008" />
<line x1="564.80762113533" y1="455" x2="45.192378864668" y2="455" />
<line x1="564.80762113533" y1="455" x2="112.16371709404" y2="534.81333293569" />
<line x1="564.80762113533" y1="455" x2="202.3939570023" y2="586.90778623577" />
<line x1="564.80762113533" y1="455" x2="305" y2="605" />
<line x1="600.44232590366" y1="357.09445330008" x2="407.6060429977" y2="586.90778623577" />
<line x1="600.44232590366" y1="357.09445330008" x2="497.83628290596" y2="534.81333293569" />
<line x1="600.44232590366" y1="357.09445330008" x2="564.80762113533" y2="455" />
<line x1="600.44232590366" y1="357.09445330008" x2="600.44232590366" y2="357.09445330008" />
<line x1="600.44232590366" y1="357.09445330008" x2="600.44232590366" y2="252.90554669992" />
<line x1="600.44232590366" y1="357.09445330008" x2="564.80762113533" y2="155" />
<line x1="600.44232590366" y1="357.09445330008" x2="497.83628290596" y2="75.186667064307" />
<line x1="600.44232590366" y1="357.09445330008" x2="407.6060429977" y2="23.092213764227" />
<line x1="600.44232590366" y1="357.09445330008" x2="305" y2="5" />
<line x1="600.44232590366" y1="357.09445330008" x2="202.3939570023" y2="23.092213764227" />
<line x1="600.44232590366" y1="357.09445330008" x2="112.16371709404" y2="75.186667064307" />
<line x1="600.44232590366" y1="357.09445330008" x2="45.192378864669" y2="155" />
<line x1="600.44232590366" y1="357.09445330008" x2="9.5576740963376" y2="252.90554669992" />
<line x1="600.44232590366" y1="357.09445330008" x2="9.5576740963376" y2="357.09445330008" />
<line x1="600.44232590366" y1="357.09445330008" x2="45.192378864668" y2="455" />
<line x1="600.44232590366" y1="357.09445330008" x2="112.16371709404" y2="534.81333293569" />
<line x1="600.44232590366" y1="357.09445330008" x2="202.3939570023" y2="586.90778623577" />
<line x1="600.44232590366" y1="357.09445330008" x2="305" y2="605" />
<line x1="600.44232590366" y1="252.90554669992" x2="407.6060429977" y2="586.90778623577" />
<line x1="600.44232590366" y1="252.90554669992" x2="497.83628290596" y2="534.81333293569" />
<line x1="600.44232590366" y1="252.90554669992" x2="564.80762113533" y2="455" />
<line x1="600.44232590366" y1="252.90554669992" x2="600.44232590366" y2="357.09445330008" />
<line x1="600.44232590366" y1="252.90554669992" x2="600.44232590366" y2="252.90554669992" />
<line x1="600.44232590366" y1="252.90554669992" x2="564.80762113533" y2="155" />
<line x1="600.44232590366" y1="252.90554669992" x2="497.83628290596" y2="75.186667064307" />
<line x1="600.44232590366" y1="252.90554669992" x2="407.6060429977" y2="23.092213764227" />
<line x1="600.44232590366" y1="252.90554669992" x2="305" y2="5" />
<line x1="600.44232590366" y1="252.90554669992" x2="202.3939570023" y2="23.092213764227" />
<line x1="600.44232590366" y1="252.90554669992" x2="112.16371709404" y2="75.186667064307" />
<line x1="600.44232590366" y1="252.90554669992" x2="45.192378864669" y2="155" />
<line x1="600.44232590366" y1="252.90554669992" x2="9.5576740963376" y2="252.90554669992" />
<line x1="600.44232590366" y1="252.90554669992" x2="9.5576740963376" y2="357.09445330008" />
<line x1="600.44232590366" y1="252.90554669992" x2="45.192378864668" y2="455" />
<line x1="600.44232590366" y1="252.90554669992" x2="112.16371709404" y2="534.81333293569" />
<line x1="600.44232590366" y1="252.90554669992" x2="202.3939570023" y2="586.90778623577" />
<line x1="600.44232590366" y1="252.90554669992" x2="305" y2="605" />
<line x1="564.80762113533" y1="155" x2="407.6060429977" y2="586.90778623577" />
<line x1="564.80762113533" y1="155" x2="497.83628290596" y2="534.81333293569" />
<line x1="564.80762113533" y1="155" x2="564.80762113533" y2="455" />
<line x1="564.80762113533" y1="155" x2="600.44232590366" y2="357.09445330008" />
<line x1="564.80762113533" y1="155" x2="600.44232590366" y2="252.90554669992" />
<line x1="564.80762113533" y1="155" x2="564.80762113533" y2="155" />
<line x1="564.80762113533" y1="155" x2="497.83628290596" y2="75.186667064307" />
<line x1="564.80762113533" y1="155" x2="407.6060429977" y2="23.092213764227" />
<line x1="564.80762113533" y1="155" x2="305" y2="5" />
<line x1="564.80762113533" y1="155" x2="202.3939570023" y2="23.092213764227" />
<line x1="564.80762113533" y1="155" x2="112.16371709404" y2="75.186667064307" />
<line x1="564.80762113533" y1="155" x2="45.192378864669" y2="155" />
<line x1="564.80762113533" y1="155" x2="9.5576740963376" y2="252.90554669992" />
<line x1="564.80762113533" y1="155" x2="9.5576740963376" y2="357.09445330008" />
<line x1="564.80762113533" y1="155" x2="45.192378864668" y2="455" />
<line x1="564.80762113533" y1="155" x2="112.16371709404" y2="534.81333293569" />
<line x1="564.80762113533" y1="155" x2="202.3939570023" y2="586.90778623577" />
<line x1="564.80762113533" y1="155" x2="305" y2="605" />
<line x1="497.83628290596" y1="75.186667064307" x2="407.6060429977" y2="586.90778623577" />
<line x1="497.83628290596" y1="75.186667064307" x2="497.83628290596" y2="534.81333293569" />
<line x1="497.83628290596" y1="75.186667064307" x2="564.80762113533" y2="455" />
<line x1="497.83628290596" y1="75.186667064307" x2="600.44232590366" y2="357.09445330008" />
<line x1="497.83628290596" y1="75.186667064307" x2="600.44232590366" y2="252.90554669992" />
<line x1="497.83628290596" y1="75.186667064307" x2="564.80762113533" y2="155" />
<line x1="497.83628290596" y1="75.186667064307" x2="497.83628290596" y2="75.186667064307" />
<line x1="497.83628290596" y1="75.186667064307" x2="407.6060429977" y2="23.092213764227" />
<line x1="497.83628290596" y1="75.186667064307" x2="305" y2="5" />
<line x1="497.83628290596" y1="75.186667064307" x2="202.3939570023" y2="23.092213764227" />
<line x1="497.83628290596" y1="75.186667064307" x2="112.16371709404" y2="75.186667064307" />
<line x1="497.83628290596" y1="75.186667064307" x2="45.192378864669" y2="155" />
<line x1="497.83628290596" y1="75.186667064307" x2="9.5576740963376" y2="252.90554669992" />
<line x1="497.83628290596" y1="75.186667064307" x2="9.5576740963376" y2="357.09445330008" />
<line x1="497.83628290596" y1="75.186667064307" x2="45.192378864668" y2="455" />
<line x1="497.83628290596" y1="75.186667064307" x2="112.16371709404" y2="534.81333293569" />
<line x1="497.83628290596" y1="75.186667064307" x2="202.3939570023" y2="586.90778623577" />
<line x1="497.83628290596" y1="75.186667064307" x2="305" y2="605" />
<line x1="407.6060429977" y1="23.092213764227" x2="407.6060429977" y2="586.90778623577" />
<line x1="407.6060429977" y1="23.092213764227" x2="497.83628290596" y2="534.81333293569" />
<line x1="407.6060429977" y1="23.092213764227" x2="564.80762113533" y2="455" />
<line x1="407.6060429977" y1="23.092213764227" x2="600.44232590366" y2="357.09445330008" />
<line x1="407.6060429977" y1="23.092213764227" x2="600.44232590366" y2="252.90554669992" />
<line x1="407.6060429977" y1="23.092213764227" x2="564.80762113533" y2="155" />
<line x1="407.6060429977" y1="23.092213764227" x2="497.83628290596" y2="75.186667064307" />
<line x1="407.6060429977" y1="23.092213764227" x2="407.6060429977" y2="23.092213764227" />
<line x1="407.6060429977" y1="23.092213764227" x2="305" y2="5" />
<line x1="407.6060429977" y1="23.092213764227" x2="202.3939570023" y2="23.092213764227" />
<line x1="407.6060429977" y1="23.092213764227" x2="112.16371709404" y2="75.186667064307" />
<line x1="407.6060429977" y1="23.092213764227" x2="45.192378864669" y2="155" />
<line x1="407.6060429977" y1="23.092213764227" x2="9.5576740963376" y2="252.90554669992" />
<line x1="407.6060429977" y1="23.092213764227" x2="9.5576740963376" y2="357.09445330008" />
<line x1="407.6060429977" y1="23.092213764227" x2="45.192378864668" y2="455" />
<line x1="407.6060429977" y1="23.092213764227" x2="112.16371709404" y2="534.81333293569" />
<line x1="407.6060429977" y1="23.092213764227" x2="202.3939570023" y2="586.90778623577" />
<line x1="407.6060429977" y1="23.092213764227" x2="305" y2="605" />
<line x1="305" y1="5" x2="407.6060429977" y2="586.90778623577" />
<line x1="305" y1="5" x2="497.83628290596" y2="534.81333293569" />
<line x1="305" y1="5" x2="564.80762113533" y2="455" />
<line x1="305" y1="5" x2="600.44232590366" y2="357.09445330008" />
<line x1="305" y1="5" x2="600.44232590366" y2="252.90554669992" />
<line x1="305" y1="5" x2="564.80762113533" y2="155" />
<line x1="305" y1="5" x2="497.83628290596" y2="75.186667064307" />
<line x1="305" y1="5" x2="407.6060429977" y2="23.092213764227" />
<line x1="305" y1="5" x2="305" y2="5" />
<line x1="305" y1="5" x2="202.3939570023" y2="23.092213764227" />
<line x1="305" y1="5" x2="112.16371709404" y2="75.186667064307" />
<line x1="305" y1="5" x2="45.192378864669" y2="155" />
<line x1="305" y1="5" x2="9.5576740963376" y2="252.90554669992" />
<line x1="305" y1="5" x2="9.5576740963376" y2="357.09445330008" />
<line x1="305" y1="5" x2="45.192378864668" y2="455" />
<line x1="305" y1="5" x2="112.16371709404" y2="534.81333293569" />
<line x1="305" y1="5" x2="202.3939570023" y2="586.90778623577" />
<line x1="305" y1="5" x2="305" y2="605" />
<line x1="202.3939570023" y1="23.092213764227" x2="407.6060429977" y2="586.90778623577" />
<line x1="202.3939570023" y1="23.092213764227" x2="497.83628290596" y2="534.81333293569" />
<line x1="202.3939570023" y1="23.092213764227" x2="564.80762113533" y2="455" />
<line x1="202.3939570023" y1="23.092213764227" x2="600.44232590366" y2="357.09445330008" />
<line x1="202.3939570023" y1="23.092213764227" x2="600.44232590366" y2="252.90554669992" />
<line x1="202.3939570023" y1="23.092213764227" x2="564.80762113533" y2="155" />
<line x1="202.3939570023" y1="23.092213764227" x2="497.83628290596" y2="75.186667064307" />
<line x1="202.3939570023" y1="23.092213764227" x2="407.6060429977" y2="23.092213764227" />
<line x1="202.3939570023" y1="23.092213764227" x2="305" y2="5" />
<line x1="202.3939570023" y1="23.092213764227" x2="202.3939570023" y2="23.092213764227" />
<line x1="202.3939570023" y1="23.092213764227" x2="112.16371709404" y2="75.186667064307" />
<line x1="202.3939570023" y1="23.092213764227" x2="45.192378864669" y2="155" />
<line x1="202.3939570023" y1="23.092213764227" x2="9.5576740963376" y2="252.90554669992" />
<line x1="202.3939570023" y1="23.092213764227" x2="9.5576740963376" y2="357.09445330008" />
<line x1="202.3939570023" y1="23.092213764227" x2="45.192378864668" y2="455" />
<line x1="202.3939570023" y1="23.092213764227" x2="112.16371709404" y2="534.81333293569" />
<line x1="202.3939570023" y1="23.092213764227" x2="202.3939570023" y2="586.90778623577" />
<line x1="202.3939570023" y1="23.092213764227" x2="305" y2="605" />
<line x1="112.16371709404" y1="75.186667064307" x2="407.6060429977" y2="586.90778623577" />
<line x1="112.16371709404" y1="75.186667064307" x2="497.83628290596" y2="534.81333293569" />
<line x1="112.16371709404" y1="75.186667064307" x2="564.80762113533" y2="455" />
<line x1="112.16371709404" y1="75.186667064307" x2="600.44232590366" y2="357.09445330008" />
<line x1="112.16371709404" y1="75.186667064307" x2="600.44232590366" y2="252.90554669992" />
<line x1="112.16371709404" y1="75.186667064307" x2="564.80762113533" y2="155" />
<line x1="112.16371709404" y1="75.186667064307" x2="497.83628290596" y2="75.186667064307" />
<line x1="112.16371709404" y1="75.186667064307" x2="407.6060429977" y2="23.092213764227" />
<line x1="112.16371709404" y1="75.186667064307" x2="305" y2="5" />
<line x1="112.16371709404" y1="75.186667064307" x2="202.3939570023" y2="23.092213764227" />
<line x1="112.16371709404" y1="75.186667064307" x2="112.16371709404" y2="75.186667064307" />
<line x1="112.16371709404" y1="75.186667064307" x2="45.192378864669" y2="155" />
<line x1="112.16371709404" y1="75.186667064307" x2="9.5576740963376" y2="252.90554669992" />
<line x1="112.16371709404" y1="75.186667064307" x2="9.5576740963376" y2="357.09445330008" />
<line x1="112.16371709404" y1="75.186667064307" x2="45.192378864668" y2="455" />
<line x1="112.16371709404" y1="75.186667064307" x2="112.16371709404" y2="534.81333293569" />
<line x1="112.16371709404" y1="75.186667064307" x2="202.3939570023" y2="586.90778623577" />
<line x1="112.16371709404" y1="75.186667064307" x2="305" y2="605" />
<line x1="45.192378864669" y1="155" x2="407.6060429977" y2="586.90778623577" />
<line x1="45.192378864669" y1="155" x2="497.83628290596" y2="534.81333293569" />
<line x1="45.192378864669" y1="155" x2="564.80762113533" y2="455" />
<line x1="45.192378864669" y1="155" x2="600.44232590366" y2="357.09445330008" />
<line x1="45.192378864669" y1="155" x2="600.44232590366" y2="252.90554669992" />
<line x1="45.192378864669" y1="155" x2="564.80762113533" y2="155" />
<line x1="45.192378864669" y1="155" x2="497.83628290596" y2="75.186667064307" />
<line x1="45.192378864669" y1="155" x2="407.6060429977" y2="23.092213764227" />
<line x1="45.192378864669" y1="155" x2="305" y2="5" />
<line x1="45.192378864669" y1="155" x2="202.3939570023" y2="23.092213764227" />
<line x1="45.192378864669" y1="155" x2="112.16371709404" y2="75.186667064307" />
<line x1="45.192378864669" y1="155" x2="45.192378864669" y2="155" />
<line x1="45.192378864669" y1="155" x2="9.5576740963376" y2="252.90554669992" />
<line x1="45.192378864669" y1="155" x2="9.5576740963376" y2="357.09445330008" />
<line x1="45.192378864669" y1="155" x2="45.192378864668" y2="455" />
<line x1="45.192378864669" y1="155" x2="112.16371709404" y2="534.81333293569" />
<line x1="45.192378864669" y1="155" x2="202.3939570023" y2="586.90778623577" />
<line x1="45.192378864669" y1="155" x2="305" y2="605" />
<line x1="9.5576740963376" y1="252.90554669992" x2="407.6060429977" y2="586.90778623577" />
<line x1="9.5576740963376" y1="252.90554669992" x2="497.83628290596" y2="534.81333293569" />
<line x1="9.5576740963376" y1="252.90554669992" x2="564.80762113533" y2="455" />
<line x1="9.5576740963376" y1="252.90554669992" x2="600.44232590366" y2="357.09445330008" />
<line x1="9.5576740963376" y1="252.90554669992" x2="600.44232590366" y2="252.90554669992" />
<line x1="9.5576740963376" y1="252.90554669992" x2="564.80762113533" y2="155" />
<line x1="9.5576740963376" y1="252.90554669992" x2="497.83628290596" y2="75.186667064307" />
<line x1="9.5576740963376" y1="252.90554669992" x2="407.6060429977" y2="23.092213764227" />
<line x1="9.5576740963376" y1="252.90554669992" x2="305" y2="5" />
<line x1="9.5576740963376" y1="252.90554669992" x2="202.3939570023" y2="23.092213764227" />
<line x1="9.5576740963376" y1="252.90554669992" x2="112.16371709404" y2="75.186667064307" />
<line x1="9.5576740963376" y1="252.90554669992" x2="45.192378864669" y2="155" />
<line x1="9.5576740963376" y1="252.90554669992" x2="9.5576740963376" y2="252.90554669992" />
<line x1="9.5576740963376" y1="252.90554669992" x2="9.5576740963376" y2="357.09445330008" />
<line x1="9.5576740963376" y1="252.90554669992" x2="45.192378864668" y2="455" />
<line x1="9.5576740963376" y1="252.90554669992" x2="112.16371709404" y2="534.81333293569" />
<line x1="9.5576740963376" y1="252.90554669992" x2="202.3939570023" y2="586.90778623577" />
<line x1="9.5576740963376" y1="252.90554669992" x2="305" y2="605" />
<line x1="9.5576740963376" y1="357.09445330008" x2="407.6060429977" y2="586.90778623577" />
<line x1="9.5576740963376" y1="357.09445330008" x2="497.83628290596" y2="534.81333293569" />
<line x1="9.5576740963376" y1="357.09445330008" x2="564.80762113533" y2="455" />
<line x1="9.5576740963376" y1="357.09445330008" x2="600.44232590366" y2="357.09445330008" />
<line x1="9.5576740963376" y1="357.09445330008" x2="600.44232590366" y2="252.90554669992" />
<line x1="9.5576740963376" y1="357.09445330008" x2="564.80762113533" y2="155" />
<line x1="9.5576740963376" y1="357.09445330008" x2="497.83628290596" y2="75.186667064307" />
<line x1="9.5576740963376" y1="357.09445330008" x2="407.6060429977" y2="23.092213764227" />
<line x1="9.5576740963376" y1="357.09445330008" x2="305" y2="5" />
<line x1="9.5576740963376" y1="357.09445330008" x2="202.3939570023" y2="23.092213764227" />
<line x1="9.5576740963376" y1="357.09445330008" x2="112.16371709404" y2="75.186667064307" />
<line x1="9.5576740963376" y1="357.09445330008" x2="45.192378864669" y2="155" />
<line x1="9.5576740963376" y1="357.09445330008" x2="9.5576740963376" y2="252.90554669992" />
<line x1="9.5576740963376" y1="357.09445330008" x2="9.5576740963376" y2="357.09445330008" />
<line x1="9.5576740963376" y1="357.09445330008" x2="45.192378864668" y2="455" />
<line x1="9.5576740963376" y1="357.09445330008" x2="112.16371709404" y2="534.81333293569" />
<line x1="9.5576740963376" y1="357.09445330008" x2="202.3939570023" y2="586.90778623577" />
<line x1="9.5576740963376" y1="357.09445330008" x2="305" y2="605" />
<line x1="45.192378864668" y1="455" x2="407.6060429977" y2="586.90778623577" />
<line x1="45.192378864668" y1="455" x2="497.83628290596" y2="534.81333293569" />
<line x1="45.192378864668" y1="455" x2="564.80762113533" y2="455" />
<line x1="45.192378864668" y1="455" x2="600.44232590366" y2="357.09445330008" />
<line x1="45.192378864668" y1="455" x2="600.44232590366" y2="252.90554669992" />
<line x1="45.192378864668" y1="455" x2="564.80762113533" y2="155" />
<line x1="45.192378864668" y1="455" x2="497.83628290596" y2="75.186667064307" />
<line x1="45.192378864668" y1="455" x2="407.6060429977" y2="23.092213764227" />
<line x1="45.192378864668" y1="455" x2="305" y2="5" />
<line x1="45.192378864668" y1="455" x2="202.3939570023" y2="23.092213764227" />
<line x1="45.192378864668" y1="455" x2="112.16371709404" y2="75.186667064307" />
<line x1="45.192378864668" y1="455" x2="45.192378864669" y2="155" />
<line x1="45.192378864668" y1="455" x2="9.5576740963376" y2="252.90554669992" />
<line x1="45.192378864668" y1="455" x2="9.5576740963376" y2="357.09445330008" />
<line x1="45.192378864668" y1="455" x2="45.192378864668" y2="455" />
<line x1="45.192378864668" y1="455" x2="112.16371709404" y2="534.81333293569" />
<line x1="45.192378864668" y1="455" x2="202.3939570023" y2="586.90778623577" />
<line x1="45.192378864668" y1="455" x2="305" y2="605" />
<line x1="112.16371709404" y1="534.81333293569" x2="407.6060429977" y2="586.90778623577" />
<line x1="112.16371709404" y1="534.81333293569" x2="497.83628290596" y2="534.81333293569" />
<line x1="112.16371709404" y1="534.81333293569" x2="564.80762113533" y2="455" />
<line x1="112.16371709404" y1="534.81333293569" x2="600.44232590366" y2="357.09445330008" />
<line x1="112.16371709404" y1="534.81333293569" x2="600.44232590366" y2="252.90554669992" />
<line x1="112.16371709404" y1="534.81333293569" x2="564.80762113533" y2="155" />
<line x1="112.16371709404" y1="534.81333293569" x2="497.83628290596" y2="75.186667064307" />
<line x1="112.16371709404" y1="534.81333293569" x2="407.6060429977" y2="23.092213764227" />
<line x1="112.16371709404" y1="534.81333293569" x2="305" y2="5" />
<line x1="112.16371709404" y1="534.81333293569" x2="202.3939570023" y2="23.092213764227" />
<line x1="112.16371709404" y1="534.81333293569" x2="112.16371709404" y2="75.186667064307" />
<line x1="112.16371709404" y1="534.81333293569" x2="45.192378864669" y2="155" />
<line x1="112.16371709404" y1="534.81333293569" x2="9.5576740963376" y2="252.90554669992" />
<line x1="112.16371709404" y1="534.81333293569" x2="9.5576740963376" y2="357.09445330008" />
<line x1="112.16371709404" y1="534.81333293569" x2="45.192378864668" y2="455" />
<line x1="112.16371709404" y1="534.81333293569" x2="112.16371709404" y2="534.81333293569" />
<line x1="112.16371709404" y1="534.81333293569" x2="202.3939570023" y2="586.90778623577" />
<line x1="112.16371709404" y1="534.81333293569" x2="305" y2="605" />
<line x1="202.3939570023" y1="586.90778623577" x2="407.6060429977" y2="586.90778623577" />
<line x1="202.3939570023" y1="586.90778623577" x2="497.83628290596" y2="534.81333293569" />
<line x1="202.3939570023" y1="586.90778623577" x2="564.80762113533" y2="455" />
<line x1="202.3939570023" y1="586.90778623577" x2="600.44232590366" y2="357.09445330008" />
<line x1="202.3939570023" y1="586.90778623577" x2="600.44232590366" y2="252.90554669992" />
<line x1="202.3939570023" y1="586.90778623577" x2="564.80762113533" y2="155" />
<line x1="202.3939570023" y1="586.90778623577" x2="497.83628290596" y2="75.186667064307" />
<line x1="202.3939570023" y1="586.90778623577" x2="407.6060429977" y2="23.092213764227" />
<line x1="202.3939570023" y1="586.90778623577" x2="305" y2="5" />
<line x1="202.3939570023" y1="586.90778623577" x2="202.3939570023" y2="23.092213764227" />
<line x1="202.3939570023" y1="586.90778623577" x2="112.16371709404" y2="75.186667064307" />
<line x1="202.3939570023" y1="586.90778623577" x2="45.192378864669" y2="155" />
<line x1="202.3939570023" y1="586.90778623577" x2="9.5576740963376" y2="252.90554669992" />
<line x1="202.3939570023" y1="586.90778623577" x2="9.5576740963376" y2="357.09445330008" />
<line x1="202.3939570023" y1="586.90778623577" x2="45.192378864668" y2="455" />
<line x1="202.3939570023" y1="586.90778623577" x2="112.16371709404" y2="534.81333293569" />
<line x1="202.3939570023" y1="586.90778623577" x2="202.3939570023" y2="586.90778623577" />
<line x1="202.3939570023" y1="586.90778623577" x2="305" y2="605" />
<line x1="305" y1="605" x2="407.6060429977" y2="586.90778623577" />
<line x1="305" y1="605" x2="497.83628290596" y2="534.81333293569" />
<line x1="305" y1="605" x2="564.80762113533" y2="455" />
<line x1="305" y1="605" x2="600.44232590366" y2="357.09445330008" />
<line x1="305" y1="605" x2="600.44232590366" y2="252.90554669992" />
<line x1="305" y1="605" x2="564.80762113533" y2="155" />
<line x1="305" y1="605" x2="497.83628290596" y2="75.186667064307" />
<line x1="305" y1="605" x2="407.6060429977" y2="23.092213764227" />
<line x1="305" y1="605" x2="305" y2="5" />
<line x1="305" y1="605" x2="202.3939570023" y2="23.092213764227" />
<line x1="305" y1="605" x2="112.16371709404" y2="75.186667064307" />
<line x1="305" y1="605" x2="45.192378864669" y2="155" />
<line x1="305" y1="605" x2="9.5576740963376" y2="252.90554669992" />
<line x1="305" y1="605" x2="9.5576740963376" y2="357.09445330008" />
<line x1="305" y1="605" x2="45.192378864668" y2="455" />
<line x1="305" y1="605" x2="112.16371709404" y2="534.81333293569" />
<line x1="305" y1="605" x2="202.3939570023" y2="586.90778623577" />
<line x1="305" y1="605" x2="305" y2="605" />
</svg>

\$\endgroup\$
0
\$\begingroup\$

R, 108 bytes

plot(x<-cos(t<-seq(0,2*pi,l=21)),y<-sin(t),as=1);apply(expand.grid(1:21,1:21),1,function(e)lines(x[e],y[e]))

Could shave 5 bytes off if I got rid of argument ,as=1 which forces an aspect ratio of 1. Uses expand.grid to create a matrix with all possible pair of points, and uses apply to loop through it.

N=21

R + igraph, 87 bytes

Another solution using package igraph.

library(igraph);plot(make_full_graph(21),layout=cbind(cos(t<-seq(0,2*pi,l=21)),sin(t)))

N=21

\$\endgroup\$

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.