Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up includes part-3 #483

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 41 additions & 13 deletions src/contraction/src/contractGraph_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <vector>
#include "./contractGraph_driver.h"
#include "./contract_function.h"
#include "./../../common/src/baseGraph.hpp"

// #define DEBUG

Expand All @@ -64,7 +65,11 @@ do_pgr_contractGraph(
size_t *return_count,
char ** err_msg){
std::ostringstream log;
std::ostringstream graphnameStream,edgeStream,removedEStream,removedVStream,psuedoEStream;
std::ostringstream contracted_graph_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ones go inside the try
only log is outside the try

std::ostringstream contracted_graph_blob;
std::ostringstream removedEdges;
std::ostringstream removedVertices;
std::ostringstream psuedoEdges;
try {

if (total_tuples == 1) {
Expand All @@ -78,7 +83,6 @@ do_pgr_contractGraph(
graphType gType = directed? DIRECTED: UNDIRECTED;
const int initial_size = total_tuples;

std::deque< Path >paths;
log << "Level" << level << "\n";
if (directed) {
log << "Working with directed Graph\n";
Expand All @@ -87,28 +91,52 @@ do_pgr_contractGraph(
#ifdef DEBUG
digraph.print_graph(log);
#endif
//pgr_dijkstra(digraph, paths, start_vid, end_vertices, false);
/*
Function call to get the contracted graph.

fetch_contracted_graph(digraph,level,
contracted_graph_name,contracted_graph_blob,removedEdges,
removedVertices,psuedoEdges
);
return_tuples = get_memory (1, pgr_contracted_blob);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes out of the if then else,
only the call to directed goes in the if

return_tuples->contracted_graph_name=strdup(contracted_graph_name.str().c_str());
return_tuples->contracted_graph_blob=strdup(contracted_graph_blob.str().c_str());
return_tuples->removedVertices=strdup(removedVertices.str().c_str());
return_tuples->removedEdges=strdup(removedEdges.str().c_str());
return_tuples->psuedoEdges=strdup(psuedoEdges.str().c_str());


*/


} else {
log << "Working with Undirected Graph\n";
Pgr_base_graph< UndirectedGraph > undigraph(gType, initial_size);
undigraph.graph_insert_data(data_edges, total_tuples);
#ifdef DEBUG
undigraph.print_graph(log);
#endif
//pgr_dijkstra(undigraph, paths, start_vid, end_vertices, false);
}

size_t count(count_tuples(paths));

if (count == 0) {
(*return_tuples) = NULL;
(*return_count) = 0;
log <<
"No paths found between Starting and any of the Ending vertices\n";
*err_msg = strdup(log.str().c_str());
return;
/*
Function call to get the contracted graph.

return_tuples = get_memory (1, pgr_contracted_blob);
fetch_contracted_graph(undigraph,level,
contracted_graph_name,contracted_graph_blob,removedEdges,
removedVertices,psuedoEStream
);
(return_tuples)->contracted_graph_name=strdup(contracted_graph_name.str().c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes out of the if then else, and of course only once.
only the call to undirected goes in the if

(return_tuples)->contracted_graph_blob=strdup(contracted_graph_blob.str().c_str());
(return_tuples)->removedVertices=strdup(removedVertices.str().c_str());
(return_tuples)->removedEdges=strdup(removedEdges.str().c_str());
(return_tuples)->psuedoEdges=strdup(psuedoEdges.str().c_str());
*/

}



(*return_tuples) = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you put the code of :

(you forgot the the include of the memory function... check the history of skype)

(you forgot the call to get_memory)
(return_tuples)->psuedoEdges=strdup(psuedoEdges.str().c_str());
then delete line 140 (*return_tuples) = NULL;
and set return count to 1

(*return_count) = 0;
#if 0
Expand Down