visualize Graph
Visualizes the graph with Bruno Silva's JavaFXSmartGraph library.
The function visualizes nodes with edges using a force-directed algorithm. Then it animates the traversal of the graph, highlighting visited nodes and the final path from the start node to the target node if a search has been performed.
Example usage:
val graph = Graph(false)
graph.connect("A", "B")
graph.connect("A", "C")
graph.visualizeGraph(
bidirectional = true,
finalPath = listOf("A", "B"),
screenTitle = "GraphMateKT visualizeGraph example usage",
animationTicTimeOverride = 2000.0,
closeOnEnd = true,
startPaused = true,
screenWidthOverride = 300.0
)NOTE: to use this visualizeGraph() function, the files smartgraph.css and smartgraph.properties must be added manually to the root of your project, as described in Bruno Silva's JavaFXSmartGraph repository: https://github.com/brunomnsilva/JavaFXSmartGraph
Parameters
If true, visualizes the graph as bidirectional, otherwise as directed.
A list of nodes that can override the final path, and be animated instead. If not provided, the graph's own final path is used.
The title of the visualization window.
Overrides the default animation speed in milliseconds.
If true, closes the visualization window when the animation ends.
If true, starts the visualization in a paused state.
Overrides the default screen width for the visualization.
Throws
If the graph is improperly configured for visualization.