Graph Analysis
The UI-free graph helpers run over a graph you can edit: BlowGraphAlgorithms for order, cycles, components, reachability and shortest routes, BlowGraphValidator for rules, and search to take you to what you are looking for. Pick an analysis; the answer is marked on the graph and listed beside it, and recomputed after every edit.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry it
- Dependency order numbers the nodes so each comes after everything with an edge into it. Load, Check and Fix go round in a loop through the retry edge, so they - and everything after them - cannot be ordered; click the retry edge and press Delete and the whole graph gets an order.
- Cycles says whether there is a loop and marks each one, its edges included; with retry deleted, drag from Audit's handle back to Load to make a bigger one. Strongly connected groups the nodes that can all reach one another; Connected pieces colours the separate parts the graph falls into.
- Upstream and downstream: click a node to see everything it depends on and everything that depends on it, and whether it is on a cycle. Neighbourhood walks out from the selected node, numbering each node by how many edges away it is; pick the Direction and the Depth.
- Shortest path marks the route with the fewest edges between From and To. Tick Weigh edges by length to find the shortest route as drawn instead, then drag Check or Fix far away and watch the route switch sides.
- Roots, leaves and loose ends marks where flows start and end, the node with no edges, and the steps no input reaches. Statistics lists the counts.
- Validation checks the graph against rules: Audit's dead end is an error, the loop, the note and Manual entry are warnings, and the list adds an issue for information only. Drag from Audit's handle to Save to clear the error. Set Max issues to 3 and the report stops after the loop's three warnings, before the rule that finds the error has run.
- Search: type rows, cache or retry. Matching nodes and edges are marked and listed best first; Select all matches selects them.
- In every analysis, press an entry in the list to have the view glide to that node or edge, select it and give it keyboard focus.
How it works
- Each run builds one
BlowGraphIndex(nodes, edges)- the lookups by id and the incoming and outgoing edges - and asks it every question of that analysis. The helpers have no UI, never recurse, and run in time linear in the size of the graph. TopologicalSort(graph)returns theOrderand theUnorderednodes a cycle blocks, andIsAcyclic.HasCycle(graph)answers yes or no;FindCycles(graph)returns each group of nodes on a cycle.StronglyConnectedComponents(graph)returns the groups of mutually reachable nodes, in reverse topological order;ConnectedComponents(graph)the pieces the graph falls into when direction is ignored.GetAncestors(graph, id)andGetDescendants(graph, id)list what is upstream and downstream, nearest first.IsReachable(graph, from, to)says whether one node leads to another; a node reaches itself only through a cycle.Traverse(graph, id, direction, maxDepth)is the general walk behind them; the page calls it with growing depths to number each node by its distance.ShortestPath(graph, from, to)finds the fewest-edges route, or null when there is none. Given a weight function - here the distance between the two nodes' centres - it finds the cheapest one instead (Dijkstra).GetRoots,GetLeavesandGetIsolatedNodesfind where flows start and end and what is disconnected;GetUnreachable(graph, startIds), started from theinputnodes, finds what can never run.GetStatistics(graph)counts nodes, edges, roots, leaves, components, self-loops, degrees, dangling edges and whether the graph is acyclic.BlowGraphValidator.CreateDefault()holds theStructureandPortsrules; the page addsNoCycles(BlowValidationSeverity.Warning),NoIsolatedNodes()andAllReachableFrom(n => n.Type == "input")(warnings by default), a rule of its own implementingIBlowValidationRule- a step that ends the flow must be an output, an error - and an information-only issue added as a function.MaxIssuesbounds the report and setsIsTruncated.- The
BlowValidationResultgoes to the canvas'sValidationparameter, which marks errors and warnings by shape as well as colour;Infoissues are not marked. EachBlowValidationIssuecarries aCode, aSeverity, aMessageand theNodeIdorEdgeIdit concerns, which is how the list takes you there. FindNodes(query, text)andFindEdges(query)search what is shown - labels, ids, types, the names of an edge's two nodes, plus the description in each node'sDatathrough thetextfunction - ignoring case and accents, best matches first.SelectAsync(nodes, edges)selects them;FocusNodeAsyncandFocusEdgeAsyncwithselect: truetake you to one.- The marks are the nodes' own
ClassandStyle, the edges'Class, and a badge drawn by theNodeTemplatebeside the built-inBlowDefaultNode; each run clears the last one's first.