[73f552]: / man / get_graph_stats.Rd

Download this file

46 lines (42 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_graph_stats.R
\name{get_graph_stats}
\alias{get_graph_stats}
\title{Get graph statistics}
\usage{
get_graph_stats(X)
}
\arguments{
\item{X}{an 'igraph' or 'list.igraph' object}
}
\value{
It returns a long data.frame with number of nodes/edges,
and the count of the different attributes
(if X is a list of graph, each row describes a graph)
}
\description{
For a given igraph or list of igraph objects, this function summarize
the number of vertices/edges and other vertex attributes.
}
\examples{
graph1 <- igraph::graph_from_data_frame(
list(from = c('A', 'B', 'A', 'D', 'C', 'A', 'C'),
to = c('B', 'C', 'D', 'E', 'D', 'F', 'G')),
directed = FALSE)
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('A','B','C'),
value = '1')
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('D','E'),
value = '2')
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('F', 'G'),
value = '-1')
get_graph_stats(graph1)
graph1.list <- list(graph1 = graph1,
graph2 = graph1)
get_graph_stats(graph1.list)
}