% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ingest.R
\name{create_nodes}
\alias{create_nodes}
\alias{create_edges}
\title{Create Canonical Node and Edge Tables}
\usage{
create_nodes(
  data,
  type,
  id_col,
  label_col = NULL,
  attr_cols = NULL,
  prefix = TRUE,
  dedupe = TRUE
)

create_edges(
  data,
  from_col,
  to_col,
  from_type,
  to_type,
  relation,
  attr_cols = NULL,
  allow_missing = FALSE,
  dedupe = TRUE,
  from_prefix = TRUE,
  to_prefix = TRUE
)
}
\arguments{
\item{data}{A \code{data.frame} containing entity or relationship columns.}

\item{type, from_type, to_type}{Supported node types such as \code{"Sample"}
or \code{"Subject"}.}

\item{id_col}{Column containing the source identifier for the node type.}

\item{label_col}{Optional column used for node labels.}

\item{attr_cols}{Optional columns stored in the \code{attrs} list-column.}

\item{prefix}{If \code{TRUE}, prepend typed prefixes such as \code{sample:}
to node identifiers.}

\item{dedupe}{If \code{TRUE}, collapse duplicate identifiers or duplicate
edges only when the retained definition is identical.}

\item{from_col, to_col}{Source and target identifier columns for edge
creation.}

\item{relation}{Canonical edge type.}

\item{allow_missing}{If \code{TRUE}, drop rows with missing edge endpoints
instead of erroring.}

\item{from_prefix, to_prefix}{Whether to prepend typed prefixes when
constructing the edge endpoint identifiers. Defaults preserve the
canonical prefixed-ID format.}
}
\value{
For \code{create_nodes()}, a \code{graph_node_set}. For
  \code{create_edges()}, a \code{graph_edge_set}.
}
\description{
Build canonical node and edge tables from ordinary metadata frames.
}
\details{
The package uses typed node identifiers such as \code{sample:S1} as the
canonical graph representation. If you create node sets with
\code{prefix = FALSE}, the corresponding edge endpoints must use matching
prefix settings via \code{from_prefix} and \code{to_prefix}.

When \code{dedupe = TRUE}, exact duplicate node or edge definitions are
collapsed, but conflicting definitions for the same canonical node
identifier or edge relation are rejected with an error.
}
\examples{
meta <- data.frame(
  sample_id = c("S1", "S2"),
  subject_id = c("P1", "P2")
)

samples <- create_nodes(meta, type = "Sample", id_col = "sample_id")
edges <- create_edges(
  meta,
  from_col = "sample_id",
  to_col = "subject_id",
  from_type = "Sample",
  to_type = "Subject",
  relation = "sample_belongs_to_subject"
)
}
