6#include <unordered_map>
7#include <unordered_set>
10#include "global_body_planner/planning_utils.h"
12using namespace planning_utils;
58 virtual void addEdge(
int idx1,
int idx2);
66 virtual void addEdge(
int idx1,
int idx2,
double edge_cost);
163 std::unordered_map<int, std::vector<int>>
edges;
A general directed graph class.
Definition graph_class.h:24
void addVertex(int index, State s)
Add a new vertex to the graph along with its state data.
Definition graph_class.cpp:18
void printVertices()
Print the all vertices in the graph via stdout.
Definition graph_class.cpp:69
double computeEdgeCost(int idx1, int idx2)
Compute the cost of an edge between two vertices.
Definition graph_class.cpp:100
std::unordered_map< int, std::vector< int > > successors
Map from vertex indices to their children.
Definition graph_class.h:166
GraphClass()
Constructor for GraphClass.
Definition graph_class.cpp:12
Action getAction(int idx)
Get the action of a vertex.
Definition graph_class.cpp:65
virtual void printEdges()
Print the all edges in the graph via stdout.
Definition graph_class.cpp:91
int getNumVertices()
Retrieve the total number of vertices in the graph, computed as the size of the vertices vector.
Definition graph_class.cpp:16
void printIncomingEdges(int idx)
Print the edges leading to a vertex via stdout.
Definition graph_class.cpp:79
virtual void init(State s)
Initialize the graph by adding the root vertex (idx = 0) and setting g(idx) = 0.
Definition graph_class.cpp:111
double getGValue(int idx)
Get the g-value of a vertex.
Definition graph_class.cpp:98
std::unordered_map< int, double > g_values
Map from vertex indices to their costs (g-values)
Definition graph_class.h:169
std::vector< int > getSuccessors(int idx)
Get the children of a vertex.
Definition graph_class.cpp:61
virtual int getPredecessor(int idx)
Get the parent of a vertex.
Definition graph_class.cpp:54
void addAction(int idx, Action a)
Add an action to a particular vertex. This is the action that lead to this particular vertex from its...
Definition graph_class.cpp:63
void printVertex(State s)
Print the state information via stdout.
Definition graph_class.cpp:67
std::unordered_map< int, std::vector< int > > edges
Map from vertex indices to their parent(s)
Definition graph_class.h:163
void removeEdge(int idx1, int idx2)
Remove an edge of the graph.
Definition graph_class.cpp:37
virtual void addEdge(int idx1, int idx2)
Add a new edge to the graph.
Definition graph_class.cpp:23
State getVertex(int index)
Retrieve the state stored at a particular index in the graph.
Definition graph_class.cpp:14
void updateGValue(int idx, double val)
Update the g-value of a vertex and propogate to all its successors.
Definition graph_class.cpp:104
std::unordered_map< int, State > vertices
Map from vertex indices to corresponding states.
Definition graph_class.h:157
std::unordered_map< int, Action > actions
Map from vertex indices to the actions leading to those vertices.
Definition graph_class.h:160
Define action with Eigen data.
Definition planning_utils.h:218
Define state with Eigen data.
Definition planning_utils.h:184