6 * edge descriptor f = 00 | e | y | x
9 * e is 0,1 or 2. The edge is edge e out of vertex (x,y).
13 * We use BGL's implementation of Johnson All Pairs Shortest Paths
16 #define VMASK (YMASK|XMASK)
17 #define ESHIFT (YBITS|XBITS)
20 struct layout_graph_traversal_category :
21 public virtual incidence_graph_tag,
22 public virtual edge_list_graph_tag
23 public virtual vertex_list_graph_tag { };
25 struct graph_traits<Layout> {
27 typedef int vertex_descriptor; /* vertex number, -1 => none */
28 typedef int edge_descriptor; /* see above */
29 typedef undirected_tag directed_category;
30 typedef disallow_parallel_ege edge_parallel_category;
31 typedef layout_graph_traversal_category traversal_category;
32 inline int null_vertex() { return -1; }
34 struct out_edge_iterator_policies {
35 static void increment(int& f) { f += 1<<ESHIFT; }
36 static void decrement(int& f) { f -= 1<<ESHIFT; }
38 template <class Reference>
39 static Reference dereference(type<Reference>, const int& f)
40 { return const_cast<Reference>(f); }
42 static bool equal(int x, int y) { return x == y; }
44 struct graph_traits<Layout> {
45 /* Concept IncidenceGraph: */
46 typedef iterator_adaptor<int, out_edge_iterator_policies,
47 iterator<std::bidirectional_iterator_tag,int>
50 inline int source(int f, const Layout& g) { return f&VMASK; }
51 inline int target(int f, const Layout& g) { return EDGE_END2(f&VMASK, f>>ESHIFT); }
52 inline std::pair<typename graph_traits<Layout>::out_edge_iterator,
53 typename graph_traits<Layout>::out_edge_iterator>
54 out_edges(int v, const Layout& g) {
55 return std::make_pair(VE_MIN(v), VE_MAX(v));
61 /* Concept VertexListGraph: */
62 typedef counting_iterator<int> vertex_iterator;
66 void calculate_layout_energy(const Layout*) {
69 boost::dijkstra_shortest_paths(g, v1, 0);
72 /* vertex_index_map(vimap). */