/// <summary> /// Creates a TriarcReconstruction. /// </summary> /// <param name="triarcGraph">triarcGraph containing only boundary that is the same as last state from sequence.</param> /// <param name="sequenceOfStatesLeadingToResult">Solution of finding triarc.</param> public TriarcReconstruction(ReconstructionGraph triarcGraph, List <long> sequenceOfStatesLeadingToResult, string path = "") { this.path = path; triarc = triarcGraph; triarc.Faces = new List <List <int> >(); maxNumberOfVertices = int.MaxValue; this.SequenceOfStatesLeadingToResult = sequenceOfStatesLeadingToResult; }
public static bool IsGraph3Connected(ReconstructionGraph G) { for (int i = G.NumberOfVerticesInOuterBoundary; i < G.CountOfVertices; i++) { for (int j = G.NumberOfVerticesInOuterBoundary; j < G.CountOfVertices; j++) { if (i < j) { if (!Search(G, i, j)) { return(false); } } } } return(true); }
private static bool Search(ReconstructionGraph G, int i, int j) { var visited = new List <VertexStack>(); var queue = new Queue <VertexStack>(); queue.Enqueue(G.vertices.First(x => x.ID == 0)); while (queue.Count > 0) { var v = queue.Dequeue(); visited.Add(v); var unvisitedNeighbours = v.ABC.Where(x => !visited.Contains(x) && x.ID != i && x.ID != j && !queue.Contains(x) && x.ID != -1); foreach (var item in unvisitedNeighbours) { queue.Enqueue(item); } } return(visited.Count == G.CountOfVertices - 2); }