Esempio n. 1
0
  /**
   * Find the genus of a DefaultGraph.
   *
   * @param graph Graph to find the genus for.
   * @return The graph genus.
   */
  public int findGenus(DefaultGraph graph) {
    if (graph.isCompleteGraph() && graph.getNumberOfVertices() >= 3) {
      int tmp = (graph.getNumberOfVertices() - 3) * (graph.getNumberOfVertices() - 4);
      return (tmp + 11) / 12;
    }

    return findGenus(graph, findFaces(graph));
  }
Esempio n. 2
0
 /**
  * Find the genus of a DefaultGraph.
  *
  * @param graph Graph to find the genus for.
  * @param faces Maximum number of faces.
  * @return The graph genus.
  */
 public int findGenus(DefaultGraph graph, int faces) {
   return 1 - (graph.getNumberOfVertices() + faces - graph.getNumberOfEdges() / 2) / 2;
 }