1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-29 15:42:04 +03:00

KCC: Add graph.dijkstra and setup_dijkstra() docstrings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall
2015-05-07 14:06:42 +12:00
committed by Andrew Bartlett
parent a0fea23811
commit 3069fba6e5

View File

@ -346,6 +346,13 @@ def setup_vertices(graph):
def dijkstra(graph, edge_type, include_black):
"""Perform Dijkstra's algorithm on an intersite graph.
:param graph: an IntersiteGraph object
:param edge_type: a transport type GUID
:param include_black: boolean, whether to include black vertices
:return: None
"""
queue = []
setup_dijkstra(graph, edge_type, include_black, queue)
while len(queue) > 0:
@ -358,6 +365,14 @@ def dijkstra(graph, edge_type, include_black):
def setup_dijkstra(graph, edge_type, include_black, queue):
"""Initialise a queue for Dijksta's algorithm.
:param graph: an IntersiteGraph object
:param edge_type: a transport type GUID
:param include_black: boolean, whether to include black vertices
:param queue: the empty queue to initialise.
:return: None
"""
setup_vertices(graph)
for vertex in graph.vertices:
if vertex.is_white():