Creates the ggraph object, i.e. the graph depicting the words containing the variables vector wordvars The combinations of all word pairs are computed for all concecutive pair of variables and the centrality of each word is calculated according to centralityfunction.
get.graph.1.n.group.centrality.with.function(
wordvars,
centralityfunction,
data.df,
iscircled = FALSE)
The vector containing the names of the variables
The centrality function to apply. Acceptable entries one of: tidygraph::centrality_authority(), tidygraph::centrality_betweenness(), tidygraph::centrality_closeness(), tidygraph::centrality_pagerank(), tidygraph::centrality_eigen(), tidygraph::centrality_alpha()
The data frame where the variables belong.
Should take also the combination between last and first variable (var_n - var1)? Default is FALSE.
A list contains the graph data for the selected centrality index.
get.all.graphs
# NOT RUN {
# It is a time consuming function...
# }
# NOT RUN {
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_authority(),
freeassociationdata)
# To plot the graph simply call:
agraph
# The centrality scores are available at:agraph$data$centrality
hist(agraph$data$centrality)
# Other available centrality functions...
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_betweenness(), freeassociationdata)
# Note: closeness centrality is not well-defined for disconnected graphs.
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_closeness(), freeassociationdata)
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_pagerank(), freeassociationdata)
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_eigen(), freeassociationdata)
agraph = get.graph.1.n.group.centrality.with.function(
c("diet1stword", "diet2ndword", "diet3rdword"),
tidygraph::centrality_alpha(), freeassociationdata)
# }
Run the code above in your browser using DataLab