From 67f7bcfa961a6a985ee8d4072ddb86d5c0579bf7 Mon Sep 17 00:00:00 2001
From: Jeremiah Willcock
+
+The maximum_adjacency_search() function performs a traversal
+of the vertices in an undirected graph. The next vertex visited is the
+vertex that has the most visited neighbors at any time. In the case of
+an unweighted, undirected graph, the number of visited neighbors of the
+very last vertex visited in the graph is also the number of edge-disjoint
+paths between that vertex and the next-to-last vertex visited. These can be
+retrieved from a visitor, an example of which is in the test harness
+mas_test.cpp.
+
+The maximum_adjacency_search() function invokes user-defined
+actions at certain event-points within the algorithm. This provides a
+mechanism for adapting the generic MAS algorithm to the many situations
+in which it can be used. In the pseudo-code below, the event points
+for MAS are the labels on the right. The user-defined actions must be
+provided in the form of a visitor object, that is, an object whose type
+meets the requirements for a MAS Visitor.
+
+boost/graph/maximum_adjacency_search.hpp
-
+
johnson_all_pairs_shortest_paths
@@ -75,10 +75,12 @@ and Incidence Graph.
OUT: DistanceMatrix& D
The length of the shortest path between each pair of vertices
-u,v in the graph is stored in D[u][v]. The set of
-types {DistanceMatrix, vertices_size_type, D} must be a model
+u,v in the graph is stored in D[u][v]. The tuple of
+types (DistanceMatrix, vertices_size_type, D) must be a model
of BasicMatrix where D is the
-value type of the DistanceMap.
+value type of the DistanceMap. There must be implicit conversions
+between the value type of the distance matrix and the value type of the weight
+map.
@@ -86,12 +88,11 @@ value type of the DistanceMap.
IN: weight_map(WeightMap w_map)
- The weight or ``length'' of each edge in the graph.
+ The weight or "length" of each edge in the graph.
The type WeightMap must be a model of
Readable Property Map. The edge descriptor type of
the graph needs to be usable as the key type for the weight
- map. The value type for the map must be
- Addable with the value type of the distance map.
@@ -112,7 +113,7 @@ IN: vertex_index_map(VertexIndexMap i_map)
Default: get(vertex_index, g)
Note: if you use this default, make sure your graph has
an internal vertex_index property. For example,
- adjacenty_list with VertexList=listS does
+ adjacency_list with VertexList=listS does
not have an internal vertex_index property.
+ map. The value type of the weight map must support a subtraction operation.
Default: get(edge_weight, g)
@@ -128,7 +129,8 @@ IN: distance_compare(CompareFunction cmp)
This function is use to compare distances to determine
which vertex is closer to the source vertex.
The CompareFunction type must be a model of
- \stlconcept{BinaryPredicate} and have argument types that
+ Binary Predicate
+ and have argument types that
match the value type of the WeightMap property map.
Default: std::less<DT> with
DT=typename property_traits<WeightMap>::value_type
@@ -139,11 +141,8 @@ IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance
of a path. The CombineFunction type must be a model of Binary
- Function. The first argument type of the binary function must
- match the value type of the DistanceMap property map and
- the second argument type must match the value type of the
- WeightMap property map. The result type must be the same
- type as the distance value type.
+ Function. Both argument types and the return type of the binary function
+ must match the value type of the WeightMap property map. This operation is required to act as the sum operation for the weight type; in particular, it must be the inverse of the binary - operator on that type.
Default: std::plus<DT> with
DT=typename property_traits<WeightMap>::value_type
@@ -152,7 +151,7 @@ IN: distance_inf(DT inf)
This value is used to initialize the distance for each
vertex before the start of the algorithm.
- The type DT must be the value type of the WeigthMap.
@@ -160,7 +159,7 @@ IN: distance_zero(DT zero)
+ The type DT must be the value type of the WeightMap.
Default: std::numeric_limits::max()
This value is used to initialize the distance for the source
vertex before the start of the algorithm. The type DT
- must be the value type of the WeigthMap.
diff --git a/doc/maximum_adjacency_search.html b/doc/maximum_adjacency_search.html
new file mode 100644
index 00000000..d2aa9e80
--- /dev/null
+++ b/doc/maximum_adjacency_search.html
@@ -0,0 +1,284 @@
+
+
+
+
+ must be the value type of the WeightMap.
Default: 0
+
+
+maximum_adjacency_search
+
+
+
+// named parameter versions
+template <class Graph, class class P, class T, class R>
+void
+maximum_adjacency_search(const Graph& g,
+ const bgl_named_params<P, T, R>& params);
+
+// non-named parameter versions
+template <class Graph, class WeightMap, class MASVisitor>
+void
+maximum_adjacency_search(const Graph& g, WeightMap weights, MASVisitor vis,
+ const typename graph_traits<Graph>::vertex_descriptor start);
+
+
+
+
+
+
+
+
+
+
+
+MAS(G)
+ for each vertex u in V
+ reach_count[u] := 0
+ end for
+ // for the starting vertex s
+ reach_count[s] := 1
+ for each unvisited vertex u in V
+ call MAS-VISIT(G, u)
+ remove u from the list on unvisited vertices
+ for each out edge from u to t
+ if t has not yet been visited
+ increment reach_count[t]
+ end if
+ end for each out edge
+ call MAS-VISIT(G, u)
+ end for each unvisited vertex
+
+
+
+
+-
+-
+initialize vertex u
+-
+-
+-
+-
+examine vertex u
+-
+examine edge (u,t)
+-
+-
+-
+-
+finish vertex u
+-
+
+Where Defined
+
+Parameters
+
+IN: const UndirectedGraph& g
+ A connected, directed graph. The graph type must + be a model of Incidence Graph + and Vertex List Graph.+ +
+
IN: WeightMap weights
++ The weight or length of each edge in the graph. The + WeightMap type must be a model of + Readable + Property Map and its value type must be + Less Than Comparable and summable. The key type of this map + needs to be the graph's edge descriptor type. + Default: get(edge_weight, g)+ +IN: visitor(MASVisitor vis) +
+
+ A visitor object that is invoked inside the algorithm at the + event-points specified by the MAS Visitor concept. The visitor + object is passed by value [1].+ +IN: root_vertex(typename +graph_traits<VertexListGraph>::vertex_descriptor start) +
+ Default: mas_visitor<null_visitor>
+
+ This specifies the vertex that the depth-first search should + originate from. The type is the type of a vertex descriptor for the + given graph.+ +
+ Default: *vertices(g).first
+
IN: vertex_index_map(VertexIndexMap vertexIndices)
++ This maps each vertex to an integer in the range + [0, num_vertices(g)). This is only necessary if the default is + used for the assignment, index-in-heap, or distance maps. + VertexIndexMap must be a model of Readable Property + Map. The value type of the map must be an integer type. The + key type must be the graph's vertex descriptor type.+ +
+ Default: get(boost::vertex_index, g) + Note: if you use this default, make sure your graph has + an internal vertex_index property. For example, + adjacency_list with VertexList=listS does + not have an internal vertex_index property. +
UTIL: vertex_assignment_map(AssignmentMap assignments)
++ AssignmentMap must be a model of Read/Write Property + Map. The key and value types must be the graph's vertex descriptor + type.+ +
+ Default: A boost::iterator_property_map using a + std::vector of num_vertices(g) vertex descriptors and + vertexIndices for the index map. +
UTIL: max_priority_queue(MaxPriorityQueue& pq)
++ MaxPriorityQueue must be a model of Keyed Updatable Queue and a + max- + Updatable Priority Queue. The value type must be the graph's vertex + descriptor and the key type must be the weight type. + Default: A boost::d_ary_heap_indirect using a default + index-in-heap and distance map. ++ +
UTIL: index_in_heap_map(IndexInHeapMap indicesInHeap)
++ This parameter only has an effect when the default max-priority queue is used.+ +
+ IndexInHeapMap must be a model of Read/Write Property + Map. The key type must be the graph's vertex descriptor type. The + value type must be a size type + (typename std::vector<vertex_descriptor>::size_type).
+ Default: A boost::iterator_property_map using a + std::vector of num_vertices(g) size type objects and + vertexIndices for the index map. +
UTIL: distance_map(DistanceMap wAs)
++ This parameter only has an effect when the default max-priority queue is used.+ +
+ DistanceMap must be a model of Read/Write Property + Map. The key type must be the graph's vertex descriptor type. The + value type must be the weight type + (typename boost::property_traits<WeightMap>::value_type). +
+ Default: A boost::iterator_property_map using a + std::vector of num_vertices(g) weight type objects + and vertexIndices for the index map. +
void
+ +bad_graph +
+ If num_vertices(g) is less than 2 ++ +
std::invalid_argument +
+ If a max-priority queue is given as an argument and it is not empty +. + +
+The time complexity is O(E + V). +
+ +A linear time 2 + epsilon approximation algorightm for edge connectivity+
[1] + Since the visitor parameter is passed by value, if your visitor + contains state then any changes to the state during the algorithm + will be made to a copy of the visitor object, not the visitor object + passed in. Therefore you may want the visitor to hold this state by + pointer or reference.
+ +| Copyright © 2012 | +Fernando Vilas + |
-An object of type Label_Allocator specifying a strategy for the memory management of the labels. It must offer the same interface as std::allocatorIN: Visitor vis. There is a default type default_r_c_shortest_paths_allocator for this parameter using the STL standard allocator. If the third or the fourth overload of the function is used, an object of this type is used as Label_Allocator parameter. If the first or the second overload is used, one must specify both a Label_Allocator and a Visitor parameter. If one wants to develop a user-defined type only for Visitor, one can use default_r_c_shortest_paths_allocator as Label_Allocator parameter. If one wants to use a specialized allocator, one can specify an arbitrary type as template parameter for the value type to the allocator; it is rebound to the correct type. +An object of type Label_Allocator specifying a strategy for the memory management of the labels. It must offer the same interface as std::allocator<r_c_shortest_paths_label<Graph, Resource_Container> >. There is a default type default_r_c_shortest_paths_allocator for this parameter using the STL standard allocator. If the third or the fourth overload of the function is used, an object of this type is used as Label_Allocator parameter. If the first or the second overload is used, one must specify both a Label_Allocator and a Visitor parameter. If one wants to develop a user-defined type only for Visitor, one can use default_r_c_shortest_paths_allocator as Label_Allocator parameter. If one wants to use a specialized allocator, one can specify an arbitrary type as template parameter for the value type to the allocator; it is rebound to the correct type.
diff --git a/doc/table_of_contents.html b/doc/table_of_contents.html index 3bf18523..0fd36e8e 100644 --- a/doc/table_of_contents.html +++ b/doc/table_of_contents.html @@ -287,6 +287,7 @@sequential_vertex_coloring is_bipartite (including two-coloring of bipartite graphs) find_odd_cycle + maximum_adjacency_search diff --git a/doc/vf2_sub_graph_iso.html b/doc/vf2_sub_graph_iso.html index ae24e908..95ea9496 100755 --- a/doc/vf2_sub_graph_iso.html +++ b/doc/vf2_sub_graph_iso.html @@ -87,13 +87,16 @@ bool vf2_subgraph_iso(const GraphSmall& graph_small, graph that preserves the edge structure of the graphs. M is said to be a graph-subgraph isomorphism if and only if M is an isomorphism between G1 and a subgraph of G2. + An induced subgraph of a graph G = (V, E) is a normal subgraph + G' = (V', E') with the extra condition that all edges of G + which have both endpoints in V' are in E'.- This function finds all graph-subgraph isomorphism mappings between + This function finds all induced subgraph isomorphisms between graphs graph_small and graph_large and outputs them to user_callback. It continues until user_callback - returns true or the search space has been fully explored. vf2_subgraph_iso + returns false or the search space has been fully explored. vf2_subgraph_iso returns true if a graph-subgraph isomorphism exists and false otherwise. EdgeEquivalencePredicate and VertexEquivalencePredicate predicates are used to test whether @@ -182,8 +185,8 @@ bool operator()(CorrespondenceMap1To2 f, CorrespondenceMap2To1 g) const and CorresondenceMap2To1 types are models of Readable Property Map and map equivalent vertices across the two - graphs given to vf2_subgraph_iso (or vf2_graph_iso). For - instance, if v is + graphs given to vf2_subgraph_iso (or vf2_graph_iso or + vf2_subgraph_mono). For instance, if v is from graph_small, w is from graph_large, and the vertices can be considered equivalent, then get(f, v) will be w and get(g, w) @@ -279,13 +282,22 @@ bool operator()(CorrespondenceMap1To2 f, CorrespondenceMap2To1 g) const function
vf2_graph_iso(...)
+vf2_subgraph_mono(...)
- for isomorphism testing take the same parameters as the corresponding - functions vf2_subgraph_iso for subgraph isomorphism testing. - The algorithm finds all isomorphism mappings between graphs - graph1 and graph2 and outputs them to - user_callback. It continues until user_callback - returns true or the search space has been fully explored. As before, + for isomorphism and (not necessarily induced) subgraph isomorphism testing, + taking the same parameters as the corresponding functions vf2_subgraph_iso + for induced subgraph isomorphism testing. + For vf2_graph_iso the algorithm finds all isomorphism mappings between + graphs graph1 and graph2 and outputs them to + user_callback. + For vf2_graph_mono the algorithm finds all mappings of graph_small + to subgraphs of graph_large. + Note that, as opposed to vf2_subgraph_iso, + these subgraphs need not to be induced subgraphs. +
++ Both algorithms continues until user_callback + returns false or the search space has been fully explored. As before, EdgeEquivalencePredicate and VertexEquivalencePredicate predicates are used to test whether edges and vertices are equivalent. By default @@ -511,7 +523,9 @@ vf2_subgraph_iso(graph1, graph2, callback, vertex_order_by_mult(graph1),
Copyright © 2012, Flavio De Lorenzi - (fdlorenzi@gmail.com) + (fdlorenzi@gmail.com)
+ Copyright © 2013, Jakob Lykke Andersen, University of Southern Denmark + (jlandersen@imada.sdu.dk)