1

I wanted to try using "Tikzit" to create a cycle graph. But I have a little trouble. Software download link

It may be easy to use the existing tikz code.https://texample.net/tikz/examples/cycle/

% A simple cycle
% Author : Jerome Tremblay
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\def \n {5} \def \radius {3cm} \def \margin {6} % margin in angles, depends on the radius

\foreach \s in {1,...,\n} { \node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$}; \draw[-, >=latex] ({360/\n * (\s -1)+\margin}:\radius) arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius); } \end{tikzpicture} \end{document}

enter image description here

When I want to use Tikzit software, it seems difficult to draw above graph.

The key lies in the location of the vertex and the setting of the curvature of the curve, which is very difficult for me. Don't know how to adjust them.

enter image description here

The following codes come from this software.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}

\usetikzlibrary{arrows} \usetikzlibrary{shapes,shapes.geometric,shapes.misc}

% these are dummy properties used by TikZiT, but ignored by LaTex \pgfkeys{/tikz/tikzit fill/.initial=0} \pgfkeys{/tikz/tikzit draw/.initial=0} \pgfkeys{/tikz/tikzit shape/.initial=0} \pgfkeys{/tikz/tikzit category/.initial=0}

% standard layers used in .tikz files \pgfdeclarelayer{edgelayer} \pgfdeclarelayer{nodelayer} \pgfsetlayers{background,edgelayer,nodelayer,main}

% style for blank nodes \tikzstyle{none}=[inner sep=0mm]

% Node styles \tikzstyle{white_node}=[fill=white, draw=black, shape=circle] \tikzstyle{blackedge}=[-, draw=black]

\begin{document} \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style={white_node}] (0) at (5, 6) {}; \node [style={white_node}] (1) at (7, 4) {}; \node [style={white_node}] (2) at (5, 2) {}; \node [style={white_node}] (3) at (3, 3) {}; \node [style={white_node}] (4) at (3, 5) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blackedge, bend left] (0) to (1); \draw [style=blackedge, bend left] (1) to (2); \draw [style=blackedge, bend right=330] (2) to (3); \draw [style=blackedge, bend left=45, looseness=0.75] (3) to (4); \draw [style=blackedge, bend left] (4) to (0); \end{pgfonlayer} \end{tikzpicture} \end{document}

Edit: After a reminder from SebGlav , my question can actually be equivalent to this:

How to use TikZ code to do that circle graph with proper edges?

The circle is only part of my drawing, in fact I want to draw the following figure. enter image description here

licheng
  • 773
  • 2
    why would you want to draw with tikzit? direct drawing with TikZ is much better! – Black Mild Apr 27 '21 at 05:28
  • You try to draw bended edges between nodes instead of drawing a simple circle then the nodes. Why would you do this? TikZit could be of great help for complex graphs you don't seem to be able to create by hand but for this one? And if your question is "how would I do this on TikZit?", so it's not TikZ related. If you want a TikZ code to do that circle graph with proper edges, we can help you. – SebGlav Apr 27 '21 at 06:02
  • 1
    @BlackMild Actually this circle graph is part of my drawing and I need to add something else to the circle. It would be better to be able to draw it on TikZit at one time. – licheng Apr 27 '21 at 06:58
  • @ SebGlav Thank you! Your suggestion is very good. Maybe my question can be appropriately modified to this : How to use TikZ code to do that circle graph with proper edges? This is indeed where I encountered difficulties. – licheng Apr 27 '21 at 07:01
  • this may be helpful https://tex.stackexchange.com/questions/511183/simple-way-to-make-circular-arrow-arc In fact, I did not get exactly what you want to draw. – Black Mild Apr 27 '21 at 07:38
  • @BlackMild Thank you very much! I put what I want to draw in the question. – licheng Apr 27 '21 at 08:04
  • @licheng what is the position of P' ? do you think that you should clearly describe the figure ? – Black Mild Apr 27 '21 at 08:19
  • 1
    @BlackMild This is a graph in graph theory. The P' is just a label, and its position does not need to be overly precise. – licheng Apr 27 '21 at 08:37
  • That said (and everyone here knows what a graph is, I presume), you don't really need your circle to be one ;) Whatever, Blackmild's answer below seems to fullfil your needs. – SebGlav Apr 27 '21 at 11:59
  • @ SebGlav You are right! I don’t even need the cycle to be standard but for beautiful. In my personal opinion, beautiful cycle is also important for me. – licheng Apr 27 '21 at 12:06

1 Answers1

1

Here is my simple solution.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[thick]
\def\r{2} 
\draw (0,0) circle(\r)
(0,0)--(90:\r)
(0,0)--(150:\r)
(0,0)--(-30:\r);

\foreach \point in {(0,0),(90:\r),(150:\r),(210:\r),(30:\r),(-30:\r),(-90:\r),(150:\r/3),(150:2*\r/3),(-30:\r/2),(90:\r/2)} \draw[teal,fill=white] \point circle(.1);

\path (0,0) node[below=1mm]{$\omega$} (-30:\r) node[below right]{$u$} (-30:\r/2) node[above=1mm]{$P'$} (90:\r) node[above=1mm]{$z$} (90:\r/2) node[left=1mm]{$P$} (150:\r) node[left=1mm]{$y$} (150:2*\r/3) node[below=1mm]{$x$} (-90:\r) node[below=1mm]{$C$} ; \end{tikzpicture} \end{document}

Black Mild
  • 17,569