You can use the newfloat
package to define a customized floating environment; in this way you can give a caption to your diagrams and you can produce a list of them (similar to the LoT or the LoF):
\documentclass{article}
\usepackage{tikz}
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=dia,within=section]{diagram}
\begin{document}
\section{Test Section}
\begin{diagram}[!ht]
\centering
\tikzstyle{bag} = [text width=2em, text centered]
\tikzstyle{end} = []
\begin{tikzpicture}[sloped]
\node (a) at ( 0,0) [bag] {$S$};
\node (b) at ( 4,-1.5) [bag] {$ dS $};
\node (c) at ( 4,1.5) [bag] {$ uS $};
\draw [-] (a) to node [below] {$(1-q)$} (b);
\draw [-] (a) to node [above] {$q$} (c);
\end{tikzpicture}
\caption{ a test caption for the diagram}
\label{dia:test}
\end{diagram}
\end{document}

Using the floatrow
package you can use \DeclareNewFloatType
:
\documentclass{article}
\usepackage{tikz}
\usepackage{floatrow}
\DeclareNewFloatType{diagram}{fileext=dia ,within=section,name=Diagram}
\begin{document}
\listof{diagram}{List of Diagrams}
\section{Test Section}
\begin{diagram}[!ht]
\centering
\tikzstyle{bag} = [text width=2em, text centered]
\tikzstyle{end} = []
\begin{tikzpicture}[sloped]
\node (a) at ( 0,0) [bag] {$S$};
\node (b) at ( 4,-1.5) [bag] {$ dS $};
\node (c) at ( 4,1.5) [bag] {$ uS $};
\draw [-] (a) to node [below] {$(1-q)$} (b);
\draw [-] (a) to node [above] {$q$} (c);
\end{tikzpicture}
\caption{ a test caption for the diagram}
\label{dia:test}
\end{diagram}
\end{document}
\end{document}
If a floating object is not desired and captions are not required, one can define a new environment using, for example, a minipage
, and a user created counter:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcounter{diagram}
\numberwithin{diagram}{section}
\newenvironment{diagram}
{\stepcounter{diagram}\par\smallskip\noindent\begin{minipage}{\linewidth}\centering}
{\par Diagram~\thediagram\end{minipage}\par\smallskip}
\begin{document}
\section{Test Section}
\begin{diagram}
\centering
\tikzstyle{bag} = [text width=2em, text centered]
\tikzstyle{end} = []
\begin{tikzpicture}[sloped]
\node (a) at ( 0,0) [bag] {$S$};
\node (b) at ( 4,-1.5) [bag] {$ dS $};
\node (c) at ( 4,1.5) [bag] {$ uS $};
\draw [-] (a) to node [below] {$(1-q)$} (b);
\draw [-] (a) to node [above] {$q$} (c);
\end{tikzpicture}
\end{diagram}
\end{document}

I removed from the examples the packages that were not essential for the solution.