1################################################################################ 2# Demo of gexf function - basic example 3# Author: Jorge Fabrega 4################################################################################ 5 6pause <- function() { 7 invisible(readline("\nPress <return> to continue: ")) 8} 9 10pause() 11## Demos for rgexf - Basic example. 12## The basic function of rgexf requires: 13## 1. A matrix of nodes 14## 2. A matrix of edges 15 16# Defining a matrix of nodes 17people <- data.frame(matrix(c(1:4, 'juan', 'pedro', 'matthew', 'carlos'), 18 ncol=2)) 19people 20 21# Defining a matrix of edges 22relations <- data.frame(matrix(c(1,4,1,2,1,3,2,3,3,4,4,2,2,4,4,1,4,1), 23 ncol=2, byrow=T)) 24relations 25################################################################################ 26# Basic network 27# you create a .gexf archive by adding the expression: 28# 29# ,output="yourgraph.gexf" 30# 31# before the last closing 32# parenthesis in the following function 33pause() 34gexf(nodes=people, edges=relations) 35 36################################################################################ 37