Module: lopaths.graph#

Module implementing objects representing graphs and different algorithms to find shortest and potential alternative paths.

Data:

CPU_COUNT

Number of CPU cores to be used at most.

Classes:

FastGraph(flexibleGraph)

FlexibleGraph(edges, edgeData, vertices, ...)

Graph with a flexible structure that supports efficient addition and removal of vertices and edges.

FlowPointGraph(flexibleGraph, lengthLabel[, ...])

CPU_COUNT = 8#

Number of CPU cores to be used at most. Defaults to the number of installed cores.

class FastGraph(flexibleGraph)[source]#

Bases: vemomoto_core.tools.saveobject.SeparatelySaveable

Methods:

add_edge(fromIndex, toIndex, edgeData)

add_edge_attributes(names, dtypes[, fillVal])

add_vertex(vertexData)

add_vertex_attributes(names, dtypes[, fillVal])

make_edges_contiguous()

remove_edge(fromIndex, toIndex)

remove_vertex(vertexIndex)

add_edge(fromIndex, toIndex, edgeData)[source]#
add_edge_attributes(names, dtypes, fillVal=None)[source]#
add_vertex(vertexData)[source]#
add_vertex_attributes(names, dtypes, fillVal=None)[source]#
make_edges_contiguous()[source]#
remove_edge(fromIndex, toIndex)[source]#
remove_vertex(vertexIndex)[source]#
class FlexibleGraph(edges, edgeData, vertices, vertexData, replacementMode='overwrite', lengthLabel=None, significanceLabel=None, defaultVertexData=None, defaultEdgeData=None, **printerArgs)[source]#

Bases: vemomoto_core.tools.hrprint.HierarchichalPrinter

Graph with a flexible structure that supports efficient addition and removal of vertices and edges.

Methods:

add_edge(fromID, toID[, edgeData])

add_edge_attributes(names, dtypes[, fillVal])

add_vertex(vertexID[, vertexData])

add_vertex_attributes(names, dtypes[, fillVal])

get_edge_count()

get_edge_data(fromID, toID[, copy])

get_neighbor_edges(vertexID[, ...])

get_predecessors(vertexID)

get_successors(vertexID)

get_vertex_count()

get_vertex_data(vertexID[, copy])

remove_edge(fromID, toID)

remove_insignificant_dead_ends([...])

remove_vertex(vertexID[, counter])

set_default_edge_data([data])

set_default_vertex_data([data])

set_edge_data(fromID, toID, data)

set_vertex_data(vertexID, data)

add_edge(fromID, toID, edgeData=None)[source]#
add_edge_attributes(names, dtypes, fillVal=None)[source]#
add_vertex(vertexID, vertexData=None)[source]#
add_vertex_attributes(names, dtypes, fillVal=None)[source]#
get_edge_count()[source]#
get_edge_data(fromID, toID, copy=True)[source]#
get_neighbor_edges(vertexID, getSuccessors=True, copy=True)[source]#
get_predecessors(vertexID)[source]#
get_successors(vertexID)[source]#
get_vertex_count()[source]#
get_vertex_data(vertexID, copy=True)[source]#
remove_edge(fromID, toID)[source]#
remove_insignificant_dead_ends(significanceLabel=None, standardSignificant=False)[source]#
remove_vertex(vertexID, counter=None)[source]#
set_default_edge_data(data=None)[source]#
set_default_vertex_data(data=None)[source]#
set_edge_data(fromID, toID, data)[source]#
set_vertex_data(vertexID, data)[source]#
class FlowPointGraph(flexibleGraph, lengthLabel, significanceLabel=None, **printerArgs)[source]#

Bases: lopaths.graph.FastGraph, vemomoto_core.tools.hrprint.HierarchichalPrinter, vemomoto_core.concurrent.nicepar.Lockable

Methods:

find_alternative_paths(*args, **kwargs)

find_locally_optimal_paths(fromIndices, ...)

find_shortest_distance_array(fromIndices, ...)

find_shortest_path(fromIndex, toIndex[, ...])

preprocessing(initialBound[, boundFactor, ...])

find_alternative_paths(*args, **kwargs)[source]#
find_locally_optimal_paths(fromIndices, toIndices, shortestDistances=None, stretchConstant=1.5, localOptimalityConstant=0.2, acceptionFactor=0.9, rejectionFactor=1.1, testing=False)[source]#
find_shortest_distance_array(fromIndices, toIndices)[source]#
find_shortest_path(fromIndex, toIndex, getPath=False, initSize=2000)[source]#
preprocessing(initialBound, boundFactor=3, pruneFactor=4, additionalBoundFactor=1.1, expansionBounds=None, degreeBound=5, maxEdgeLength=None)[source]#