Nx Converter

Convert an arbitrary NetworkX graph object to a SeQUeNCe topology using QuantumRouters in MIM configuration.

sequence.utils.nx_converter.bsm_name_func(i, j) str

Return the name of the BSM :param i: Initiator node :param j: Responder node

Returns: BSM name

sequence.utils.nx_converter.generate_classical(router_names: list, cc_delay: float) list

Creates all-to-all links between routers in the topology. :param router_names: List of routers :param cc_delay: Delay between the routers (ms)

Returns: A list of the classical connections

sequence.utils.nx_converter.generate_config(g: Graph, cc_delay: float, memory_size: int = 5, output_file: str = 'output.json', output_directory: str = 'tmp', stop_time: float | None = None, formalism: str | None = None, node_template: dict | None = None, meas_fid: float = 1, gate_fid: float = 1) tuple[dict, dict]

Create a sequence config file from an arbitrary graph assuming meet-in-the-middle (MIM) entanglement generation

Parameters:
  • g – NetworkX graph object representing the network topology. Edges can have ‘length’ and ‘attenuation’ attributes for quantum channels.

  • cc_delay – Classical communication delay in milliseconds for all classical links

  • memory_size – Number of memories per QuantumRouter (default: 5)

  • output_file – Name of the output JSON file (default: ‘output.json’)

  • output_directory – Directory to save the output file (default: ‘tmp’)

  • stop_time – Optional stop time for the simulation in seconds (default: None)

  • formalism – Optional formalism for the simulation (default: None)

  • node_template – Optional template for nodes (default: None)

  • meas_fid – Measurement fidelity (default: 1)

  • gate_fid – Gate fidelity (default: 1)

Returns:

the first dictionary is the output configuration,

the second dictionary is the mapping from graph nodes to names.

Return type:

A tuple containing two dictionaries

sequence.utils.nx_converter.generate_nodes(router_names: list, memo_size: int, template: str = '', gate_fidelity: float = 1, measurement_fidelity: float = 1) list

Generate a list of QuantumRouter Configs :param router_names: Names of the QuantumRouters :param memo_size: Number of memories per QuantumRouter :param template: Name of the template to apply :param gate_fidelity: CNOT gate fidelity, default is 1 :param measurement_fidelity: Measurement fidelity, default is 1

Returns: List of QuantumRouter configurations

sequence.utils.nx_converter.router_name_func(i) str

Gets the name of a QuantumRouter given its vertex index. :param i: Graph vertex index

Returns: Name of the router