top of page

Python - Create pentagram in pentagram

Simple 2 D plane polygonial cyclic configurations ( below 7 edges ) :


hexagram - A Hexagram is composed from two of the eight trigrams. Its bars are encoded as binary numbers, from bottom to top, using the digits from left to right.

/ water and snow structures, coin tosses, permutations, the most common in nature, ... /


pentagram - A pentagram is a polygon that looks like a 5-pointed star. The outer vertices (points of the stars) form a regular pentagon.

/ apple structure, combinatorics, flower petals, starfish, ... /


square - four-sided regular polygon which is also known as a quadrilateral with four equal sides.

/ square box jelly, many different species of plankton, and even each and every plant cell, ... /


triangle - polygon with three edges and three vertices. In traditional texts it is said that the trigrams are doubled to form a hexagram.


--------------------------------------


# draw nodes and edges, regular pentagram in regular pentagram using plotly

import networkx as nx

import matplotlib.pyplot as plt

import numpy as np

G = nx.petersen_graph()


# set 2D edge positions

import math

pos2d = {}

for i in range(5):

theta = 2 * math.pi * i / 5 + math.pi / 2

pos2d[i] = (2 * math.cos(theta), 2 * math.sin(theta)) # outer vertices

pos2d[5 + i] = (math.cos(theta), math.sin(theta)) # inner vertices

for v in G:

print('%d: (%6s, %6s)' % (v, '%.3f' % pos2d[v][0], '%.3f' % pos2d[v][1]))

vis = GraphVisualization(G, pos2d)

fig = vis.create_figure()

fig.show()





Refrences:




13 views0 comments

Recent Posts

See All

Python - Basic regression comparison

Regression models are the principles of machine learning models as well. They help to understand the dataset distributions. The objective...

Comentarios


bottom of page