export.dot: Export a network file as Graphviz .dot formatted text file.

View source: R/export.dot.R

export.dotR Documentation

Export a network file as Graphviz .dot formatted text file.

Description

A crude exporter for saving out a network in the Graphviz .dot format. https://graphviz.org/content/dot-language

Usage

export.dot(x, file = "", coords = NULL, all.dyads = FALSE, 
            vert.attrs = NULL, edge.attrs = NULL)

Arguments

x

The network object to be exported

file

The file name where network should be saved

coords

Optional node coordinates to include

all.dyads

FALSE, a numeric value, or a symetric matrix of distances providing the desired lengths for all dyads.. If numeric, entries are written out for all possible dyads in the network, and the numeric value will be used to fill in the values for all the dyads in the matrix not linked by an edge (see default.dist param to layout.distance). This is necessary for some uses cases, but will generate dramatically larger files and slower performance. For the matrix and numeric cases, the values will be written as Graphviz 'len' edge attributes, and the values of edge.attrs will be ignored.

vert.attrs

optional character vector listing the names of any vertex attributes of the network that should be included as attributes of the nodes in the Graphviz dot file. (e.g. 'label', 'width')

edge.attrs

optional character vector listing the names of any edge attributes of the network that should be included as attributes of edges in the Graphviz dot file. (e.g. 'weight','penwidth')

Details

A crude exporter for saving out a network in the Graphviz .dot format. https://graphviz.org/content/dot-language

Value

Returns nothing but creates a file in .dot format: https://graphviz.org/content/dot-language

Note

This is still a partial implementation focusing on edges, edge wights, and node coordinates in order to pass the information to graphViz to use it as an external layout engine rather than a renderer.

Author(s)

Skye Bender-deMoll

References

https://graphviz.org/content/dot-language

Examples

 library(network)
 net <- network.initialize(5)
 net[1,] <-1
 net[2,3] <-2
 export.dot(net,file="testNet.dot")
 
 # clean up file afterwords (just for testing)
 file.remove("testNet.dot")

ndtv documentation built on July 4, 2024, 5:08 p.m.