graph_to_file: Write the graph in a PAFit_net object to file

View source: R/graph_to_file.R

graph_to_fileR Documentation

Write the graph in a PAFit_net object to file

Description

This function writes a graph in a PAFit_net object to an output file. Accepted file formats are the edgelist format or the gml format.

Usage

graph_to_file(net_object, file_name, format = "edgelist")

Arguments

net_object

An object of class PAFit_net.

file_name

A string indicates the file name.

format

String. Possible values are "edgelist" and "gml".

If format = "edgelist", we just output the edgelist matrix contained in the PAFit_net object as it is.

If format = "gml", here is the specification of the gml file. There is a binary field directed indicating the type of the network (0: undirected, 1: directed). There are three atrributes for an edge: source, target, and time. There are three atrributes for a node: id, isolated (binary) and time. The atrribute time is NULL if the attribute isolated is 0 (since this is not an isolated node, we do not need to record its first apperance time). On the other hand, time is the node's appearance time if attribute isolated is 1.

Value

The function writes directly to the output file.

Author(s)

Thong Pham thongphamthe@gmail.com

Examples

library("PAFit")
# a network from Bianconi-Barabasi model
net        <- generate_BB(N = 50 , m = 10 , s = 10)
#graph_to_file(net, file_name = "test.gml", format = "gml")

thongphamthe/PAFit documentation built on July 19, 2023, 2:45 p.m.