File:Harborth graph vector.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file(SVG file, nominally 700 × 800 pixels, file size: 8 KB)

Summary

Description
English: Harborth graph, vector format.
Date
Source Own work
Author Claudio Rocchini
SVG development
InfoField
 
The SVG code is valid.
 
This graph was created with an unknown SVG tool.
Source code
InfoField

C

#include <stdlib.h>
#include <stdio.h>

void harborth_graph() {
	/* Data by:
	   EBERHARD H.-A. GERBRACHT
	   MINIMAL POLYNOMIALS FOR THE COORDINATES OF THE HARBORTH GRAPH
	   24 Jan 2007
	   */
	const size_t N = 16;
	double V[N][2] = {
		{ 0.0, 0.0 },
		{ 0.992685948824186, 0.120725337054926 },
		{ 0.992685948824186*2, 0.0 },
		{ 0.809996600722107, 2.760161754567202 },
		{ 0.209102417540010, 1.960833173433061 },
		{ -0.061398137844065, 0.998113354619244 },
		{ -0.838419516770942, 1.627587561152422 },
		{ -0.995049481192288, 3.621444891616507 },
		{ 0,0 },	// The I Vertex
		{ -0.995049481192288, 0.639930204451542 },
	};

	V[10][0] = V[2][0] * 2/ 3 + V[3][0] / 3;
	V[10][1] = V[2][1] * 2 / 3 + V[3][1] / 3;
	V[11][0] = V[2][0] / 3 + V[3][0] *2/ 3;
	V[11][1] = V[2][1] / 3 + V[3][1] *2/ 3;
	V[12][0] = V[1][0] / 2 + V[4][0] / 2;
	V[12][1] = V[1][1] / 2 + V[4][1] / 2;
	V[13][0] = V[3][0] / 2 + V[6][0] / 2;
	V[13][1] = V[3][1] / 2 + V[6][1] / 2;
	V[14][0] = V[3][0] / 2 + V[7][0] / 2;
	V[14][1] = V[3][1] / 2 + V[7][1] / 2;
	V[15][0] = V[6][0] / 2 + V[7][0] / 2;
	V[15][1] = V[6][1] / 2 + V[7][1] / 2;

	const size_t M = 27;
	int E[M][2] = {
		{ 0, 1 }, { 1, 2 }, { 2, 10 }, { 10, 11 }, { 11, 3 }, { 3, 4 }, { 4, 11 }, { 11, 12 }, { 4, 12 },
		{ 12, 1 }, { 12, 10 }, { 2, 10 }, { 1, 10 }, { 4, 5 }, { 0, 5 }, { 5, 6 }, { 5, 9 }, {9,6},
		{6,13}, {13,3}, {3,14}, {14,7}, {7,15}, {15,6}, {13,14}, {14,15}, {15,13}
	};

	const double SX = 700;
	const double SY = 800;
	const double SS = 100;

	FILE * fo = fopen("c:\\temp\\harborth_graph.svg", "w");
	fprintf(fo,
		"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
		"<svg\n"
		"xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
		"xmlns=\"http://www.w3.org/2000/svg\"\n"
		"version=\"1.0\"\n"
		"width=\"%g\"\n" "height=\"%g\"\n"
		"id=\"harborth_grap\">\n"
		, SX, SY
	);
	size_t i,v;
	fprintf(fo, "<g id=\"edges\" style=\"stroke:#000000;stroke-width:2;\">\n");
	for (v = 0; v < 4; ++v) {
		double sx = v == 0 || v == 1 ? 1 : -1; 
		double sy = v == 0 || v == 2 ? 1 : -1;
		for (i = 0; i < M; ++i)
			fprintf(fo, "<line x1=\"%5.1lf\" y1=\"%5.1lf\" x2=\"%5.1lf\" y2=\"%5.1lf\"/>\n"
				, (V[E[i][0]][0]+1)*sx * SS + SX / 2, SY / 2 - V[E[i][0]][1] *sy * SS
				, (V[E[i][1]][0]+1)*sx * SS + SX / 2, SY / 2 - V[E[i][1]][1] *sy * SS
			);
	}
	fprintf(fo, "</g>\n");
	fprintf(fo, "<g id=\"nodes\" style=\"stroke:none;fill:#000000\">\n");
	for (v = 0; v < 4; ++v) {
		double sx = v == 0 || v == 1 ? 1 : -1;
		double sy = v == 0 || v == 2 ? 1 : -1;
		for (i = 0; i < N; ++i) {
			if (i == 8 || ((i==0 || i==2) && (v==1 || v==3)) ) continue;
			if ((i == 7 || i==9) && (v==2 || v==3)) continue;	// remove duplicates
			fprintf(fo, "<circle cx=\"%5.1lf\" cy=\"%5.1lf\" r=\"%5.1lf\"/>"
				, (V[i][0]+1)*sx * SS + SX / 2, SY / 2 - V[i][1] *sy * SS
				, 6.0
			);
		}
	}
	fprintf(fo, "</g>\n");
	fprintf(fo, "</svg>\n");
	fclose(fo);
}
replacement of source || was necessary

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Thanks

To the EBERHARD H. and A. GERBRACHT for the point coordinates.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

19 May 2014

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current07:27, 19 May 2014Thumbnail for version as of 07:27, 19 May 2014700 × 800 (8 KB)RocchiniUser created page with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata