Crosstalk

Standard

still in development.

Since v0.1.0 the package is crosstalk integrated.

Because graphs consist of two data.frames (nodes and edges), crosstalk is restricted to one of them, nodes. In essence, not much changes, you use the SharedData built with crosstalk like you would normally use the nodes data frame.

**Pass your node ids as keys in SharedData*

library(DT)
library(sigmajs)
library(crosstalk)

nodes <- sg_make_nodes(20)
edges <- sg_make_edges(nodes)

# pass node ids as keys
sd <- SharedData$new(nodes, key = nodes$id)

div(
class = "row",
div(
class = "col-md-6",
sigmajs() %>%
sg_nodes(sd, id, color, size, label) %>%
sg_edges(edges, id, source, target) %>%
sg_layout() %>%
sg_settings(
mouseWheelEnabled = FALSE
)
),
div(
class = "col-md-6",
datatable(sd, style = "bootstrap", class = "compact", width = "100%",
selection = "single")
)
)

igraph

Crosstalk also works with other formats.

library(DT)
library(sigmajs)
library(crosstalk)

g <- igraph::make_graph(sample(LETTERS, 50, replace = TRUE))

vertices <- igraph::as_data_frame(g, what = "vertices")
sd <- SharedData$new(vertices, key = vertices$name)

div(
class = "row",
div(
class = "col-md-6",
sigmajs() %>%
sg_from_igraph(g, sd = sd) %>%
sg_neighbours() %>%
sg_settings(
mouseWheelEnabled = FALSE,
defaultNodeColor = "#98D3A5"
)
),
div(
class = "col-md-6",
datatable(sd, style = "bootstrap", class = "compact", width = "100%",
selection = "single")
)
)
{"ft_lang_label":"__label__en","ft_lang_prob":0.6843342,"math_prob":0.98680514,"size":1405,"snap":"2019-43-2019-47","text_gpt3_token_len":403,"char_repetition_ratio":0.13990007,"word_repetition_ratio":0.23589744,"special_character_ratio":0.31886122,"punctuation_ratio":0.19574468,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9864717,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-23T21:28:39Z\",\"WARC-Record-ID\":\"<urn:uuid:81a6f5a3-5592-4a9a-b672-12c86d5ef31f>\",\"Content-Length\":\"519811\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ebd82a59-7674-421e-948d-9a5d65298f09>\",\"WARC-Concurrent-To\":\"<urn:uuid:3d979b9a-0b03-4966-af16-6ab743b73e82>\",\"WARC-IP-Address\":\"193.194.89.173\",\"WARC-Target-URI\":\"http://cran.usthb.dz/web/packages/sigmajs/vignettes/talkcross.html\",\"WARC-Payload-Digest\":\"sha1:IRY7CYL3RVPEBLW43DILRNUHMWSMZJZI\",\"WARC-Block-Digest\":\"sha1:JY5QUAB2TLRL4HCEVR4ROAVCS6NTPVYM\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570987836295.98_warc_CC-MAIN-20191023201520-20191023225020-00169.warc.gz\"}"}