qns.network.graphalg package

Submodules

qns.network.graphalg.alg module

qns.network.graphalg.alg.create_neighbors_tables(nl: List[QNode], ll)[source]

This is the algorithm create the neighbor nodes of the network. :param nl: list of Qnode. :param ll: list of QuantumChannel.

Returns:

a dict of neighbors node for Qnode in nl.

Return type:

neighbors_table

qns.network.graphalg.alg.dijkstra(src: ~qns.entity.node.node.QNode, dest: ~qns.entity.node.node.QNode, nl: ~typing.List[~qns.entity.node.node.QNode], ll: ~typing.List[~qns.entity.qchannel.qchannel.QuantumChannel], metric_function: ~typing.Callable = <function min_hop_metric_funcation>)[source]

dijkstra algorithm. :param src: source Qnode. :param dest: destination Qnode. :param nl: list of Qnodes. :param ll: list of QuantumChannel. :param metric_function: function to calculate the weight of each channel.

Returns:

shortest path set and cost on path.

Return type:

pathset

qns.network.graphalg.alg.is_connected(nl, ll)[source]

This is the algorithm check whether the network is connected(BFS). :param nl: list of Qnode. :param ll: list of QuantumChannel.

Returns:

whether the network is connected.

qns.network.graphalg.alg.min_hop_metric_funcation(channel: QuantumChannel)[source]
qns.network.graphalg.alg.networkdraw(nl, ll, filename)[source]

Network visualization Algorithm. :param nl: list of Qnodes. :param ll: list of QuantumChannel. :param filename: path of the output file

Returns:

Interactive HTML file

qns.network.graphalg.draw module

qns.network.graphalg.draw.draw(nl, ll, filename)[source]

draw network topology based on provided Node list and Link list :param nl: list of Qnodes :param ll: list of QuantumChannel :param filename: path of the output file

Returns:

HTML file generated and opened

Module contents

qns.network.graphalg.create_neighbors_tables(nl: List[QNode], ll)[source]

This is the algorithm create the neighbor nodes of the network. :param nl: list of Qnode. :param ll: list of QuantumChannel.

Returns:

a dict of neighbors node for Qnode in nl.

Return type:

neighbors_table

qns.network.graphalg.dijkstra(src: ~qns.entity.node.node.QNode, dest: ~qns.entity.node.node.QNode, nl: ~typing.List[~qns.entity.node.node.QNode], ll: ~typing.List[~qns.entity.qchannel.qchannel.QuantumChannel], metric_function: ~typing.Callable = <function min_hop_metric_funcation>)[source]

dijkstra algorithm. :param src: source Qnode. :param dest: destination Qnode. :param nl: list of Qnodes. :param ll: list of QuantumChannel. :param metric_function: function to calculate the weight of each channel.

Returns:

shortest path set and cost on path.

Return type:

pathset

qns.network.graphalg.is_connected(nl, ll)[source]

This is the algorithm check whether the network is connected(BFS). :param nl: list of Qnode. :param ll: list of QuantumChannel.

Returns:

whether the network is connected.

qns.network.graphalg.networkdraw(nl, ll, filename)[source]

Network visualization Algorithm. :param nl: list of Qnodes. :param ll: list of QuantumChannel. :param filename: path of the output file

Returns:

Interactive HTML file