Commit 2a8b7dd2 authored by Jonas Seidel's avatar Jonas Seidel

lp_generator fix & tip_fringes now reuses existent fringes

parent b5ebb96d
......@@ -16,12 +16,21 @@ Node* Graph::tip_targets(random_attribute_generator edge_attribute_generator, ra
std::vector<Node*> targets = this->select_targets();
std::stringstream name;
name << this->size().first;
Node* t = this->add_node(name.str(), node_attribute_generator.next());
for(Node* n : targets){
std::stringstream name;
name << n->description() << "_" << t->description();
this->add_edge(n, t, name.str(), edge_attribute_generator.next());
Node* t;
if(targets.size() > 1){
t = this->add_node(name.str(), node_attribute_generator.next());
for(Node* n : targets){
std::stringstream name;
name << n->description() << "_" << t->description();
this->add_edge(n, t, name.str(), edge_attribute_generator.next());
}
}else if(targets.size() == 1){
t = targets[0];
}else{
throw std::invalid_argument("no targets to tip");
}
return t;
}
......@@ -45,12 +54,21 @@ Node* Graph::tip_sources(random_attribute_generator edge_attribute_generator, ra
std::vector<Node*> sources = this->select_sources();
std::stringstream name;
name << this->size().first;
Node* s = this->add_node(name.str(), node_attribute_generator.next());
for(Node* n : sources){
std::stringstream name;
name << s->description() << "_" << n->description();
this->add_edge(s, n, name.str(), edge_attribute_generator.next());
Node* s;
if(sources.size() > 1){
s = this->add_node(name.str(), node_attribute_generator.next());
for(Node* n : sources){
std::stringstream name;
name << n->description() << "_" << s->description();
this->add_edge(s, n, name.str(), edge_attribute_generator.next());
}
}else if(sources.size() == 1){
s = sources[0];
}else{
throw std::invalid_argument("no targets to tip");
}
return s;
}
......
......@@ -92,7 +92,7 @@ std::pair<
name << "node_" << n->description() << "_" << node_prop.first << "_" << name_appendix;
node_lookup.insert({{n,node_prop.first}, p.add_variable(Variable(name.str(), std::get<0>(node_prop.second), std::get<1>(node_prop.second), std::get<2>(node_prop.second)))});
}
return true;
return false;
};
g.conditional_bfs_all_components(
......
CXX := g++
CXXFLAGS := -O0 -g -std=c++2a #-Wall -Wextra -Wpedantic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment