본문 바로가기
짜잘IT

📜LaTex - 컴알 과제 2

by 정람지 2024. 3. 26.

Graph Coloring

방법

  1. 각 위원회를 노드로 간주하기
  2. 각 위원회와 겹치는 사람이 있다면, 두 위원회 노드를 간선으로 연결하기
  • 참가자가 중복되는 위원회의 시간은 겹치면 안 됨 => 위원회 노드의 색이 달라야 함
  1. 형성된 그래프에 대해 Graph - Coloring 진행
  2. 최소 색상수가 "minimun time slot" 가 됨

진짜...

그려서내기만하면되는데 (사실 자유과제라서 내지도 않아도 되는데 )

굳~이 레이텍으로 그래프그리기

 

그래도 결과물은 예쁘다. 크기랑 조절하느라 화낫음

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning}
\usepackage{kotex} % 한국어 설정

\begin{document}
\begin{tikzpicture}[node distance=2cm]
  \tikzset{vertex/.style = {shape=circle,draw,minimum size=2.5em, align=center}} % 노드 스타일 설정

  % 노드들
  \node[vertex, fill=blue!30, font=\fontsize{6pt}{7.2}\selectfont] (0) at (2.334,0.666) {defense};
  \node[vertex, fill=red!30, font=\fontsize{6pt}{7.2}\selectfont] (1) at (3.796,0.6) {Education};
  \node[vertex, fill=red!30, font=\fontsize{6pt}{7.2}\selectfont] (2) at (2.288,2.304) {Food/\\Rural\\Affairs};
  \node[vertex, fill=yellow!30, font=\fontsize{6pt}{7.2}\selectfont] (3) at (0.602,2.57) {Foreign-\\Affairs};
  \node[vertex, fill=blue!30, font=\fontsize{6pt}{7.2}\selectfont] (4) at (0.877,0.6) {Justice};
  \node[vertex, fill=blue!30, font=\fontsize{6pt}{7.2}\selectfont] (5) at (2.287,4.015) {Technology};
  \node[vertex, fill=yellow!30, font=\fontsize{6pt}{7.2}\selectfont] (6) at (3.987,2.591) {culture/\\media/\\sports};

  % 간선들
  \draw (6) -- (0);
  \draw (6) -- (1);
  \draw (6) -- (5);
  \draw (0) -- (3);
  \draw (0) -- (2);
  \draw (1) -- (4);
  \draw (2) -- (5);
  \draw (3) -- (4);
  \draw (5) -- (3);

\end{tikzpicture}
\end{document}

 


 

 

 

그래프 그려주는 사이트 

 

CS Academy

 

csacademy.com

 

굿!

노드들이 통통튀어서귀여운데.. 운하는위치에 딱 안놓아져서화남