void operator()(dynamic_array<size_type>& path) { printf("default_path_visitor; path size: %lu\n", path.size()); vertex_id_map<Graph> vid_map = get(_vertex_id_map, g); edge_id_map<Graph> eid_map = get(_edge_id_map, g); edge_iterator ei = edges(g); vertex_iterator vi = vertices(g); for (size_type i = 0; i < path.size(); ++i) { if (i % 2 == 0) { size_type vid = path[i]; printf("vertex [ %lu ]\n", vid); } else { size_type eid = path[i]; edge_descriptor e = ei[eid]; size_type uid = get(vid_map, source(e, g)); size_type vid = get(vid_map, target(e, g)); printf("edge ( %lu , %lu )\n", uid, vid); } } }
void operator()(dynamic_array<size_type>& path) { typedef typename dynamic_array<size_type>::size_type d_size_type; printf("Path:"); for (d_size_type i = 1; i < path.size(); i += 2) printf("%6lu", path[i]); printf("\n"); }
void operator()(dynamic_array<size_type_sg>& path) { typedef typename dynamic_array<size_type_sg>::size_type d_size_type; edge_id_map<Graph> eid_map = get(_edge_id_map, g); edge_iterator_sg edgs_sg = edges(sg); printf("Path:"); for (d_size_type i = 1; i < path.size(); i += 2) { size_type eid = get(eid_map, sg.local_to_global(edgs_sg[path[i]])); printf("%6lu", eid); } printf("\n"); }
// 0-indexed, of course std::string getline(unsigned i, bool chop_newline = true) { if (!file) { return boost::lexical_cast<std::string>(i); } Assert(i>=0 && i+1 < line_begins.size()); pos start = line_begins[i]; pos end = line_begins[i+1]; unsigned len = end-start; if (chop_newline && len > 0) --len; // don't want to include newline char auto_array<char> buf(len); // FIXME: could just return a shared_ptr or use string = getline(blah,sep) ... or return expression object that can convert to string or be printed file->seekg(start); file->read(buf.begin(), len); return std::string(buf.begin(), len); }
void operator()(dynamic_array<size_type>& path) { #ifdef DEBUG assert(path.size() == 7); #endif vertex_iterator vi = vertices(g); edge_iterator ei = edges(g); size_type v0 = path[0]; size_type v1 = path[2]; size_type v2 = path[4]; size_type v3 = path[6]; if (v0 != v1 && v1 != v2 && v0 != v2 && v3 == v0) { user_vis(path, "subiso"); } }
unsigned size() const { Assert(exists() && line_begins.size()>0); return line_begins.size()-1; }