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 static FilteredVertexAndEdgeListGraph FilteredFsm() { AdjacencyGraph g = Fsm(); // 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 g.Vertices) { if (pred.Test(v)) vertexColors[v]=GraphColor.Black; else vertexColors[v]=GraphColor.White; } IVertexPredicate vp = new NoBlackVertexPredicate(vertexColors); IEdgePredicate ep = new EdgePredicate( new KeepAllEdgesPredicate(), vp ); return new FilteredVertexAndEdgeListGraph(g, ep, vp ); }