  We study the inverse problem of determining a finite weighted graph $(X,E)$
from the source-to-solution map on a vertex subset $B\subset X$ for heat
equations on graphs, where the time variable can be either discrete or
continuous. We prove that this problem is equivalent to the discrete version of
the inverse interior spectral problem, provided that there does not exist a
nonzero eigenfunction of the weighted graph Laplacian vanishing identically on
$B$. In particular, we consider inverse problems for discrete-time random walks
on finite graphs. We show that under a novel geometric condition (called the
Two-Points Condition), the graph structure and the transition matrix of the
random walk can be uniquely recovered from the distributions of the first
passing times on $B$, or from the observation on $B$ of one realization of the
random walk.
