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