For the first part (getting all locations covered by a manager in a single row) we can do:
library(dplyr)
df %>%
group_by(Manager) %>%
summarize(Location = paste(Location, collapse = ", "))
#> # A tibble: 3 x 2
#> Manager Location
#> <chr> <chr>
#> 1 M12 L34, L23
#> 2 M3 L4
#> 3 M45 L1, L2, L5, L11
Your original data frame is already in the correct format to make a graph:
plot(tidygraph::as_tbl_graph(df))

If you want a prettier representation of the graph, you could use ggraph
, for example:
library(ggraph)
df[2:1] %>%
rbind(data.frame(Manager = "Managers", Location = unique(df$Manager))) %>%
tidygraph::as_tbl_graph() %>%
ggraph(circular = TRUE) +
geom_edge_bend() +
geom_node_circle(aes(r = ifelse(name == "Managers", 0, 0.1),
fill = substr(name, 1, 1))) +
geom_node_text(aes(label = ifelse(name == "Managers", "", name))) +
scale_fill_manual(values = c("deepskyblue", "gold"),
labels = c("Managers", "Locations"),
name = NULL) +
theme_void(base_size = 16) +
coord_equal()

Question data in reproducible format
df <- data.frame(Location = c("L1", "L2", "L34", "L5", "L23", "L4", "L11"),
Manager = c("M45", "M45", "M12", "M45", "M12", "M3", "M45"))
Created on 2022-08-31 with reprex v2.0.2