Learn R Programming

Rato (version 0.1.0)

graph.from.csv: Loads a graph from Node / Edge CSV files

Description

This function takes the file paths to two CSV files: one containing the node information of a network and the other containing the edge information of the network. It returns a list containing several useful data related to the network.

Usage

graph.from.csv(nodeinfo_path, edgeinfo_path, ...)

Value

A list `L` with the following entries:

M:

the adjacency matrix of the network.

initial_values:

an array of initial values for the network.

node_index:

a function that takes a node name and returns its index value.

node_value:

a function that takes a node name and returns its initial value.

edge_index:

a function that takes two node names and returns the index value of the edge connecting them.

edge_weight:

a function that takes two node names and returns the weight of the edge connecting them.

g:

the igraph graph associated with the network.

edges:

an array of edges.

nodes:

an array of nodes.

node_names:

an array of node names.

Arguments

nodeinfo_path

Path to a CSV file containing the node information. This CSV file should follow the convention of `node_name, initial_value`.

edgeinfo_path

Path to a CSV file containing the edge information. This CSV file should follow the convention of `source_node_name, target_node_name, edge_weight`.

...

Additional arguments passed to read.csv

Examples

Run this code
# \donttest{
   node_file <- system.file("extdata", "IL17.nodes.csv", package = "Rato")
   edge_file <- system.file("extdata", "IL17.edges.csv", package = "Rato")
   M <- graph.from.csv(node_file, edge_file)
# }

Run the code above in your browser using DataLab