GraphView.TranslateMatchClauseVisitor.OptimizeTail C# (CSharp) Method

OptimizeTail() private method

Marks the node table alias, if it has no outgoing edges in the graph pattern and its node properties are never referenced or projected in the query. Such node table aliases will not appear in the FROM clause in the translated query, but only be materialized in adjacency lists, i.e., table-valued functions.
private OptimizeTail ( GraphView.WSelectQueryBlock query, MatchGraph graph ) : void
query GraphView.WSelectQueryBlock
graph MatchGraph
return void
        private void OptimizeTail(WSelectQueryBlock query, MatchGraph graph)
        {
            var visitor = new CheckTableReferenceVisitor();
            foreach (var connectedSubGraph in graph.ConnectedSubGraphs)
            {
                var toRemove = connectedSubGraph.Nodes.Where(
                    node => node.Value.Neighbors.Count == 0 &&
                            !visitor.Invoke(query, node.Key, _context, _graphMetaData.ColumnsOfNodeTables)
                    )
                    .ToArray();
                foreach (var item in toRemove)
                {
                    connectedSubGraph.IsTailNode[item.Value] = true;
                }
            }
        }