% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/localdiffexp.R
\name{localdiffexp}
\alias{localdiffexp}
\title{Compute the local diffusion exponent for a given starting node}
\usage{
localdiffexp(
  R,
  start_node,
  adj,
  fit_range,
  num_paths = 100,
  max_time = 100,
  seed = NULL
)
}
\arguments{
\item{R}{Resistance distance matrix (symmetric, zero diagonal).}

\item{start_node}{Index or name of the starting node (must match row/column names of \code{R}).}

\item{adj}{Adjacency matrix (symmetric, 0/1, zero diagonal).}

\item{fit_range}{Numeric vector of length 2 specifying the time range for fitting,
e.g. \code{c(t_start, t_end)} with \code{1 <= t_start < t_end <= max_time}.}

\item{num_paths}{Number of random walk paths to simulate. Default 100.}

\item{max_time}{Maximum number of steps (from 0 to \code{max_time}). Default 100.}

\item{seed}{Optional random seed for reproducibility.}
}
\value{
A list containing:
  \item{H}{Estimated local diffusion exponent \(H_i\).}
  \item{msd}{Data frame with columns \code{t} (time) and \code{msd} (mean squared resistance distance).}
  \item{fit}{\code{lm} object from the log-log fit.}
  \item{paths}{Matrix of resistance distances for each path (rows = time steps, columns = paths).}
}
\description{
Simulates random walks from a specified node on a graph and estimates
the local diffusion exponent from the scaling of the mean squared resistance distance.
}
\examples{
g<-make_lattice(length = 6, dim = 2)
adj <- as_adjacency_matrix(g,sparse = FALSE)
R <- resistance_distance_matrix(adj)
res <- localdiffexp(R, start_node = 1, adj = adj,fit_range = c(3, 30), max_time = 30)
print(res$H)
}
\references{
Nie, Chun-Xiao. "Vertex‑level diffusion scaling from resistance distance."  .Chaos, Under Review.
}
