Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cpp/include/models/graph_models.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ struct GraphNode {
int id;
std::string label;
double x, y;

GraphNode(int id, const std::string& label = "", double x = 0.0, double y = 0.0);
std::string color;

GraphNode(int id, const std::string& label = "", double x = 0.0, double y = 0.0, const std::string& color = "white");
};


struct GraphEdge {
int from, to;
double weight;
bool directed;

GraphEdge(int from, int to, double weight = 1.0, bool directed = false);
std::string color;

GraphEdge(int from, int to, double weight = 1.0, bool directed = false, const std::string& color = "black");
};


struct GraphStep {
std::vector<int> visitedNodes;
std::vector<int> currentNodes;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/models/graph_models.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "models/graph_models.h"

GraphNode::GraphNode(int id, const std::string& label, double x, double y)
: id(id), label(label), x(x), y(y) {}
GraphNode::GraphNode(int id, const std::string& label, double x, double y, const std::string& color)
: id(id), label(label), x(x), y(y), color(color) {}

GraphEdge::GraphEdge(int from, int to, double weight, bool directed)
: from(from), to(to), weight(weight), directed(directed) {}
GraphEdge::GraphEdge(int from, int to, double weight, bool directed, const std::string& color)
: from(from), to(to), weight(weight), directed(directed), color(color) {}

GraphStep::GraphStep(const std::string& operation)
: operation(operation) {}
Expand Down
Loading