Path in LaTeX (P_n)

PnP_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.

Pn has n vertices and n−1 edgesP_n \text{ has } n \text{ vertices and } n - 1 \text{ edges}
\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 Grafentheorie →

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.
Math poweredSchrijf LaTeX met AI

Beste AI LaTeX Editor, Overleaf Alternatief

Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI

  • Genereer mooie TikZ-diagrammen met AI
  • Upload afbeelding en converteer naadloos naar LaTeX
  • Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen