class QPanda::GraphDijkstra

Overview

Solutions for Dijkstra algorithm. More…

#include <GraphDijkstra.h>

class GraphDijkstra
{
public:
    // construction

    GraphDijkstra();
    GraphDijkstra(const std::vector<std::vector<int>>& matrix);

    // methods

    int getShortestPath(int begin, int end, std::vector<int>& path_vec);
    bool is_connective();
};

Detailed Documentation

Solutions for Dijkstra algorithm.

Methods

int getShortestPath(int begin, int end, std::vector<int>& path_vec)

Get the shortest path of the graph between begin with end.

Parameters:

int

Begin: starting point

int

End: end point

std::vector<int>&

path_vec: The points at which the shortes path passes

Returns:

int The length of the shortes path

bool is_connective()

Determine if the graph is connected.

Returns:

bool Result of the judgement

See also: