gexf
classwrite.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.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" )
print.default
TRUE
) or as strings (FALSE
) by using as.character
.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.
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).
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:
new.gexf.graph
## 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.
# demo(gexftwitter) # Example with real data of chilean twitter accounts.
# demo(gexfdynamicandatt) # Dynamic net with static attributes.
# demo(gexfbuildfromscratch) # Example building a net from scratch.
# ## End(Not run)
Run the code above in your browser using DataLab