This function extracts the neighborhood of each node as a graph and maps over
each of these neighborhood graphs. Conceptually it is similar to
`igraph::local_scan()`

, but it borrows the type safe versions available in
`map_bfs()`

and `map_dfs()`

.

```
map_local(order = 1, mode = "all", mindist = 0, .f, ...)
map_local_lgl(order = 1, mode = "all", mindist = 0, .f, ...)
map_local_chr(order = 1, mode = "all", mindist = 0, .f, ...)
map_local_int(order = 1, mode = "all", mindist = 0, .f, ...)
map_local_dbl(order = 1, mode = "all", mindist = 0, .f, ...)
```

- order
Integer giving the order of the neighborhood.

- mode
Character constant, it specifies how to use the direction of the edges if a directed graph is analyzed. For ‘out’ only the outgoing edges are followed, so all vertices reachable from the source vertex in at most

`order`

steps are counted. For ‘"in"’ all vertices from which the source vertex is reachable in at most`order`

steps are counted. ‘"all"’ ignores the direction of the edges. This argument is ignored for undirected graphs.- mindist
The minimum distance to include the vertex in the result.

- .f
A function to map over all nodes. See Details

- ...
Additional parameters to pass to

`.f`

`map_local()`

returns a list of the same length as the number of
nodes in the graph, in the order matching the node order in the graph.
`map_local_*()`

tries to coerce its result into a vector of the classes
`logical`

(`map_local_lgl`

), `character`

(`map_local_chr`

), `integer`

(`map_local_int`

), or `double`

(`map_local_dbl`

). These functions will throw
an error if they are unsuccesful, so they are type safe.

The function provided to `.f`

will be called with the following arguments in
addition to those supplied through `...`

:

`neighborhood`

: The neighborhood graph of the node`graph`

: The full`tbl_graph`

object`node`

: The index of the node currently mapped over

The `neighborhood`

graph will contain an extra node attribute called
`.central_node`

, which will be `TRUE`

for the node that the neighborhood is
expanded from and `FALSE`

for everything else.

```
# Smooth out values over a neighborhood
create_notable('meredith') %>%
mutate(value = rpois(graph_order(), 5)) %>%
mutate(value_smooth = map_local_dbl(order = 2, .f = function(neighborhood, ...) {
mean(as_tibble(neighborhood, active = 'nodes')$value)
}))
#> # A tbl_graph: 70 nodes and 140 edges
#> #
#> # An undirected simple graph with 1 component
#> #
#> # Node Data: 70 × 2 (active)
#> value value_smooth
#> <int> <dbl>
#> 1 4 5.18
#> 2 5 4.55
#> 3 2 4.91
#> 4 6 5.27
#> 5 5 4.55
#> 6 7 4.55
#> 7 3 4.55
#> 8 7 5.27
#> 9 7 4.73
#> 10 2 4.27
#> # ℹ 60 more rows
#> #
#> # Edge Data: 140 × 2
#> from to
#> <int> <int>
#> 1 1 5
#> 2 1 6
#> 3 1 7
#> # ℹ 137 more rows
```