Jump to content


Photo

[2.3.5] Graph data filtering features

graphx graph data filter C# visualization

  • Please log in to reply
No replies to this topic

#1 Alexander Smirnov

Alexander Smirnov

    Staff Member

  • Administrators
  • 542 posts

Posted 22 June 2016 - 11:42 PM

There has been some new data filtering features introduced In GraphX version 2.3.5. Let's see the quick review.

 

  In order to provide more flexible data filtering for GraphX the LogicCore::Filters property has been introduced representing the Queue<IGraphFilter<TVertex, TEdge, TGraph>> of custom filters. The queue means that the filters that are added into it are processed in a FIFO (First In First Out) order consequently modifying the graph. Filters are automaticaly applied on GraphArea::GenerateGraph() and GraphArea::RelayoutGraph() method calls before any visuals are calculated and ensures that all calculations will be done on filtered graph. In case of relayout, each relayout method call will initiate filtering process starting from "original graph". Original graph is the copy of the LogicCore::Graph property that is saved before first filter is applied on an unfiltered graph to have an untouched graph copy.

  Also we'd implemented dynamic visuals add/remove routine specially for the filters in the relayout process so during the each relayout method call GraphX will now check if there are vertices or edges that needs VertexControl/EdgeControl objects to be created/removed to reflect changes made by filters. This behavior can be turned off by setting GraphArea::EnableVisualsRenewOnFiltering property to False.

 

You can check if graph is currently filtered by checking the LogicCore::IsFiltered property.

 

Furthermore you have several methods to work with data filtering:

  • LogicCore::PushFilters() - this method is called automaticaly as described above and applies LogicCore::Filters to LogicCore::Graph. You can also call it manually to push the filtering for your custom purpose.
  • LogicCore::ApplyFilters() - this method will remove graph filtering, clear all filters, clear original graph and save filtered graph as unfiltered making the changes permanent. You want to make changes from filtering permanent? That is the method!
  • LogicCore::PopFIlters() - this method will remove graph filtering, clear all filters, clear original graph and revert LogicCore::Graph property to original graph saved earlier. Want to revert all the filtering changes and restore the graph? You can do it!

PS: Remember that while you operate with filtered graph you hold the original graph copy in the memory which can cause performance issues depending on the graph size.

 

The graph data filter itself is very simple:

    public class BlueVertexFilter: IGraphFilter<DataVertex, DataEdge, BidirectionalGraph<DataVertex, DataEdge>>
    {
        public BidirectionalGraph<DataVertex, DataEdge> ProcessFilter(BidirectionalGraph<DataVertex, DataEdge> inputGraph)
        {
            inputGraph.RemoveVertexIf(a => !a.IsBlue);
            return inputGraph;
        }
    }

It has only one method named ProcessFilter() that do all the stuff. This method receive some graph as the input parameter and shoud return the graph when it is done with the filtering.

 

So, basically you will want to do the following:

  1. Create custom filters derived from IGraphFilter interface
  2. Add them to LogicCore::FIlters in desired order
  3. Run GraphArea::GenerateGraph() or GraphArea::RelayoutGraph() methods

That's it! If you need this feature functionality expanded please let me know, thanks!


If you have any questions about software feel free to use the forums or e-mail to support@panthernet.org

For all questions related to sales please mail to sales@panthernet.org






Also tagged with one or more of these keywords: graphx, graph, data, filter, C#, visualization

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users