Simple, safe transformation of attributes to values with which Gephi will cooperate.

write_graphml(g, file_path, na_numbers_as = -1, na_characters_as = "", ...)

Arguments

g

igraph::graph() object

file_path

File path to which to write or from which to read.

na_numbers_as

numeric(1L), Default: -1. Value to replace NA_real_/NA_integer_s in the resulting file.

na_characters_as

character(1L), Default: "". Value to replace NA_character_s in the resulting file.

...

Arguments passed to or from other methods.

Examples

path_to_tweet_file <- example_tweet_file() tweet_df <- read_tweets(file_path = path_to_tweet_file) tweet_graph <- as_igraph(tweet_df) tweet_graph
#> IGRAPH effaab0 DN-- 1228 1234 -- #> + attr: name (v/c), status_id (e/c), relation (e/c) #> + edges from effaab0 (vertex names): #> [1] 194250838 ->340309688 #> [2] 825459487821619201 ->966825602 #> [3] 1116228559616397312->3153145782 #> [4] 4374655520 ->4167284315 #> [5] 1172885625068036102->1112877891841343488 #> [6] 1132474594583928832->1217220278 #> [7] 20737729 ->39334221 #> [8] 2198859787 ->3096758526 #> + ... omitted several edges
graphml_path <- tempfile(fileext = ".graphml") graphml_path
#> [1] "/tmp/RtmpgRQ4gX/file7221f427a1f.graphml"
write_graphml(tweet_graph, file_path = graphml_path)