check whether this graph has an eulerian cycle

@return boolean
@uses ConnectedComponents::isSingle()
@uses Degree::getDegreeVertex()
@todo isolated vertices should be ignored
@todo definition is only valid for undirected graphs
505632
public function hasCycle()
    {
        $components = new ConnectedComponents($this->graph);
        if ($components->isSingle()) {
            $alg = new Degree($this->graph);

            foreach ($this->graph->getVertices() as $vertex) {
                // uneven degree => fail
                if ($alg->getDegreeVertex($vertex) & 1) {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
138906
public function isBipartit()
    {
        // graph has to contain exactly 2 groups
        if ($this->getNumberOfGroups() !== 2) {
            return false;
        }

        // for each vertex
        foreach ($this->graph->getVertices() as $vertex) {
            // get current group
            $group = $vertex->getGroup();
            // for every neighbor vertex
            foreach ($vertex->getVerticesEdge() as $vertexNeighbor) {
                // vertex group must be other group
                if ($vertexNeighbor->getGroup() === $group) {
                    return false;
                }
            }
        }

        return true;
    }
317596
public function isConcrete()
    {
        if ($this->isQuad() && !$this->getGraph()->isConcrete()) {
            return false;
        }

        return $this->getSubject()->isConcrete()
               && $this->getPredicate()->isConcrete()
               && $this->getObject()->isConcrete();
    }
470076
public boolean isDisjunct() {

        for (int i = 0, n = this.intervals.size() - 1; i < n; i++) {
            ChronoInterval<T> current = this.intervals.get(i);
            ChronoInterval<T> next = this.intervals.get(i + 1);
            if (current.getEnd().isInfinite() || next.getStart().isInfinite()) {
                return false;
            } else if (current.getEnd().isOpen()) {
                if (this.isAfter(current.getEnd().getTemporal(), next.getStart().getTemporal())) {
                    return false;
                }
            } else if (!this.isBefore(current.getEnd().getTemporal(), next.getStart().getTemporal())) {
                return false;
            }
        }

        return true;

    }
1078915
public function isMultiValued() {
    if ($this->isMultiValued == null) {
      $maxMultiplicity = $this->getOtherMaxMultiplicity();
      $this->isMultiValued = ($maxMultiplicity > 1 || $maxMultiplicity == 'unbounded');
    }
    return $this->isMultiValued;
  }
188155
def is_cyclic(graph):
    
    path = set()

    def visit(vertex):
        path.add(vertex)
        for neighbour in graph.get(vertex, ()):
            if neighbour in path or visit(neighbour):
                return True
        path.remove(vertex)
        return False

    return any(visit(v) for v in graph)
246917
def find_cycle(graph):
    
    n = len(graph)
    prec = [None] * n  # ancestor marks for visited vertices
    for u in range(n):
        if prec[u] is None:  # unvisited vertex
            S = [u]  # start new DFS
            prec[u] = u  # mark root (not necessary for this algorithm)
            while S:
                u = S.pop()
                for v in graph[u]:  # for all neighbors
                    if v != prec[u]:  # except arcs to father in DFS tree
                        if prec[v] is not None:
                            cycle = [v, u]  # cycle found, (u,v) back edge
                            while u != prec[v] and u != prec[u]:  # directed
                                u = prec[u]  # climb up the tree
                                cycle.append(u)
                            return cycle
                        else:
                            prec[v] = u  # v is new vertex in tree
                            S.append(v)
    return None
140102
public function hasScalarKeys() {
    if ($this->key instanceof ScalarNode) {
      return $this->array instanceof ArrayLookupNode ? $this->array->hasScalarKeys() : TRUE;
    }
    else {
      return FALSE;
    }
  }
89809
private boolean isWellFormed()
    {
        for (int i = 0 ; i < maxHeight ; i++)
        {
            int c = 0;
            for (Node node = head ; node != null ; node = node.next(i))
            {
                if (node.prev(i) != null && node.prev(i).next(i) != node)
                    return false;
                if (node.next(i) != null && node.next(i).prev(i) != node)
                    return false;
                c += node.size[i];
                if (i + 1 < maxHeight && node.parent(i + 1).next(i + 1) == node.next(i))
                {
                    if (node.parent(i + 1).size[i + 1] != c)
                        return false;
                    c = 0;
                }
            }
            if (i == maxHeight - 1 && c != size + 1)
                return false;
        }
        return true;
    }
320745
public function isVariant(): bool
    {
        $isVariant = false;
        if (isset($this->oxarticles__oxparentid) && false !== $this->oxarticles__oxparentid) {
            $isVariant = (bool) $this->oxarticles__oxparentid->value;
        }

        return $isVariant;
    }
706062
public function hasLoop(): bool {
        $tortoise = $this->getHead();
        $hare = $this->getHead();

        while ($tortoise !== null && $hare->getNext() !== null) {
            $hare = $hare->getNext()->getNext();

            if (Comparator::equals($tortoise->getValue(), $hare->getValue())) {
                return true;
            }

            $tortoise = $tortoise->getNext();
        }
        return false;
    }
1033883
public static function cycle() {
		$values = func_get_args();
		$name = array_shift($values);

		if (!isset(self::$cycles[$name])) self::$cycles[$name] = -1;
		$index =& self::$cycles[$name];
		if (!isset($values[++$index])) $index = 0;
		return $values[ $index ];
	}
896912
function isNestedRingClosed(simplePolygon) {
  // check if first and last vertex are the same
  const p0 = simplePolygon[0];
  const p1 = simplePolygon[simplePolygon.length - 1];

  return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];
}
934795
public function isTree()
    {
        try {
            $root = $this->getVertexRoot();
        }
        catch (UnderflowException $e) {
            return false;
        }
        catch (UnexpectedValueException $e) {
            return false;
        }

        try {
            $num = count($this->getVerticesSubtree($root));
        }
        catch (UnexpectedValueException $e) {
            return false;
        }

        // check number of vertices reachable from root should match total number of vertices
        return ($num === count($this->graph->getVertices()));
    }
727966
public function isWood()
	{
		if( !$this->hasCycle() )
		{
			$nodes = $this->getNodes();
			foreach( $nodes as $targetSource )
				foreach( $nodes as $source )
					if( $source != $targetSource )
						if( $this->getEntranceGrade( $source, $targetSource ) > 1 )
							return false;
			return true;
		}
		else return false;
	}
923762
public boolean isInstanceDependencyChainAcyclic() {

		final AbstractJobVertex[] allVertices = this.getAllJobVertices();
		final Set<AbstractJobVertex> alreadyVisited = new HashSet<AbstractJobVertex>();

		for (AbstractJobVertex vertex : allVertices) {

			if (alreadyVisited.contains(vertex)) {
				continue;
			}

			AbstractJobVertex vertexToShareInstancesWith = vertex.getVertexToShareInstancesWith();
			if (vertexToShareInstancesWith != null) {

				final Set<AbstractJobVertex> cycleMap = new HashSet<AbstractJobVertex>();

				while (vertexToShareInstancesWith != null) {

					if (cycleMap.contains(vertexToShareInstancesWith)) {
						return false;
					} else {
						alreadyVisited.add(vertexToShareInstancesWith);
						cycleMap.add(vertexToShareInstancesWith);
						vertexToShareInstancesWith = vertexToShareInstancesWith.getVertexToShareInstancesWith();
					}
				}
			}
		}

		return true;
	}
521926
public boolean isConnectedInDirection(
      DiGraphNode<N, E> dNode1,
      Predicate<E> edgeMatcher,
      DiGraphNode<N, E>  dNode2) {
    // Verify the nodes.
    List<DiGraphEdge<N, E>> outEdges = dNode1.getOutEdges();
    int outEdgesLen = outEdges.size();
    List<DiGraphEdge<N, E>> inEdges = dNode2.getInEdges();
    int inEdgesLen = inEdges.size();
    // It is possible that there is a large assymmetry between the nodes, so pick the direction
    // to search based on the shorter list since the edge lists should be symmetric.
    if (outEdgesLen < inEdgesLen) {
      for (int i = 0; i < outEdgesLen; i++) {
        DiGraphEdge<N, E> outEdge = outEdges.get(i);
        if (outEdge.getDestination() == dNode2
            && edgeMatcher.apply(outEdge.getValue())) {
          return true;
        }
      }
    } else {
      for (int i = 0; i < inEdgesLen; i++) {
        DiGraphEdge<N, E> inEdge = inEdges.get(i);
        if (inEdge.getSource() == dNode1
            && edgeMatcher.apply(inEdge.getValue())) {
          return true;
        }
      }
    }

    return false;
  }