16 #include "utils/graph_typedefs.hpp"
17 #include "utils/graph_utils.hpp"
20 #include "utils/scaffolding_typedefs.hpp"
21 #include "utils/scaffolding_utils.hpp"
41 Instance(
const unsigned np,
const unsigned nc,
const unsigned no = UINT_MAX):
42 ScaffoldGraph(), num_paths(np), num_cycles(nc), num_objects(no), solution(){}
45 Instance(RawScaffoldGraph*
const _g,
const unsigned np,
const unsigned nc,
const unsigned no = UINT_MAX):
46 ScaffoldGraph(_g), num_paths(np), num_cycles(nc), num_objects(no), solution() {}
50 Instance(
const ScaffoldGraph& _g,
const unsigned np,
const unsigned nc,
const unsigned no = UINT_MAX,
const bool update_infos =
false):
51 ScaffoldGraph(_g, NULL, update_infos), num_paths(np), num_cycles(nc), num_objects(no), solution() {}
55 Instance(
const Instance& I, ScafMatching*
const translate = NULL,
const bool update_infos =
false):
57 num_paths(I.num_paths),
58 num_cycles(I.num_cycles),
59 num_objects(I.num_objects),
71 return new Instance(h, num_paths, num_cycles, num_objects);
84 void delete_edge(
const ScafEdge& e,
const bool register_in_solution =
false)
91 bool delete_edge(
const ScafVertex& u,
const ScafVertex& v,
const bool register_in_solution =
false)
93 if(register_in_solution) solution.
add_edge_global(
operator[](u).name,
operator[](v).name,
operator[](ScafVertexPair(u, v)).
weight);
97 #warning: there is a design problem here: a ScaffoldGraph should be able to perform this function, but it has no idea about solutions. Generally, the requirement of noting edges that are deleted cannot be enforced "from above" onto the ScaffoldGraph... This issue could be resolved by making ScaffoldGraph::clear_vertex_except() call Instance::delete_edge() instead of ScaffoldGraph::delete_edge()
98 void clear_vertex_except(
const ScafVertex& u,
const ScafEdge*
const e,
const bool register_in_solution =
false)
101 DEBUG4(std::cout <<
"clearing "<<
operator[](u).name <<
" avoiding "<< (e ?
get_edge_name(*e) : EdgeName(
"",
""))<<std::endl);
103 if(*r == *e) ++r;
else delete_edge(*(r++), register_in_solution);
Predicated_EdgeIter< Graph, MatchingPredicate< Graph > > get_incident_non_matching(const Vertex &u) const
convenience function to get all incident non-matching edges of u
Definition: scaffold_graph.hpp:493
void disjoint_union(const Instance &I)
disjointly merge I into us, merging partial solutions along the way
Definition: instance.hpp:77
Graph *const split_off_component()
if _the_graph is disconnected, split off & return a connected compoenent, otherwise return NULL ...
Definition: scaffold_graph.hpp:499
void combine_disjoint_union(const Solution< Compare > &S)
combine two solutions for the graphs g & h to form a solution for the disjoint union g + h ...
Definition: solution.hpp:45
unsigned weight() const
return the total weight of the graph
Definition: scaffold_graph.hpp:457
Definition: read_adj_list.hpp:22
unsigned num_cycles
max number of cycles in solutions
Definition: instance.hpp:33
Instance(const unsigned np, const unsigned nc, const unsigned no=UINT_MAX)
construct an empty solution solution
Definition: instance.hpp:41
Instance * split_off_component()
split off one connected component from I and return an instance consisting only of it...
Definition: instance.hpp:67
void delete_edge(const ScafEdge &e, const bool register_in_solution=false)
delete an edge e and add the deletion to the solution if requested
Definition: instance.hpp:84
an instance is a ScaffoldGraph with given path- & cycle- numbers and a solution to keep track of dele...
Definition: instance.hpp:27
void clear_vertex_except(const ScafVertex &u, const ScafEdge *const e, const bool register_in_solution=false)
remove all non-matching edges incident with u, except for e
Definition: instance.hpp:99
bool delete_edge(const ScafVertex &u, const ScafVertex &v, const bool register_in_solution=false)
delete the edge (u,v) and add this deletion to the solution if requested; return success ...
Definition: instance.hpp:91
solution_type solution
a partial solution
Definition: instance.hpp:35
the main graph class
Definition: scaffold_graph.hpp:25
void disjoint_union(const ScaffoldGraph &g)
merge g into our graph
Definition: scaffold_graph.hpp:521
a solution is a list of edge names with weights; it keeps track of the overall weight for O(1) access...
Definition: solution.hpp:17
Instance(const ScaffoldGraph &_g, const unsigned np, const unsigned nc, const unsigned no=UINT_MAX, const bool update_infos=false)
construct an instance using the given ScaffoldGraph, which is copied
Definition: instance.hpp:50
void add_edge_global(const EdgeName &e, const unsigned weight)
add an edge to the list
Definition: solution.hpp:52
unsigned num_objects
max number of objects (sum of paths & cycles) in solutions
Definition: instance.hpp:34
EdgeName get_edge_name(const VertexPair< Graph > &uv) const
get a copy of the name of the edge uv; independent of its presence
Definition: scaffold_graph.hpp:421
Instance(RawScaffoldGraph *const _g, const unsigned np, const unsigned nc, const unsigned no=UINT_MAX)
construct an instance using the given pointer _g as graph - no copy is performed
Definition: instance.hpp:45
void delete_edge(const Edge &e, const bool update_infos=true)
delete an edge e and update infos if requested
Definition: scaffold_graph.hpp:300
unsigned num_paths
max number of paths in solutions
Definition: instance.hpp:32
Instance(const Instance &I, ScafMatching *const translate=NULL, const bool update_infos=false)
copy constructor creating a copy of the graph and returning the translate map
Definition: instance.hpp:55