library(shiny)
library(DiagrammeR)
library(visNetwork)
ui <- fluidPage(
textInput("node_A", " A:",width = '50px'),
textInput("node_B", " B:",width = '50px'),
textInput("node_d", " d:",width = '5px'),
grVizOutput("my_graphviz"),
#visNetworkOutput("mygraph")
)
server <- function(input, output) {
output$my_graphviz <- renderDiagrammeR({
# Convert inputs to integers
node_A <- as.integer(input$node_A)
node_B <- as.integer(input$node_B)
node_d<-(input$node_d)
# Calculate sum of node A and B
node_c <- node_A + node_B
my_graphviz <- grViz(paste0("digraph {
graph[rankdir = LR]
node[shape = ellipse]
d[image ='D:/desktop/images/Screenshot (918).png', label = '", node_d, "',width=5,height=1]
node[shape = ellipse, style = filled]
A[label = '", node_A, "']
B[label = '", node_B, "']
c[label = '", node_c, "']
edge[color = black]
A->d
B->d
d->c
}"))
my_graphviz
})
}
shinyApp(ui, server)