Having a dataframe like this:
df <- data.frame(
n1 = c(1, 1, 1, 0, 0),
n2 = c(0, 0, 0, 0, 1),
n3 = c(0, 0, 0, 1, 0),
n4 = c(0, 0, 0, 0, 0),
n5 = c(0, 0, 0, 1, 0),
n6 = c(0, 0, 0, 0, 0),
n7 = c(0, 0, 0, 0, 0)
)
and a graph like this:
library(igraph)
plot(make_full_graph(7), vertex.name = head(LETTERS))
in which the column names of the dataframe is the names of nodes of the graph.
Using a shortest path option from reinforment learning algorithms how it is possible to make it?