private static void RecursiveDescribeInternal(string subject, BaseGraph graph, HashSet <Triple> triples) { bool needsRecurse = false; var children = graph.SelectSubject(subject); foreach (var triple in children) { if (triples.Add(triple)) { needsRecurse = true; } } if (needsRecurse) { foreach (var triple in children) { RecursiveDescribeInternal(triple.Object.GetValue(), graph, triples); } } }