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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/morphers.R
\name{morphers}
\alias{morphers}
\alias{to_linegraph}
\alias{to_subgraph}
\alias{to_subcomponent}
\alias{to_split}
\alias{to_components}
\alias{to_largest_component}
\alias{to_complement}
\alias{to_local_neighborhood}
\alias{to_dominator_tree}
\alias{to_minimum_spanning_tree}
\alias{to_random_spanning_tree}
\alias{to_shortest_path}
\alias{to_bfs_tree}
\alias{to_dfs_tree}
\alias{to_simple}
\alias{to_contracted}
\alias{to_unfolded_tree}
\alias{to_directed}
\alias{to_undirected}
\alias{to_hierarchical_clusters}
\title{Functions to generate alternate representations of graphs}
\usage{
to_linegraph(graph)
to_subgraph(graph, ..., subset_by = NULL)
to_subcomponent(graph, node)
to_split(graph, ..., split_by = NULL)
to_components(graph, type = "weak", min_order = 1)
to_largest_component(graph, type = "weak")
to_complement(graph, loops = FALSE)
to_local_neighborhood(graph, node, order = 1, mode = "all")
to_dominator_tree(graph, root, mode = "out")
to_minimum_spanning_tree(graph, weights = NULL)
to_random_spanning_tree(graph)
to_shortest_path(graph, from, to, mode = "out", weights = NULL)
to_bfs_tree(graph, root, mode = "out", unreachable = FALSE)
to_dfs_tree(graph, root, mode = "out", unreachable = FALSE)
to_simple(graph, remove_multiples = TRUE, remove_loops = TRUE)
to_contracted(graph, ..., simplify = TRUE)
to_unfolded_tree(graph, root, mode = "out")
to_directed(graph)
to_undirected(graph)
to_hierarchical_clusters(graph, method = "walktrap", weights = NULL, ...)
}
\arguments{
\item{graph}{A \code{tbl_graph}}
\item{...}{Arguments to pass on to \code{\link[=filter]{filter()}}, \code{\link[=group_by]{group_by()}}, or the cluster
algorithm (see \code{\link[igraph:cluster_walktrap]{igraph::cluster_walktrap()}}, \code{\link[igraph:cluster_leading_eigen]{igraph::cluster_leading_eigen()}},
and \code{\link[igraph:cluster_edge_betweenness]{igraph::cluster_edge_betweenness()}})}
\item{subset_by, split_by}{Whether to create subgraphs based on nodes or edges}
\item{node}{The center of the neighborhood for \code{to_local_neighborhood()} and
the node to that should be included in the component for \code{to_subcomponent()}}
\item{type}{The type of component to split into. Either \code{'weak'} or \code{'strong'}}
\item{min_order}{The minimum order (number of vertices) of the component.
Components below this will not be created}
\item{loops}{Should loops be included. Defaults to \code{FALSE}}
\item{order}{The radius of the neighborhood}
\item{mode}{How should edges be followed? \code{'out'} only follows outbound
edges, \code{'in'} only follows inbound edges, and \code{'all'} follows all edges. This
parameter is ignored for undirected graphs.}
\item{root}{The root of the tree}
\item{weights}{Optional edge weights for the calculations}
\item{from, to}{The start and end node of the path}
\item{unreachable}{Should the search jump to a node in a new component when
stuck.}
\item{remove_multiples}{Should edges that run between the same nodes be
reduced to one}
\item{remove_loops}{Should edges that start and end at the same node be removed}
\item{simplify}{Should edges in the contracted graph be simplified? Defaults
to \code{TRUE}}
\item{method}{The clustering method to use. Either \code{'walktrap'}, \code{'leading_eigen'}, or \code{'edge_betweenness'}}
}
\value{
A list of \code{tbl_graph}s
}
\description{
These functions are meant to be passed into \code{\link[=morph]{morph()}} to create a temporary
alternate representation of the input graph. They are thus not meant to be
called directly. See below for detail of each morpher.
}
\section{Functions}{
\itemize{
\item \code{to_linegraph()}: Convert a graph to its line graph. When unmorphing node
data will be merged back into the original edge data. Edge data will be
ignored.
\item \code{to_subgraph()}: Convert a graph to a single subgraph. \code{...} is evaluated
in the same manner as \code{filter}. When unmorphing all data in the subgraph
will get merged back.
\item \code{to_subcomponent()}: Convert a graph to a single component containing the specified node
\item \code{to_split()}: Convert a graph into a list of separate subgraphs. \code{...}
is evaluated in the same manner as \code{group_by}. When unmorphing all data in
the subgraphs will get merged back, but in the case of \code{split_by = 'edges'}
only the first instance of node data will be used (as the same node can be
present in multiple subgraphs).
\item \code{to_components()}: Split a graph into its separate components. When
unmorphing all data in the subgraphs will get merged back.
\item \code{to_largest_component()}: Create a new graph only consisting of it's largest
component. If multiple largest components exists, the one with containing the
node with the lowest index is chosen.
\item \code{to_complement()}: Convert a graph into its complement. When unmorphing
only node data will get merged back.
\item \code{to_local_neighborhood()}: Convert a graph into the local neighborhood around a
single node. When unmorphing all data will be merged back.
\item \code{to_dominator_tree()}: Convert a graph into its dominator tree based on a
specific root. When unmorphing only node data will get merged back.
\item \code{to_minimum_spanning_tree()}: Convert a graph into its minimum spanning tree/forest.
When unmorphing all data will get merged back.
\item \code{to_random_spanning_tree()}: Convert a graph into a random spanning tree/forest. When
unmorphing all data will get merged back
\item \code{to_shortest_path()}: Limit a graph to the shortest path between two nodes.
When unmorphing all data is merged back.
\item \code{to_bfs_tree()}: Convert a graph into a breath-first search tree based on
a specific root. When unmorphing only node data is merged back.
\item \code{to_dfs_tree()}: Convert a graph into a depth-first search tree based on
a specific root. When unmorphing only node data is merged back.
\item \code{to_simple()}: Collapse parallel edges and remove loops in a graph.
When unmorphing all data will get merged back
\item \code{to_contracted()}: Combine multiple nodes into one. \code{...}
is evaluated in the same manner as \code{group_by}. When unmorphing all
data will get merged back.
\item \code{to_unfolded_tree()}: Unfold a graph to a tree or forest starting from
multiple roots (or one), potentially duplicating nodes and edges.
\item \code{to_directed()}: Make a graph directed in the direction given by from and
to
\item \code{to_undirected()}: Make a graph undirected
\item \code{to_hierarchical_clusters()}: Convert a graph into a hierarchical clustering based on a grouping
}}
\examples{
# Compute only on a subgraph of every even node
create_notable('meredith') \%>\%
morph(to_subgraph, seq_len(graph_order()) \%\% 2 == 0) \%>\%
mutate(neighbour_count = centrality_degree()) \%>\%
unmorph()
}
|