\HeaderA{clust2Mat}{Function to compute adjacency matrix of cluster graph given a vector of cluster memberships}{clust2Mat}
\keyword{data}{clust2Mat}
\begin{Description}\relax
Given a list of cluster memberships, this function computes the adjacency matrix for the associated cluster graph.  The adjacency matrix is a matrix whose rows and columns are the nodes of the cluster graph and whose entries are 0's or 1's.  A 1 entry indicates that the corresponding nodes are connected, and a 0 indocates that they are not.
\end{Description}
\begin{Usage}
\begin{verbatim}
clust2Mat(memb)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{memb}] A numeric vector, with each entry representing a node, the entry's value being the number of the cluster to which that node belongs.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Given a vector of cluster membership numbers, where the number of entries is the number of nodes n, the function computes an nxn ``adjacency matrix'' for the corresponding cluster graph.  The cluster graph is the graph in which two nodes are connected by an edge if and only if they are members of the same cluster.  The adjacency matrix for the graph has rows and columns representing the nodes, in the same order as the input vector.  The (i,j) entry is 1 if and only if node i and node j are in the same cluster.  Otherwise, the entry is 0.  By convention, diagonal entries are 0.
\end{Details}
\begin{Value}
An nxn adjacency matrix for the cluster graph, where n=length of cluster membership input vector memb.
\end{Value}
\begin{Author}\relax
Tom LaFramboise \email{tlaframb@hsph.harvard.edu}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{makeClustM}{makeClustM}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
memberships<-c(1,2,3,1,2,3,1,2,3,4)
clust2Mat(memberships)\end{ExampleCode}
\end{Examples}

