Renders the top-n_hubs function nodes (by PageRank) and their
one-hop neighbours as an interactive Graphviz widget via
DiagrammeR::grViz(). Nodes are grouped into dashed sub-graph boxes by
source file and coloured by node type; node width scales with relative
PageRank importance. In an interactive session the widget appears in the
RStudio Viewer or a browser tab.
Arguments
- x
An
rrlm_graphobject.- n_hubs
Integer(1). Number of top-PageRank function hub nodes to show. Default
15L.- layout
Character(1). Graphviz layout engine passed to the DOT
layoutattribute. One of"dot"(hierarchical, default),"neato","fdp","sfdp", or"circo".- file
Character(1) or
NULL. Optional output file path..html– saved viahtmlwidgets::saveWidget()(requires the htmlwidgets package)..png,.pdf,.svg– rendered bywebshot2::webshot()after writing a temporary HTML file (requires both htmlwidgets and webshot2).
- width, height
Integer(1). Used only when
fileis a raster or vector path (.png,.pdf,.svg): sets the viewport size in pixels thatwebshot2::webshot()renders. Has no effect on the interactive widget, which fills 100\ pan-and-zoom via injected vanilla JS. Defaults1400Lx900L.- ...
Ignored; kept for S3 dispatch compatibility.
Value
When file is NULL (default), an htmlwidget from
DiagrammeR::grViz() is returned visibly so it prints in the viewer.
The widget fills 100\
cursor), drag to pan, double-click to reset. When file is supplied,
x is returned invisibly.
Details
Interaction (no plugins required)
Scroll – zoom in / out centred on the cursor.
Click-drag – pan the graph.
Pinch (touch) – zoom on mobile/tablet.
Double-click – reset to the original fit-to-screen view.
Node colours:
User functions –
"#4682B4"(steelblue)Package nodes –
"#C8D8E8"(pale blue, smaller)Test files –
"#3CB371"(seagreen3)
Examples
if (FALSE) { # \dontrun{
g <- build_rrlm_graph("mypkg")
plot(g)
plot(g, n_hubs = 10L, layout = "neato")
plot(g, file = "graph.html")
plot(g, file = "graph.png", width = 1600L, height = 1000L)
} # }