Beispiel #1
0
def getSPBetweenVertices(net, pathName, sourceVertexId, destVertexId):

    sourceVertex = net.getVertex(sourceVertexId)
    destVertex = net.getVertex(destVertexId)
    ShortestPaths.initializeEdgeCostsWithFFTT(net)
    
    ShortestPaths.labelCorrecting(net, sourceVertex)
    path = ShortestPaths.getShortestPathAsListOfEdges(sourceVertex, destVertex)
    return Path(pathName, path)
Beispiel #2
0
def getSPBetweenEdges(net, pathName, listOfEdgeIds):
    """Return a path that goes through all the input edges"""

    assert len(listOfEdgeIds) >= 2

    edges = [net.getLink(edgeId) for edgeId in listOfEdgeIds]     
    ShortestPaths.initializeMovementCostsWithLengthInFeet(net)
    
    path = []
    i = 0
    for edge1, edge2 in pairwise(edges):
        ShortestPaths.labelCorrectingWithLabelsOnEdges(net, edge1)
        subPath = ShortestPaths.getShortestPathBetweenEdges(edge1, edge2)
        i += 1
        if i > 1:
            subPath.pop(0)
        path.extend(subPath) 
        
    return Path(pathName, path)