Пример #1
0
        private void FilterFsm()
        {
            AdjacencyGraph graph = GraphProvider.Fsm();
            // drawing the fsm
            DrawGraph(graph, "fsm");

            // filtering
            // putting all black besides S4
            // therefore all the edges touching s4 will be filtered out.
            VertexColorDictionary vertexColors = new VertexColorDictionary();
            IVertexPredicate pred = new NameEqualPredicate("S4");
            foreach (IVertex v in graph.Vertices)
            {
                if (pred.Test(v))
                    vertexColors[v] = GraphColor.Black;
                else
                    vertexColors[v] = GraphColor.White;
            }

            IVertexPredicate vp = new NoBlackVertexPredicate(vertexColors);
            IEdgePredicate ep = new EdgePredicate(
                Preds.KeepAllEdges(),
                vp
                );
            IVertexAndEdgeListGraph filteredGraph = new FilteredVertexAndEdgeListGraph(graph,
                ep,
                vp
                );

            DrawGraph(filteredGraph, "fsmfiltered");
        }
 public void Compute()
 {
     // filter nullabed edges out
     if (this.IgnoreAllowDBNull)
         topo = new SourceFirstTopologicalSortAlgorithm(this.VisitedGraph);
     else
     {
         FilteredVertexAndEdgeListGraph fgraph = new FilteredVertexAndEdgeListGraph(
             this.VisitedGraph,
             nonNullableRelationEdgePredicate,
             QuickGraph.Predicates.Preds.KeepAllVertices()
             );
         topo = new SourceFirstTopologicalSortAlgorithm(fgraph);
     }
     topo.Compute();
 }