public override void RunAlgorithm(IGraph graph) { ResetGraph(graph); if (graph.Nodes.Any()) { if (markedSource == null || !graph.Contains(markedSource)) { markedSource = graph.Nodes.First(); } } var result = new Reachability { Directed = Directed, StartNodes = { Item = markedSource } }.Run(graph); foreach (var node in result.ReachableNodes) { node.Tag = new Tag { CurrentColor = Colors.Blue, IsSource = node == markedSource }; } foreach (var edge in graph.Edges) { if (result.IsReachable(edge.GetSourceNode()) && result.IsReachable(edge.GetTargetNode())) { edge.Tag = new Tag { CurrentColor = Colors.Blue, Directed = Directed }; } } }