Sub Adjacency Graph

Topics: algorithm, graph
Apr 29, 2009 at 12:38 PM
Hi Guys,

How are you?
I've a question:

I want to obtain a sub adjacency graph thats meets certain criteria.

Here's an example:

            AdjacencyGraph<int, Edge<int>> g = new AdjacencyGraph<int,Edge<int>>();

            var H = from F in g.Edges
                    where F.Source > 25 && F.Target > 25
                    select F;

            AdjacencyGraph<int, Edge<int>> J = new AdjacencyGraph<int, Edge<int>>();

According to you Is there a more elegant version?

Thanks for your attention!!

Apr 29, 2009 at 4:38 PM
Yes, use the QuickGraph.Filtered.*** datastructures. There must be a FitleredVertexAndEdgeListGraph<TVertex, TEdge> class that lets you filter according vertices and edges.
Apr 29, 2009 at 6:33 PM
Can you write me an example? Do it only if you can!

Apr 29, 2009 at 7:11 PM
Edited Apr 29, 2009 at 7:16 PM
Why I can Filter only by Vertex and not also by EdgeList? Is there an error?



            AdjacencyGraph<int, Edge<int>> g = new AdjacencyGraph<int, Edge<int>>();
            VertexPredicate<int> VP = new VertexPredicate<int>(GreaterThan);
            EdgePredicate<int, Edge<int>> EP = new EdgePredicate<int, Edge<int>>(GreaterThan);
            FilteredVertexAndEdgeListGraph<int, Edge<int>, AdjacencyGraph<int, Edge<int>>> N = new FilteredVertexAndEdgeListGraph<int, Edge<int>, AdjacencyGraph<int, Edge<int>>>(g, VP, EP);
        public bool GreaterThan(int Args)
            //return Args > 25;
            return true;
        public bool GreaterThan(Edge<int> Args)
            return Args.Source >20;
Apr 30, 2009 at 4:21 AM
I don't understand your question: you can provide a filter for the vertices and the edges.