Beispiel #1
0
            "match (n:Envio) where n.mes= {a} "
            "return avg(n.peso) as mediaPeso, avg(n.volumen) as mediaVolumen, count(n) as cuenta "
            , a = mes)
        return media

    @staticmethod
    def getResumenOcupacion(tipo):
        db_connection = DbConnection()
        media = db_connection.graph.cypher.execute(
            "match (n:Locomotora)-[r]-(e:Estacion) where n.tipo = {a} "
            "return count(r) as numero", a = tipo)
        return media

if __name__ == '__main__':
    DbConnection.deleteAllGraph()
    DbConnection.init()

    Estacion.crearEstaciones()
    Estacion.crearTramos()

    #Estacion.getVias("Madrid")
    madrid = Estacion.getEstacionFromNombre('Madrid')
    Locomotora.createLocomotoras()
    Locomotora.asociarLocomotoras(madrid)

    Envio.createEnvios()
    Envio.asociarEnvios()

    print "Camino economico Madrid - LaMancha:"
    print Estacion.getRutaOptima('Madrid', 'LaMancha', 'economico')