build_kgraph: Build a knowledge graph

View source: R/build_kgraph.R

build_kgraphR Documentation

Build a knowledge graph

Description

Build a knowledge graph

Usage

build_kgraph(
  selected_concepts,
  df_weights,
  df_dict = NULL,
  rm_single_groups = TRUE,
  df_sup_nodes = NULL,
  display_val_digits = 3,
  display_val_str = "\nCosine similarity: ",
  str_other = "Other",
  highlight_mult = TRUE,
  multiline_labs = TRUE,
  autoscale = TRUE,
  spring_weights = TRUE,
  n_max_edges = 1000,
  ...
)

Arguments

selected_concepts

Concepts of interest

df_weights

Data frame with columns concept1, concept2, and weight; typically the df_projs slot of the object returned by function fit_embeds_to_pairs

df_dict

Dictionary data frame, with columns id (matched to concepts in df_weights), desc (for labels), color, and optionally group.

rm_single_groups

Should groups with only one element be removed

df_sup_nodes

Data frame of supplementary nodes (work in progress)

display_val_digits

Number of weight digits to be displayed in labels

display_val_str

String to prefix to the displayed value

str_other

String to use for missing groups

highlight_mult

Highlight nodes connected to multiple nodes of interest.

multiline_labs

Use multiline labels (shown when hovered on)

autoscale

Perform scaling with sgraph::scale_graph

spring_weights

Use spring weights (reverts edges weights)

n_max_edges

Threshold on number of edges

...

Passed to scale_kgraph

Value

Knowledge graph, list of slots df_nodes and df_links


kgraph documentation built on April 12, 2025, 1:42 a.m.