Print graphs to the terminalSource:
These functions attempt to print a graph to the terminal in a human readable form.
# S3 method for igraph print( x, full = igraph_opt("print.full"), graph.attributes = igraph_opt("print.graph.attributes"), vertex.attributes = igraph_opt("print.vertex.attributes"), edge.attributes = igraph_opt("print.edge.attributes"), names = TRUE, max.lines = igraph_opt("auto.print.lines"), id = igraph_opt("print.id"), ... ) # S3 method for igraph summary(object, ...)
The graph to print.
Logical scalar, whether to print the graph structure itself as well.
Logical constant, whether to print graph attributes.
Logical constant, whether to print vertex attributes.
Logical constant, whether to print edge attributes.
Logical constant, whether to print symbolic vertex names (i.e. the
namevertex attribute) or vertex ids.
The maximum number of lines to use. The rest of the output will be truncated.
Whether to print the graph ID.
The graph of which the summary will be printed.
summary.igraph prints the number of vertices, edges and whether the
graph is directed.
print_all() prints the same information, and also lists the edges, and
optionally graph, vertex and/or edge attributes.
print.igraph() behaves either as
print_all() depending on the
full argument. See also the
‘print.full’ igraph option and
The graph summary printed by
print_all()) consists of one or more lines. The first line contains
the basic properties of the graph, and the rest contains its attributes.
Here is an example, a small star graph with weighted directed edges and named
IGRAPH badcafe DNW- 10 9 -- In-star + attr: name (g/c), mode (g/c), center (g/n), name (v/c), weight (e/n)
The first line always
IGRAPH, showing you that the object is an igraph graph.
Then a seven character code is printed, this the first seven characters
of the unique id of the graph. See
graph_id() for more.
Then a four letter long code string is printed. The first letter
distinguishes between directed (‘
D’) and undirected
U’) graphs. The second letter is ‘
N’ for named
graphs, i.e. graphs with the
name vertex attribute set. The third
letter is ‘
W’ for weighted graphs, i.e. graphs with the
weight edge attribute set. The fourth letter is ‘
bipartite graphs, i.e. for graphs with the
type vertex attribute set.
This is followed by the number of vertices and edges, then two dashes.
Finally, after two dashes, the name of the graph is printed, if it has one,
i.e. if the
name graph attribute is set.
From the second line, the attributes of the graph are listed, separated by a
comma. After the attribute names, the kind of the attribute -- graph
g’), vertex (‘
v’) or edge (‘
-- is denoted, and the type of the attribute as well, character
c’), numeric (‘
l’), or other (‘
As of igraph 0.4
print.igraph() use the
max.print option, see
base::options() for details.
As of igraph 1.1.1, the
str.igraph function is defunct, use
Gabor Csardi firstname.lastname@example.org
g <- make_ring(10) g #> IGRAPH 63d4a64 U--- 10 10 -- Ring graph #> + attr: name (g/c), mutual (g/l), circular (g/l) #> + edges from 63d4a64: #>  1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 summary(g) #> IGRAPH 63d4a64 U--- 10 10 -- Ring graph #> + attr: name (g/c), mutual (g/l), circular (g/l)