public static Visibility ConnectGraphs(List <Visibility> visibilityGraphs, List <DSGeom.Line> lines) { if (visibilityGraphs == null) { throw new ArgumentNullException("visibilityGraphs"); } List <VisibilityGraph> visGraphs = visibilityGraphs.Select(vg => (VisibilityGraph)vg.graph).ToList(); VisibilityGraph mergedGraph = VisibilityGraph.Merge(visGraphs); var edges = lines.Select(l => l.ToEdge()).ToList(); return(new Visibility() { graph = VisibilityGraph.AddEdges(mergedGraph, edges) }); }