Path in LaTeX (P_n)
- LaTeX command
P_n- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Path graph on n vertices: n vertices joined in a line by n - 1 edges.
P_n is a basic family in graph theory, along with C_n and K_n. Conventions differ, which is a real source of confusion: many texts let n count vertices, while others, including Diestel, write P^k for a path with k edges. State yours. Paths have chromatic number 2 for n \geq 2 and are trees. In walk counting, the number of paths is distinct from walks because vertices cannot repeat. The subscript is a plain index; for longer indices, use braces, P_{n+1}. Do not confuse with P(n, k), permutations.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Path: $P_n$
\[ P_n \text{ has } n \text{ vertices and } n - 1 \text{ edges} \]
\end{document}Related symbols
All Teori Graf →Frequently asked questions
- How do I write Path in LaTeX?
- Type P_n in math mode, for example $P_n \text{ has } n \text{ vertices and } n - 1 \text{ edges}$. It works in plain LaTeX without loading any package.
- Which package do I need for P_n?
- None. P_n is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use P_n in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $P_n$ in running text.
Editor LaTeX AI Terbaik, Alternatif Overleaf
Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI
- Jana diagram TikZ yang cantik menggunakan AI
- Muat naik imej dan tukar ke LaTeX dengan lancar
- Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan