igraph (version 0.5.5-1)

read.graph: Reading foreign file formats

Description

The read.graph function is able to read graphs in various representations from a file, or from a http connection. Currently some simple formats are supported.

Usage

read.graph(file, format = c("edgelist", "pajek", "ncol", "lgl",
        "graphml", "dimacs", "graphdb", "gml"), ...)

Arguments

file
The connection to read from. This can be a local file, or a http or ftp connection. It can also be a character string with the file name or URI.
format
Character constant giving the file format. Right now edgelist, pajek, graphml, gml, ncol, lgl, dimacs and graphdb are supported, the defaul
...
Additional arguments, see below.

Value

  • A graph object.

item

  • pajek
  • graphml
  • GML
  • ncol
  • weights
  • directed
  • lgl
  • weights
  • dimacs
  • graphdb

url

  • http://vlado.fmf.uni-lj.si/pub/networks/pajek/
  • http://graphml.graphdrawing.org
  • http://www.infosun.fim.uni-passau.de/Graphlet/GML/
  • http://bioinformatics.icmb.utexas.edu/lgl
  • http://bioinformatics.icmb.utexas.edu/lgl
  • ftp://dimacs.rutgers.edu/pub/netflow/general-info/
  • http://amalfi.dis.unina.it/graph/
  • http://amalfi.dis.unina.it/graph/db/doc/graphdbat-2.html

itemize

  • directed

tabular

  • ll
  • ll

tab

  • description, Pajek attribute id Vertex id x, y, z The x, y and z coordinate of the vertex vertexsize The size of the vertex when plotted (size in Pajek). shape The shape of the vertex when plotted. color Vertex color (ic in Pajek) if given with symbolic name color-red, color-green, color-blue Vertex color (ic in Pajek) if given in RGB notation framecolor Border color (bc in Pajek) if given with symbolic name framecolor-red, framecolor-green, framecolor-blue Border color (bc in Pajek) if given in RGB notation labelcolor Label color (lc in Pajek) if given with symbolic name labelcolor-red, labelcolor-green, labelcolor-blue Label color (lc in Pajek) if given in RGB notation xfact, yfact The x_fact and y_fact Pajek attributes. labeldist The distance of the label from the vertex. (lr in Pajek.) labeldegree, labeldegree2 The la and lphi Pajek attributes framewidth The width of the border (bw in Pajek). fontsize Size of the label font (fos in Pajek.) rotation The rotation of the vertex (phi in Pajek). radius Radius, for some vertex shapes (r in Pajek). diamondratio For the diamond shape (q in Pajek).
  • description, Pajek attribute weight Edge weights. label l in Pajek. color Edge color, if the color is given with a symbolic name, c in Pajek. color-red, color-green, color-blue Edge color if it was given in RGB notation, c in Pajek. edgewidth w in Pajek. arrowsize s in Pajek. hook1, hook2 h1 and h2 in Pajek. angle1, angle2 a1 and a2 in Pajek, Bezier curve parameters. velocity1, velocity2 k1 and k2 in Pajek, Bezier curve parameter. arrowpos ap in Pajek. labelpos lp in Pajek. labelangle, labelangle2 lr and lphi in Pajek. labeldegree la in Pajek. fontsize fos in Pajek. arrowtype a in Pajek. linepattern p in Pajek. labelcolor lc in Pajek.

sQuote

  • x
  • y
  • z
  • name
  • weight
  • #
  • name
  • weight

preformatted

# vertex1name vertex2name [optionalWeight] vertex3name [optionalWeight]

emph

  • The graphs are stored in a compact binary format, one graph per file. The file is composed of 16 bit words, which are represented using the so-called little-endian convention, i.e. the least significant byte of the word is stored first.
  • Then, for each node, the file contains the list of edges coming out of the node itself. The list is represented by a word encoding its length, followed by a word for each edge, representing the destination node of the edge. Node numeration is 0-based, so the first node of the graph has index 0.

Details

The read.graph function may have additional arguments depending on the file format (the format argument).
  • edgelist
{ This format is a simple text file with numeric vertex ids defining the edges. There is no need to have newline characters between the edges, a simple space will also do. Additional arguments:
  • n
{The number of vertices in the graph. If it is smaller than or equal to the largest integer in the file, then it is ignored; so it is safe to set it to zero (the default).} directed{Logical scalar, whether to create a directed graph. The default value is TRUE.} }

See Also

write.graph