1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/from_adj_matrix.R
3\name{from_adj_matrix}
4\alias{from_adj_matrix}
5\title{Create a graph using an adjacency matrix}
6\usage{
7from_adj_matrix(
8  x,
9  mode = "undirected",
10  weighted = FALSE,
11  use_diag = TRUE,
12  graph_name = NULL,
13  write_backups = FALSE,
14  display_msgs = FALSE
15)
16}
17\arguments{
18\item{x}{A square \code{matrix} object serving as the adjacency matrix.}
19
20\item{mode}{The method in which to interpret the input adjacency matrix.
21Options include: \code{undirected}, \code{directed}, \code{upper}, \code{lower}, \code{max}, \code{min},
22and \code{plus}.}
23
24\item{weighted}{Whether to create a weighted graph from the adjacency matrix.}
25
26\item{use_diag}{Whether to use the diagonal of the adjacency matrix in
27calculations. If \code{TRUE} then the diagonal values will be included as is. If
28\code{FALSE} then the diagonal values will be replaced with zero values before
29inclusion in any calculations.}
30
31\item{graph_name}{An optional string for labeling the graph object.}
32
33\item{write_backups}{An option to write incremental backups of changing graph
34states to disk. If \code{TRUE}, a subdirectory within the working directory will
35be created and used to store \code{RDS} files. The default value is \code{FALSE} so
36one has to opt in to use this functionality.}
37
38\item{display_msgs}{An option to display messages primarily concerned with
39changes in graph selections. By default, this is \code{FALSE}.}
40}
41\value{
42A graph object of class \code{dgr_graph}.
43}
44\description{
45Using an adjacency matrix object, generate a graph of class \code{dgr_graph}.
46}
47\examples{
48# Create an adjacency matrix
49adj_matrix <-
50  sample(
51    0:1, 100,
52    replace = TRUE,
53    prob = c(0.9,0.1)
54  ) \%>\%
55  matrix(ncol = 10)
56
57# Create a graph from the adjacency matrix
58graph <- from_adj_matrix(adj_matrix)
59
60}
61