gexf-class {rgexf}R Documentation

Creates an object of class gexf

Description

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.

Usage

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 GEXF file written in R with \"rgexf\"", keywords =
    "GEXF, NodosChile, R, rgexf, Gephi"),
  keepFactors = FALSE,
  encoding = "UTF-8",
  vers = "1.3",
  rescale.node.size = TRUE
)

write.gexf(nodes, ...)

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.

edgesLabel

A one-column data-frame, matrix or vector.

edgesId

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.

vers

Character scalar. Version of the GEXF format to generate. By default "1.3".

rescale.node.size

Logical scalar. When TRUE it rescales the size of the vertices such that the largest one is about \ region.

...

Passed to gexf.

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).

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 set as “double”. Currently accepted time formats are:

NA values in the first column are filled with the min of c(nodeDynamic, edgeDynamic), whereas if in the second column is replaces with the max.

More complex time sequences like present/absent nodes and edges can be added with add.node.spell and add.edge.spell respectively.

Value

A gexf class object (list). Contains the following:

Author(s)

George Vega Yon

Jorge Fabrega Lacoa

References

The GEXF project website: https://gephi.org/gexf/format/

See Also

new.gexf.graph()

Examples


if (interactive()) {
  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.
  demo(gexfrandom)
}


[Package rgexf version 0.16.2 Index]