1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/get_cmty_l_eigenvec.R
3\name{get_cmty_l_eigenvec}
4\alias{get_cmty_l_eigenvec}
5\title{Get community membership by leading eigenvector}
6\usage{
7get_cmty_l_eigenvec(graph)
8}
9\arguments{
10\item{graph}{A graph object of class \code{dgr_graph}.}
11}
12\value{
13A data frame with group membership assignments for each of the nodes.
14}
15\description{
16Through the calculation of the leading non-negative eigenvector of the
17modularity matrix of the graph, obtain the group membership values for each
18of the nodes in the graph.
19}
20\examples{
21# Create a random graph using the
22# `add_gnm_graph()` function
23graph <-
24  create_graph(
25    directed = FALSE) \%>\%
26  add_gnm_graph(
27    n = 10,
28    m = 15,
29    set_seed = 23)
30
31# Get the group membership
32# values for all nodes in the
33# graph through calculation of
34# the leading non-negative
35# eigenvector of the modularity
36# matrix of the graph
37graph \%>\%
38  get_cmty_l_eigenvec()
39
40# Add the group membership
41# values to the graph as a node
42# attribute
43graph <-
44  graph \%>\%
45  join_node_attrs(
46    df = get_cmty_l_eigenvec(.))
47
48# Display the graph's node data frame
49graph \%>\% get_node_df()
50
51}
52