mqt.problemsolver.qubo_tools.pathfinder.graph¶
Provides a simple implementation for graphs to be used with qubo_tools.
Module Contents¶
- Edge¶
- class Graph(n_vertices: int, edges: list[Edge])[source]¶
Represents a graph to be used with qubo_tools.
- property non_edges: list[tuple[int, int]]¶
A list of all pairs (i, j) that are not edges in the graph.
- static read(file: TextIOWrapper) Graph[source]¶
Reads a graph from a file.
- Parameters:
file (TextIOWrapper) – The file to read the graph from.
- Returns:
The graph read from the file.
- Return type:
- store(file: TextIOWrapper) None[source]¶
Stores the graph in a file.
- Parameters:
file (TextIOWrapper) – The file to store the graph in.
- static from_adjacency_matrix(adjacency_matrix: numpy.typing.NDArray[int_ | numpy.float64] | list[list[int]] | list[list[float]]) Graph[source]¶
Creates a graph from an adjacency matrix.
- serialize() str[source]¶
Serializes the graph into a string.
- Returns:
The serialized graph as a string.
- Return type: