Base Graph
Functions
Adds an unweighted edge between two nodes in the graph, and creates the nodes if they don't exist.
Adds an edge between two nodes in the graph, and creates the nodes if they don't exist.
Overloaded function that calls addEdge with weight converted to a double.
Overload of fun bfs(startNodes: List
Performs a Breadth-First Search, which finds the shortest path from the starting node to all other nodes, assuming the graph is unweighted (all edges have a weight of 1.0) It stores results that can be retrieved with the following functions:
Connects two nodes in the graph, by calling addEdge(node1,node2) and addEdge(node2, node1)
Connects two nodes in the graph, by calling addEdge(node1,node2, weight) and addEdge(node2, node1, weight)
Overloaded function that calls connect with weight converted to a double.
Retrieves a list of all visited nodes on the order they were visited during the last search operation (DFS, BFS, Dijkstra).
Retrieves the shortest distance between two nodes in the graph.
Retrieves the distance to the specified node from the starting node of the most recent search operation (BFS, Dijkstra).
Executes the Floyd-Warshall algorithm on the graph to compute the shortest paths between all pairs of nodes.
Executes a given function on all the neighbours of a given node.
Checks if the target node was found during the most recent search operation (BFS, Dijkstra).
Retrieves the node that is the farthest from the starting node in the most recent search operation (BFS, Dijkstra).
Retrieves the maximum distance from the starting node to any other node of the most recent search operation (BFS, Dijkstra).
Computes the Minimum Spanning Tree (MST) of the graph using Prim's algorithm.
Retrieves a list the neighboring nodes of the specified node.
Prints which nodes each node is connected to.
Clears the search results stored in the graph.
Identifies groups where each node is reachable from every other node in the group.
Builds an order of nodes so that the first nodes has no outgoing edges, then nodes with edges pointing to these and so on, assuming the graph is a Directed Acyclic Graph (DAG). This is done by running a DFS from each node and ordering the nodes by descending depth (post-order).
Retrieves a (unordered) list of all visited nodes. Or an empty list if no search algorithm (DFS, BFS, Dijkstra) has been run yet.
Visualizes the graph with Bruno Silva's JavaFXSmartGraph library.