/// <summary> /// Finds the faces of the specified graph. /// </summary> /// <typeparam name="TVertex">The type of the vertices.</typeparam> /// <param name="graph">The graph whose faces to find.</param> /// <param name="boundingCycles">Output parameter for the collection of faces, each /// represented by a bounding cycle oriented counterclockwise.</param> /// <returns><see langword="true"/> if the search was successful (or equivalently, the /// graph is plane). <see langword="false"/> if the search failed (or equivalently, the /// graph is not plane).</returns> public bool TryFindFaces <TVertex>(IReadOnlyUndirectedGraph <TVertex> graph, out IEnumerable <IEnumerable <TVertex> > boundingCycles) where TVertex : IEquatable <TVertex>, IComparable <TVertex>, IVertexInPlane { if (graph is null) { throw new ArgumentNullException(nameof(graph)); } if (!graph.IsPlane()) { boundingCycles = null; return(false); } boundingCycles = SearchForFaces(graph, Orientation.Counterclockwise); return(true); }