67 std::vector<GraphEdgeInfo*>::iterator it;
80 if (
parent[ed_id].ed_ind[v_pos] == -1) {
96 parent[ed_id].v_pos[v_pos]);
127 int64 st_edge_ind = edge_ind;
128 for (
const auto &rule : vecRules) {
130 int64 v_pos = (isStart?0:1);
131 edge_ind = st_edge_ind;
132 for (
auto const &precedence : rule.precedencelist) {
133 if (edge_ind == -1) {
137 if (precedence !=
m_vecEdgeVector[
static_cast<size_t>(edge_ind)]->m_lEdgeID) {
141 auto parent_ind =
parent[
static_cast<size_t>(edge_ind)].ed_ind[
static_cast<size_t>(v_pos)];
143 edge_ind = parent_ind;
158 std::priority_queue<
PDP, std::vector<PDP>,
159 std::greater<PDP> > &que) {
161 for (
const auto &index : vecIndex) {
163 double extCost = 0.0;
168 if (new_edge->m_lStartNode == cur_node) {
169 if (new_edge->m_dCost >= 0.0) {
172 new_edge->m_dCost + extCost;
175 new_edge->m_dCost + extCost;
176 if (totalCost <
m_dCost[index].endCost) {
178 parent[new_edge->m_lEdgeIndex].
v_pos[0] = (isStart?0:1);
181 que.push(std::make_pair(totalCost,
182 std::make_pair(new_edge->m_lEdgeIndex,
true)));
186 if (new_edge->m_dReverseCost >= 0.0) {
189 new_edge->m_dReverseCost + extCost;
192 new_edge->m_dReverseCost + extCost;
193 if (totalCost <
m_dCost[index].startCost) {
195 parent[new_edge->m_lEdgeIndex].
v_pos[1] = (isStart?0:1);
198 que.push(std::make_pair(totalCost,
199 std::make_pair(new_edge->m_lEdgeIndex,
false)));
211 edge_t *edges,
size_t edge_count,
212 int64 start_edge_id,
double start_part,
213 int64 end_edge_id,
double end_part,
214 bool directed,
bool has_reverse_cost,
219 std::vector<PDVI> &ruleList) {
228 int64 start_vertex, end_vertex;
234 if (start_part == 0.0) {
236 }
else if (start_part == 1.0) {
245 start_edge.
source = start_vertex;
247 if (start_edge_info->
m_dCost >= 0.0) {
249 start_edge.
cost = (1.0 - start_part) * start_edge_info->
m_dCost;
267 if (end_part == 0.0) {
269 }
else if (end_part == 1.0) {
278 end_edge.
target = end_vertex;
280 if (end_edge_info->
m_dCost >= 0.0) {
297 start_vertex, end_vertex,
298 directed, has_reverse_cost,
300 path, path_count, err_msg,
308 edge_t *edges,
size_t edge_count,
309 int64 start_vertex, int64 end_vertex,
310 bool directed,
bool has_reverse_cost,
314 std::vector<PDVI> &ruleList) {
317 for (
const auto &rule : ruleList) {
319 size_t seq_cnt = rule.second.size();
320 std::vector<int64> temp_precedencelist;
321 temp_precedencelist.clear();
322 for (j = 1; j < seq_cnt; j++) {
323 temp_precedencelist.push_back(rule.second[j]);
325 int64 dest_edge_id = rule.second[0];
328 temp_precedencelist));
330 std::vector<Rule> temprules;
332 temprules.push_back(
Rule(rule.first, temp_precedencelist));
333 m_ruleTable.insert(std::make_pair(dest_edge_id, temprules));
339 for (
const auto &source : vecsource) {
340 temp_precedencelist.clear();
341 temp_precedencelist.push_back(
344 temp_precedencelist));
353 for (
const auto &source : vecsource) {
362 start_vertex, end_vertex,
363 directed, has_reverse_cost,
364 path, path_count, err_msg));
369 edge_t *edges,
size_t edge_count,
370 int64 start_vertex, int64 end_vertex,
371 bool directed,
bool has_reverse_cost,
380 std::priority_queue<PDP, std::vector<PDP>, std::greater<PDP> > que;
386 for (i = 0; i <= edge_count; i++) {
392 *err_msg =
const_cast<char *
>(
"Source Not Found");
398 *err_msg =
const_cast<char *
>(
"Destination Not Found");
406 for (
const auto &source : vecsource) {
409 if (cur_edge->
m_dCost >= 0.0) {
413 que.push(std::make_pair(cur_edge->
m_dCost,
429 while (!que.empty()) {
430 PDP cur_pos = que.top();
432 int64 cured_index = cur_pos.second.first;
435 if (cur_pos.second.second) {
439 if (cur_node == end_vertex)
447 if (cur_node == end_vertex)
449 explore(cur_node, *cur_edge,
false,
453 if (cur_node != end_vertex) {
459 *err_msg =
const_cast<char *
>(
"Path Not Found");
487 for (
size_t i = 0; i < *path_count; i++) {
488 (*path)[i].vertex_id =
m_vecPath[i].vertex_id;
489 (*path)[i].edge_id =
m_vecPath[i].edge_id;
493 (*path)[0].vertex_id = -1;
497 *path_count = *path_count - 1;
507 size_t *path_count) {
518 (*path)[0].cost = start_edge_info->
m_dCost *
544 bool has_reverse_cost,
bool directed) {
545 for (
size_t i = 0; i < edge_count; i++) {
546 if (!has_reverse_cost) {
563 if (bIsStartNodeSame) {
629 int64 lEdgeCount =
static_cast<int64
>(itNodeMap->second.size());
631 for (lEdgeIndex = 0; lEdgeIndex < lEdgeCount; lEdgeIndex++) {
632 int64 lEdge = itNodeMap->second.at(
static_cast<size_t>(lEdgeIndex));
643 int64 lEdgeCount =
static_cast<int64
>(itNodeMap->second.size());
645 for (lEdgeIndex = 0; lEdgeIndex < lEdgeCount; lEdgeIndex++) {
646 int64 lEdge = itNodeMap->second.at(
static_cast<size_t>(lEdgeIndex));