Creates an interactive network diagram centered on a specific kanji, showing all similarity relationships in a force-directed graph layout.
Usage
wk_kanji_network(
kanji_df,
center_kanji,
max_depth = 2,
layout = "force",
node_size_by = "connections",
show_meanings = TRUE,
interactive = TRUE
)
Arguments
- kanji_df
Data frame of kanji data with similarity information
- center_kanji
Character string of the kanji to center the network on, or an English meaning (e.g., "Water" for 水)
- max_depth
Integer indicating how many degrees of separation to include (default: 2)
- layout
Layout algorithm: "force", "circle", "tree", "grid" (default: "force")
- node_size_by
Size nodes by: "level", "connections", "fixed" (default: "connections")
- show_meanings
Logical indicating whether to show meanings in node labels (default: TRUE)
- interactive
Logical indicating whether to create an interactive plot (default: TRUE)
Examples
if (FALSE) { # \dontrun{
# Get kanji data with similarity
subjects <- wk_subjects(types = "kanji", levels = 1:10, all_pages = TRUE)
kanji_df <- wk_extract_kanji(subjects$data, include_similarity = TRUE)
kanji_resolved <- wk_resolve_similarity_details(kanji_df, subjects$data)
# Create network centered on a specific kanji
wk_kanji_network(kanji_resolved, center_kanji = "水")
# Or use English meaning instead of kanji
wk_kanji_network(kanji_resolved, center_kanji = "Water")
# Create a more detailed network with 3 degrees of separation
wk_kanji_network(kanji_resolved, center_kanji = "Person", max_depth = 3,
node_size_by = "level", layout = "force")
} # }