// get descendants that have this relation private void DescendantsWithReln(SemanticGraph g, IndexedWord w, string relation, IList <IndexedWord> seenNodes, IList <IndexedWord> descendantSet) { if (seenNodes.Contains(w)) { return; } seenNodes.Add(w); if (descendantSet.Contains(w)) { return; } if (ignoreCommonTags && ignoreTags.Contains(w.Tag().Trim())) { return; } foreach (IndexedWord child in g.GetChildren(w)) { foreach (SemanticGraphEdge edge in g.GetAllEdges(w, child)) { if (edge.GetRelation().ToString().Equals(relation)) { descendantSet.Add(child); } } DescendantsWithReln(g, child, relation, seenNodes, descendantSet); } }