我有一棵树作为广度优先搜索的输入,我想知道算法在哪个级别进展?
# Breadth First Search Implementation
graph = {
'A':['B','C','D'],
'B':['A'],
'C':['A','E','F'],
'D':['A','G','H'],
'E':['C'],
'F':['C'],
'G':['D'],
'H':['D']
}
def breadth_first_search(graph,source):
"""
This function is the Implementation of the breadth_first_search program
"""
# Mark each node as not visited
mark = {}
for item in graph.keys():
mark[item] = 0
queue, output = [],[]
# Initialize an empty queue with the source node and mark it as explored
queue.append(source)
mark[source] = 1
output.append(source)
# while queue is not empty
while queue:
# …Run Code Online (Sandbox Code Playgroud) Dash 中 (空格)的 HTML 等价物是什么?
html.Div(
[
dcc.Input(),
<add horizontal space here>
dcc.Input()
]
)
Run Code Online (Sandbox Code Playgroud)