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 FilteredImplicitVertexSet(
     TGraph baseGraph,
     VertexPredicate<TVertex> vertexPredicate,
     EdgePredicate<TVertex, TEdge> edgePredicate
     )
     :base(baseGraph,vertexPredicate,edgePredicate)
 { }
Esempio n. 3
0
 public FilteredVertexAndEdgeListGraph(
     TGraph baseGraph,
     VertexPredicate <TVertex> vertexPredicate,
     EdgePredicate <TVertex, TEdge> edgePredicate
     )
     : base(baseGraph, vertexPredicate, edgePredicate)
 {
 }
Esempio n. 4
0
 public FilteredBidirectionalGraph(
     TGraph baseGraph,
     VertexPredicate <TVertex> vertexPredicate,
     EdgePredicate <TVertex, TEdge> edgePredicate
     )
     : base(baseGraph, vertexPredicate, edgePredicate)
 {
 }
 public FilteredIncidenceGraph(
     TGraph baseGraph,
     VertexPredicate <TVertex> vertexPredicate,
     EdgePredicate <TVertex, TEdge> edgePredicate
     )
     : base(baseGraph, vertexPredicate, edgePredicate)
 {
 }
Esempio n. 6
0
        public FilteredGraph(
            TGraph baseGraph,
            VertexPredicate <TVertex> vertexPredicate,
            EdgePredicate <TVertex, TEdge> edgePredicate
            )
        {
            Contract.Requires(baseGraph != null);
            Contract.Requires(vertexPredicate != null);
            Contract.Requires(edgePredicate != null);

            this.baseGraph       = baseGraph;
            this.vertexPredicate = vertexPredicate;
            this.edgePredicate   = edgePredicate;
        }
Esempio n. 7
0
 public FilteredGraph(
     TGraph baseGraph,
     VertexPredicate <TVertex> vertexPredicate,
     EdgePredicate <TVertex, TEdge> edgePredicate
     )
 {
     if (baseGraph == null)
     {
         throw new ArgumentNullException("baseGraph");
     }
     if (vertexPredicate == null)
     {
         throw new ArgumentNullException("vertexPredicate");
     }
     if (edgePredicate == null)
     {
         throw new ArgumentNullException("edgePredicate");
     }
     this.baseGraph       = baseGraph;
     this.vertexPredicate = vertexPredicate;
     this.edgePredicate   = edgePredicate;
 }
        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
                );
        }