a b/man/plot_rwr_subnetwork.Rd
1
% Generated by roxygen2: do not edit by hand
2
% Please edit documentation in R/plot.R
3
\name{plot_rwr_subnetwork}
4
\alias{plot_rwr_subnetwork}
5
\title{Plot RWR subnetwork}
6
\usage{
7
plot_rwr_subnetwork(X, color = NULL, plot = TRUE, legend = TRUE, ...)
8
}
9
\arguments{
10
\item{X}{an igraph object}
11
12
\item{color}{(optional) a named character vector or list, list of color
13
to apply to each type}
14
15
\item{plot}{logical, if TRUE then the plot is produced}
16
17
\item{legend}{(optional) logical, if TRUE then the legend is displayed
18
with number of veretices/edges and the number of nodes of specific type.}
19
20
\item{...}{Arguments to be passed to the plot method}
21
}
22
\value{
23
X is returned with additional vertex attributes
24
}
25
\description{
26
Display the subgraph from a RWR results. This function colors adds a specific
27
color to each node based on their 'type' attribute.
28
It also adds a legend including the number of vertices/edges and the number
29
of nodes of specific type.
30
Additionally, the function can display any igraph object.
31
}
32
\examples{
33
graph1 <- igraph::graph_from_data_frame(
34
    list(from = c("A", "B", "A", "D", "C", "A", "C"), 
35
         to = c("B", "C", "D", "E", "D", "F", "G")), 
36
    directed = FALSE)
37
graph1 <- igraph::set_vertex_attr(graph = graph1,
38
                                  name = 'type', 
39
                                  index = c("A","B","C"),
40
                                  value = "1")
41
graph1 <- igraph::set_vertex_attr(graph = graph1, 
42
                                  name = 'type', 
43
                                  index = c("D","E"),
44
                                  value = "2")
45
graph1 <- igraph::set_vertex_attr(graph = graph1, 
46
                                  name = 'type', 
47
                                  index = c("F", "G"),
48
                                  value = "3")
49
50
rwr_res <- random_walk_restart(X = graph1, 
51
                               seed = c("A"))
52
rwr_res_type <- rwr_find_seeds_between_attributes(X = rwr_res, 
53
                                                  attribute = "type")
54
55
plot_rwr_subnetwork(rwr_res_type$A)
56
57
58
}