# write.gexf

0th

Percentile

##### Builds a graph of gexf class

write.gexf takes a node matrix (or dataframe) and an edge matrix (or dataframe) and creates a gexf object containing a data-frame representation and a gexf representation of a graph.

Keywords
IO
##### Usage
write.gexf( nodes, edges, edgesLabel = NULL, edgesId = NULL, edgesAtt = NULL, edgesWeight = NULL,  edgesVizAtt = list( color=NULL,  size=NULL,  shape=NULL ), nodesAtt = NULL, nodesVizAtt = list( color=NULL,  position=NULL,  size=NULL,  shape=NULL,  image=NULL ), nodeDynamic = NULL,  edgeDynamic = NULL,  digits = getOption("digits"), output = NA, tFormat = "double",  defaultedgetype = "undirected", meta = list( creator="NodosChile",  description="A graph file writing in R using \"rgexf\"", keywords="gexf graph, NodosChile, R, rgexf"), keepFactors = FALSE, encoding = "UTF-8" )
##### Arguments
nodes
A two-column data-frame or matrix of “id”s and “label”s representing nodes.
edges
A two-column data-frame or matrix containing “source” and “target” for each edge. Source and target values are based on the nodes ids.
edgesId
A one-column data-frame, matrix or vector.
edgesLabel
A one-column data-frame, matrix or vector.
edgesAtt
A data-frame with one or more columns representing edges' attributes.
edgesWeight
A numeric vector containing edges' weights.
edgesVizAtt
List of three or less viz attributes such as color, size (thickness) and shape of the edges (see details)
nodesAtt
A data-frame with one or more columns representing nodes' attributes
nodesVizAtt
List of four or less viz attributes such as color, position, size and shape of the nodes (see details)
nodeDynamic
A two-column matrix or data-frame. The first column indicates the time at which a given node starts; the second one shows when it ends. The matrix or data-frame must have the same number of rows than the number of nodes in the graph.
edgeDynamic
A two-column matrix or data-frame. The fist column indicates the time at which a given edge stars; the second one shows when it ends. The matrix or dataframe must have the same number of rows than the number of edges in the graph.
digits
Integer. Number of decimals to keep for nodes/edges sizes. See print.default
output
String. The complete path (including filename) where to export the graph as a GEXF file.
tFormat
String. Time format for dynamic graphs (see details)
defaultedgetype
“directed”, “undirected”, “mutual”
meta
A List. Meta data describing the graph
keepFactors
Logical, whether to handle factors as numeric values (TRUE) or as strings (FALSE) by using as.character.
encoding
Encoding of the graph.
##### Details

Just like nodesVizAtt and edgesVizAtt, nodesAtt and edgesAtt must have the same number of rows as nodes and edges, respectively. Using data frames is necessary as in this way data types are preserved. nodesVizAtt and edgesVizAtt allow using visual attributes such as color, position (nodes only), size (nodes only), thickness (edges only) shape and image (nodes only).

• Color is defined by the RGBA color model, thus for every node/edge the color should be specified through a data-frame with columns r (red), g (green), b (blue) with integers between 0 and 256 and a last column with alpha values as a float between 0.0 and 1.0.
• Position, for every node, it is a three-column data-frame including x, y and z coordinates. The three components must be float.
• Size as a numeric colvector (float values).
• Thickness (see size).
• Node Shape (string), currently unsupported by Gephi, can take the values of disk, square, triangle, diamond and image.
• Edge Shape (string), currently unsuported by Gephi, can take the values of solid, dotted, dashed and double.
• Image (string), currently unsupported by Gephi, consists on a vector of strings representing URIs.

nodeDynamic and edgeDynamic allow to draw dynamic graphs. It should contain two columns start and end, both allowing NA value. It can be use jointly with tFormat which by default is setted as “double”. Currently accepted time formats are:

##### Value

A gexf class object (list). Contains the following:
• meta : (list) Meta data describing the graph.
• mode : (list) Sets the default edge type and the graph mode.
• atts.definitions: (list) Two data-frames describing nodes and edges attributes.
• nodesVizAtt : (data-frame) A multi-column data-frame with the nodes' visual attributes.
• edgesVizAtt : (data-frame) A multi-column data-frame with the edges' visual attributes.
• nodes : (data-frame) A two-column data-frame with nodes' ids and labels.
• edges : (data-frame) A five-column data-frame with edges' ids, labels, sources, targets and weights.
• graph : (String) GEXF (XML) representation of the graph.

##### References

The GEXF project website: http://gexf.net

new.gexf.graph

• write.gexf
##### Examples
  ## Not run:
#   demo(gexf) # Example of gexf command using fictional data.
#   demo(gexfattributes) # Working with attributes.
#   demo(gexfbasic) # Basic net.
#   demo(gexfdynamic) # Dynamic net.
#   demo(edge.list) # Working with edges lists.
#   demo(gexffull) # All the package.