ml4co_kit.task.graph.base
Base Task Class for Graph Problems.
Functions
|
Classes
|
Base class for all undirected graph problems in the ML4CO kit. |
- class ml4co_kit.task.graph.base.GraphTaskBase(task_type: ~ml4co_kit.task.base.TASK_TYPE, minimize: bool, node_weighted: bool = False, edge_weighted: bool = False, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>)[source]
Bases:
TaskBaseBase class for all undirected graph problems in the ML4CO kit.
- from_adj_matrix(adj_matrix: ndarray, nodes_weight: ndarray | None = None, edges_weight: ndarray | None = None)[source]
Load graph data from an adjacency matrix.
- from_adj_matrix_weighted(adj_matrix_weighted: ndarray, nodes_weight: ndarray | None = None)[source]
Load graph data from an adjacency matrix.
- from_csr(xadj: ndarray, adjncy: ndarray, nodes_weight: ndarray | None = None, edges_weight: ndarray | None = None)[source]
Load graph data from a CSR representation.
- from_data(edge_index: ndarray | None = None, nodes_weight: ndarray | None = None, edges_weight: ndarray | None = None, sol: ndarray | None = None, ref: bool = False, re_check_symmetric: bool = False)[source]
Create a problem instance from raw data. To be implemented by subclasses.
- from_gpickle_result(gpickle_file_path: Path | None = None, result_file_path: Path | None = None, ref: bool = False)[source]
Load graph data from a gpickle file.
- to_adj_matrix(with_edge_weights: bool = False) ndarray[source]
Convert edge_index and edges_weight to adjacency matrix.