Пример #1
0
 /// <summary>
 /// Creates a parallel matchers.
 /// Inits arrays of threads and matchers based on thread count.
 /// </summary>
 /// <param name="pattern"> Pattern to match. </param>
 /// <param name="graph"> Graph to search on.</param>
 /// <param name="executionHelper"> Query execution helper. </param>
 public DFSParallelPatternMatcherStreamed(DFSPattern pattern, Graph graph, IMatchExecutionHelper executionHelper) : base(graph, executionHelper)
 {
     this.matchers = new ISingleThreadPatternMatcherStreamed[this.helper.ThreadCount];
     for (int i = 0; i < this.helper.ThreadCount; i++)
     {
         this.matchers[i] = (ISingleThreadPatternMatcherStreamed)MatchFactory
                            .CreateMatcher(this.helper.SingleThreadPatternMatcherName, // Type of Matcher
                                           i == 0 ? pattern : pattern.Clone(),         // Cloning of pattern (one was already created)
                                           graph,
                                           i);                                         // Matcher ID
     }
 }
        /// <summary>
        /// Starting vertices are implicitly set to entire graph.
        /// </summary>
        /// <param name="pat"> A pattern to find.</param>
        /// <param name="gr"> A graph to search. </param>
        protected DFSPatternMatcherBase(IDFSPattern pat, Graph gr)
        {
            if (gr == null || pat == null)
            {
                throw new ArgumentException($"{this.GetType()}, passed null to a constructor.");
            }

            this.graph           = gr;
            this.matchedElements = new Element[pat.AllNodeCount];
            this.pattern         = (DFSPattern)pat;

            // Implicit range of vertices to iterate over the entire graph.
            this.startVerticesIndex    = 0;
            this.startVerticesEndIndex = gr.vertices.Count;
        }
Пример #3
0
        /// <summary>
        /// Creates a parallel matchers.
        /// Inits arrays of threads and matchers based on thread count.
        /// </summary>
        /// <param name="pattern"> A pattern to match. </param>
        /// <param name="graph"> A graph to search on.</param>
        /// <param name="results"> Where to store results. </param>
        /// <param name="executionHelper"> A query execution helper. </param>
        public DFSParallelPatternMatcher(DFSPattern pattern, Graph graph, MatchFixedResults results, IMatchExecutionHelper executionHelper) : base(graph, executionHelper)
        {
            if (pattern == null || results == null)
            {
                throw new ArgumentNullException($"{this.GetType()}, passed a null to a construtor.");
            }

            this.matchers = new ISingleThreadPatternMatcher[this.helper.ThreadCount];
            this.results  = results;
            for (int i = 0; i < this.helper.ThreadCount; i++)
            {
                this.matchers[i] = (ISingleThreadPatternMatcher)MatchFactory
                                   .CreateMatcher(this.helper.SingleThreadPatternMatcherName, // Type of Matcher
                                                  i == 0 ? pattern : pattern.Clone(),         // Cloning of pattern (one was already created)
                                                  graph,
                                                  results.GetMatcherResultsStorage(i));       // Result storage
            }
        }