% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph-build.R, R/validate.R
\name{build_dependency_graph}
\alias{build_dependency_graph}
\alias{build_depgraph}
\alias{as_igraph}
\alias{validate_graph}
\alias{validate_depgraph}
\title{Assemble and Validate Dependency Graphs}
\usage{
build_dependency_graph(
  nodes,
  edges,
  graph_name = NULL,
  dataset_name = NULL,
  validate = TRUE,
  validation_overrides = list()
)

build_depgraph(
  nodes,
  edges,
  graph_name = NULL,
  dataset_name = NULL,
  validate = TRUE,
  validation_overrides = list()
)

as_igraph(x)

validate_graph(
  graph,
  checks = c("ids", "references", "cardinality", "schema", "time"),
  error_on_fail = FALSE,
  levels = NULL,
  severities = NULL,
  validation_overrides = NULL
)

validate_depgraph(
  graph,
  checks = c("ids", "references", "cardinality", "schema", "time"),
  error_on_fail = FALSE,
  levels = NULL,
  severities = NULL,
  validation_overrides = NULL
)
}
\arguments{
\item{nodes, edges}{Lists of \code{graph_node_set} and \code{graph_edge_set}
objects.}

\item{graph_name, dataset_name}{Optional metadata labels.}

\item{validate}{If \code{TRUE}, run \code{validate_graph()} before returning.}

\item{validation_overrides}{Optional named list of explicit validation
exceptions. Currently supported keys:
\describe{
  \item{\code{allow_multi_subject_samples}}{If \code{TRUE}, the semantic
    validator does not flag samples linked to multiple subjects, and
    \code{derive_split_constraints(mode = "subject")} silently keeps the
    first listed subject assignment (recording the ambiguity in
    \code{metadata$warnings}). Defaults to \code{FALSE}.}
}
When passed to \code{validate_graph()} or \code{validate_depgraph()},
the override is merged into the graph's existing
\code{validation_overrides} for the duration of the call only.}

\item{x}{A \code{dependency_graph}.}

\item{graph}{A \code{dependency_graph}.}

\item{checks}{\strong{Deprecated.} Use \code{levels} and \code{severities}
instead. Retained for backward compatibility with 0.1.0 callers.}

\item{error_on_fail}{If \code{TRUE}, stop when validation errors are found
across all detected issues from the selected validation levels, even if
those errors are hidden from \code{issues} by \code{severities}.}

\item{levels}{Optional validation layers to run.}

\item{severities}{Optional severities to retain in the returned
\code{issues} table. This filter does not change whether the graph is
considered valid.}
}
\value{
For \code{build_dependency_graph()}, a \code{dependency_graph}. For
  \code{validate_graph()} and \code{validate_depgraph()}, a
  \code{depgraph_validation_report}. For \code{as_igraph()}, the underlying
  \code{igraph} object.
}
\description{
Combine canonical node and edge tables into a typed dependency graph and
perform structural, semantic, and graph-local leakage-aware validation.
}
\examples{
meta <- data.frame(
  sample_id = c("S1", "S2"),
  subject_id = c("P1", "P2")
)

samples <- create_nodes(meta, type = "Sample", id_col = "sample_id")
subjects <- create_nodes(meta, type = "Subject", id_col = "subject_id")
edges <- create_edges(
  meta,
  "sample_id",
  "subject_id",
  "Sample",
  "Subject",
  "sample_belongs_to_subject"
)

g <- build_dependency_graph(list(samples, subjects), list(edges))
validate_graph(g)
}
