/// <summary> /// Graph どうしが等しいかどうかを判定します。 /// </summary> /// <param name="graph">比較する Graph</param> public bool Equal(GraphView graph) { for (int i = 0; i < vertexNum; i++) if (this.vertex[i].GetId() != graph.vertex[i].GetId()) return false; return true; }
/// <summary> /// Graph オブジェクトを複製します。 /// </summary> public GraphView Clone() { GraphView temp = new GraphView(); foreach (VertexView item in vertex) temp.AddVertex((VertexView)item.Clone()); foreach (EdgeView item in edge) temp.AddEdge((VertexView)temp.GetVertexIndexOf(vertex.IndexOf(item.GetEdgeVertex(Edge.VERTEX_FIRST))), (VertexView)temp.GetVertexIndexOf(vertex.IndexOf(item.GetEdgeVertex(Edge.VERTEX_SECOND)))); return temp; }
/// <summary> /// Graph どうしが自己同型であるかを判定します。 /// </summary> /// <param name="graph">比較する Graph</param> /// <returns></returns> public bool CheckIsomorphic(GraphView graph) { if (this.GetAdjacencyMatrix().Equal(graph.GetAdjacencyMatrix())) return true; return false; }