Using the gexf-js, a JavaScript GEXF viewer, this function allows you to
visualize your GEXF on the browser. The function essentially copies a template
website, the GEXF file, and sets up a configuration file. By default, the
function then starts a webserver using the servr
R package.
gexf_js_config(
dir,
graphFile = "network.gexf",
showEdges = TRUE,
useLens = FALSE,
zoomLevel = 0,
curvedEdges = TRUE,
edgeWidthFactor = 1,
minEdgeWidth = 1,
maxEdgeWidth = 50,
textDisplayThreshold = 9,
nodeSizeFactor = 1,
replaceUrls = TRUE,
showEdgeWeight = TRUE,
showEdgeLabel = TRUE,
sortNodeAttributes = TRUE,
showId = TRUE,
showEdgeArrow = TRUE,
language = FALSE
)# S3 method for gexf
plot(
x,
y = NULL,
graphFile = "network.gexf",
dir = tempdir(),
overwrite = TRUE,
httd.args = list(),
copy.only = FALSE,
...
)
Directory where the files will be copied (tempdir() by default).
Name of the gexf file.
Logical scalar. Default state of the "show edges" button (nullable).
Logical scalar. Default state of the "use lens" button (nullable).
Numeric scalar. Default zoom level. At zoom = 0, the graph should fill a 800x700px zone
Logical scalar. False for curved edges, true for straight edges this setting can't be changed from the User Interface.
Numeric scalar. Change this parameter for wider or narrower edges this setting can't be changed from the User Interface.
Numeric scalar.
Numeric scalar.
Numeric scalar.
Numeric scalar. Change this parameter for smaller or larger nodes this setting can't be changed from the User Interface.
Logical scalar. Enable the replacement of Urls by Hyperlinks this setting can't be changed from the User Interface.
Logical scalar. Show the weight of edges in the list this setting can't be changed from the User Interface.
Logical scalar.
Logical scalar. Alphabetically sort node attributes.
Logical scalar. Show the id of the node in the list this setting can't be changed from the User Interface.
Logical scalar. Show the edge arrows when the edge is directed this setting can't be changed from the User Interface.
Either FALSE
, or a character scalar with any of the
supported languages.
An object of class gexf
.
Ignored.
Logical scalar. When TRUE
, the default, the function
will overwrite all files copied from the template on the destination directory
as specified by dir
.
Further arguments to be passed to servr::httd from the servr package.
Logical scalar. When FALSE, the default, the function
will make a call to servr::httd
.
Further arguments passed to gexf_js_config
Currently, the only languages supported are: German (de), English (en), French (fr), Spanish (es), Italian (it), Finnish (fi), Turkish (tr), Greek (el), Dutch (nl)
An important thing for the user to consider is the fact that the function
only works if there are viz
attributes, this is, color, size, and position.
If the gexf object's XML document does not have viz attributes, users can
use the following hack:
# Turn the object ot igraph and go back
x <- igraph.to.gexf(gexf.to.igraph(x))# And you are ready to plot!
plot(x)
More details on this in the igraph.to.gexf function.
The files are copied directly from the path indicated by
system.file("gexf-js", package="rgexf")
. And the
parameters are set up by modifying the following template file stored under
the gexf-js/config.js.template
(see the output from
system.file("gexf-js/config.js.template", package="rgexf")
to see the
path to the template file).
The server is lunched if and only if interactive() == TRUE
.
gexf-js project website https://github.com/raphv/gexf-js.
if (interactive()) {
path <- system.file("gexf-graphs/lesmiserables.gexf", package="rgexf")
graph <- read.gexf(path)
plot(graph)
}
Run the code above in your browser using DataLab