public static function factoryCycleFromVertices($vertices, $by = null, $desc = false)
    {
        $cycle = self::factoryFromVertices($vertices, $by, $desc);

        if ($cycle->getEdges()->isEmpty()) {
            throw new InvalidArgumentException('Cycle with no edges can not exist');
        }

        if ($cycle->getVertices()->getVertexFirst() !== $cycle->getVertices()->getVertexLast()) {
            throw new InvalidArgumentException('Cycle has to start and end at the same vertex');
        }

        return $cycle;
    }
public static function factoryCycleFromVertices($vertices, $by = null, $desc = false)
    {
        $cycle = self::factoryFromVertices($vertices, $by, $desc);

        if ($cycle->getEdges()->isEmpty()) {
            throw new InvalidArgumentException('Cycle with no edges can not exist');
        }

        if ($cycle->getVertices()->getVertexFirst() !== $cycle->getVertices()->getVertexLast()) {
            throw new InvalidArgumentException('Cycle has to start and end at the same vertex');
        }

        return $cycle;
    }
public static function factoryCycleFromVertices ( $ vertices , $ by = null , $ desc = false ) { $ cycle = self :: factoryFromVertices ( $ vertices , $ by , $ desc ) ; if ( $ cycle -> getEdges ( ) -> isEmpty ( ) ) { throw new InvalidArgumentException ( 'Cycle with no edges can not exist' ) ; } if ( $ cycle -> getVertices ( ) -> getVertexFirst ( ) !== $ cycle -> getVertices ( ) -> getVertexLast ( ) ) { throw new InvalidArgumentException ( 'Cycle has to start and end at the same vertex' ) ; } return $ cycle ; }
create new cycle instance with edges between given vertices

@param  Vertex[]|Vertices  $vertices
@param  int|null           $by
@param  boolean            $desc
@return Walk
@throws UnderflowException if no vertices were given
@see Edges::getEdgeOrder() for parameters $by and $desc
@uses self::factoryFromVertices()
create new cycle instance with edges between given vertices