adjacency_matrix.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <HTML>
  2. <!--
  3. Copyright (c) Jeremy Siek 2000
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>Boost Graph Library: Adjacency Matrix</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H1><A NAME="sec:adjacency-matrix-class"></A>
  16. <pre>
  17. adjacency_matrix&lt;Directed, VertexProperty,
  18. EdgeProperty, GraphProperty,
  19. Allocator&gt;
  20. </pre>
  21. </H1>
  22. The <tt>adjacency_matrix</tt> class implements the BGL graph interface
  23. using the traditional adjacency matrix storage format. For a graph
  24. with <i>V</i> vertices, a <i>V x V</i> matrix is used, where each
  25. element <i>a<sub>ij</sub></i> is a boolean flag that says whether
  26. there is an edge from vertex <i>i</i> to vertex <i>j</i>. <a
  27. href="#fig:adj-matrix-graph">Figure 1</a> shows the adjacency matrix
  28. representation of a graph.
  29. <P></P>
  30. <DIV ALIGN="center"><A NAME="fig:adj-matrix-graph"></A>
  31. <TABLE>
  32. <CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG> Adjacency Matrix Representation of a Directed Graph.</CAPTION>
  33. <TR><TD><IMG SRC="./figs/adj-matrix-graph3.gif" width="386" height="284"></TD>
  34. <TD><IMG SRC="./figs/adj-matrix.gif" width="135" height="136"></TD></TR>
  35. </TABLE>
  36. </DIV><P></P>
  37. The advantage of this matrix format over the adjacency list is that
  38. edge insertion and removal is constant time. There are several
  39. disadvantages. The first is that the amount of memory used is
  40. <i>O(V<sup>2</sup>)</i> instead of <i>O(V + E)</i> (where <i>E</i> is
  41. the number of edges). The second is that operations that traverse all
  42. the out-edges of each vertex (such as breadth-first search) run in
  43. <i>O(V<sup>2</sup>)</i> time instead of <i>O(V + E)</i> time for the
  44. adjacency list. In short, it is better to use the
  45. <tt>adjacency_matrix</tt> for dense graphs (where <i>E</i> is close to
  46. <i>V<sup>2</sup></i>) and it is better to use <a
  47. href="adjacency_list.html"><tt>adjacency_list</tt></a> for sparse
  48. graphs (where <i>E</i> is much smaller than <i>V<sup>2</sup></i>).
  49. The <tt>adjacency_matrix</tt> class extends the traditional
  50. data-structure by allowing objects to be attached to vertices and
  51. edges using the same property template parameters supported by <a
  52. href="adjacency_list.html"><tt>adjacency_list</tt></a>. These may be
  53. <a href="bundles.html">bundled properties</a> or standard (backward-compatible)
  54. <a
  55. href="using_adjacency_list.html#sec:adjacency-list-properties">interior
  56. properties</a>. The types of all property values must be
  57. Copy Constructible, Assignable and Default Constructible.
  58. In the case of an undirected graph, the
  59. <tt>adjacency_matrix</tt>. class does not use a full <i>V x V</i>
  60. matrix but instead uses a lower triangle (the diagonal and below)
  61. since the matrix for an undirected graph is symmetric. This reduces
  62. the storage to <i>(V<sup>2</sup>)/2</i>. <a
  63. href="#fig:undir-adj-matrix-graph">Figure 2</a> shows an adjacency
  64. matrix representation of an undirected graph.
  65. <P></P>
  66. <DIV ALIGN="center"><A NAME="fig:undir-adj-matrix-graph"></A>
  67. <TABLE>
  68. <CAPTION ALIGN="BOTTOM"><STRONG>Figure 2:</STRONG> Adjacency Matrix Representation of an Undirected Graph.</CAPTION>
  69. <TR><TD><IMG SRC="./figs/undir-adj-matrix-graph3.gif" width="260" height="240"></TD>
  70. <TD><IMG SRC="./figs/undir-adj-matrix2.gif" width="135" height="136"></TD></TR>
  71. </TABLE>
  72. </DIV><P></P>
  73. <h3>Example</h3>
  74. Creating the graph of <a href="#fig:adj-matrix-graph">Figure 1</a>.
  75. <pre>
  76. enum { A, B, C, D, E, F, N };
  77. const char* name = "ABCDEF";
  78. typedef boost::adjacency_matrix&lt;boost::directedS> Graph;
  79. Graph g(N);
  80. add_edge(B, C, g);
  81. add_edge(B, F, g);
  82. add_edge(C, A, g);
  83. add_edge(C, C, g);
  84. add_edge(D, E, g);
  85. add_edge(E, D, g);
  86. add_edge(F, A, g);
  87. std::cout &lt;&lt; "vertex set: ";
  88. boost::print_vertices(g, name);
  89. std::cout &lt;&lt; std::endl;
  90. std::cout &lt;&lt; "edge set: ";
  91. boost::print_edges(g, name);
  92. std::cout &lt;&lt; std::endl;
  93. std::cout &lt;&lt; "out-edges: " &lt;&lt; std::endl;
  94. boost::print_graph(g, name);
  95. std::cout &lt;&lt; std::endl;
  96. </pre>
  97. The output is:
  98. <pre>
  99. vertex set: A B C D E F
  100. edge set: (B,C) (B,F) (C,A) (C,C) (D,E) (E,D) (F,A)
  101. out-edges:
  102. A -->
  103. B --> C F
  104. C --> A C
  105. D --> E
  106. E --> D
  107. F --> A
  108. </pre>
  109. Creating the graph of <a href="#fig:undir-adj-matrix-graph">Figure 2</a>.
  110. <pre>
  111. enum { A, B, C, D, E, F, N };
  112. const char* name = "ABCDEF";
  113. typedef boost::adjacency_matrix&lt;boost::undirectedS> UGraph;
  114. UGraph ug(N);
  115. add_edge(B, C, ug);
  116. add_edge(B, F, ug);
  117. add_edge(C, A, ug);
  118. add_edge(D, E, ug);
  119. add_edge(F, A, ug);
  120. std::cout &lt;&lt; "vertex set: ";
  121. boost::print_vertices(ug, name);
  122. std::cout &lt;&lt; std::endl;
  123. std::cout &lt;&lt; "edge set: ";
  124. boost::print_edges(ug, name);
  125. std::cout &lt;&lt; std::endl;
  126. std::cout &lt;&lt; "incident edges: " &lt;&lt; std::endl;
  127. boost::print_graph(ug, name);
  128. std::cout &lt;&lt; std::endl;
  129. </pre>
  130. The output is:
  131. <pre>
  132. vertex set: A B C D E F
  133. edge set: (C,A) (C,B) (E,D) (F,A) (F,B)
  134. incident edges:
  135. A &lt;--> C F
  136. B &lt;--> C F
  137. C &lt;--> A B
  138. D &lt;--> E
  139. E &lt;--> D
  140. F &lt;--> A B
  141. </pre>
  142. <h3>Where Defined</h3>
  143. <a href="../../../boost/graph/adjacency_matrix.hpp"><tt>boost/graph/adjacency_matrix.hpp</tt></a>
  144. <h3>Template Parameters</h3>
  145. <p>
  146. <table border>
  147. <TR>
  148. <th>Parameter</th><th>Description</th><th>Default</th>
  149. </tr>
  150. <tr>
  151. <td><tt>Directed</tt></td>
  152. <td>A selector to choose whether the graph is directed or undirected. The options are <tt>directedS</tt> and <tt>undirectedS</tt>.</td>
  153. <td><tt>directedS</tt></td>
  154. </tr>
  155. <tr>
  156. <td><tt>VertexProperty</tt></td>
  157. <td>for specifying internal property storage.</td>
  158. <td><tt>no_property</tt></td>
  159. </tr>
  160. <tr>
  161. <td><tt>EdgeProperty</tt></td>
  162. <td>for specifying internal property storage.</td>
  163. <td><tt>no_property</tt></td>
  164. </tr>
  165. <tr>
  166. <td><tt>GraphProperty</tt></td>
  167. <td>for specifying property storage for the graph object.</td>
  168. <td><tt>no_property</tt></td>
  169. </tr>
  170. </table>
  171. <h3>Model Of</h3>
  172. <a href="./VertexAndEdgeListGraph.html">VertexAndEdgeListGraph</a>,
  173. <a href="./IncidenceGraph.html">Incidence Graph</a>,
  174. <a href="./BidirectionalGraph.html">Bidirectional Graph</a>,
  175. <a
  176. href="./AdjacencyMatrix.html">AdjacencyMatrix</a>, <a
  177. href="./MutablePropertyGraph.html">MutablePropertyGraph</a>,
  178. <a href="../../utility/CopyConstructible.html">CopyConstructible</a>,
  179. and <a href="../../utility/Assignable.html">Assignable</a>.
  180. <h3>Associated Types</h3>
  181. <hr>
  182. <tt>graph_traits&lt;adjacency_matrix&gt;::vertex_descriptor</tt>
  183. <br><br>
  184. The type for the vertex descriptors associated with the
  185. <tt>adjacency_matrix</tt>.<br>
  186. (Required by <a href="./Graph.html">Graph</a>.)
  187. <hr>
  188. <tt>graph_traits&lt;adjacency_matrix&gt;::edge_descriptor</tt>
  189. <br><br>
  190. The type for the edge descriptors associated with the
  191. <tt>adjacency_matrix</tt>.<br>
  192. (Required by <a href="Graph.html">Graph</a>.)
  193. <hr>
  194. <tt>graph_traits&lt;adjacency_matrix&gt;::vertex_iterator</tt>
  195. <br><br>
  196. The type for the iterators returned by <tt>vertices()</tt>.
  197. The vertex iterator models <a href="http://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>. <br>
  198. (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)
  199. <hr>
  200. <tt>graph_traits&lt;adjacency_matrix&gt;::edge_iterator</tt>
  201. <br><br>
  202. The type for the iterators returned by <tt>edges()</tt>. This
  203. iterator models <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>.<br>
  204. (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)
  205. <hr>
  206. <tt>graph_traits&lt;adjacency_matrix&gt;::out_edge_iterator</tt>
  207. <br><br>
  208. The type for the iterators returned by <tt>out_edges()</tt>. This
  209. iterator models <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>. <br>
  210. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  211. <hr>
  212. <tt>graph_traits&lt;adjacency_matrix&gt;::in_edge_iterator</tt>
  213. <br><br>
  214. The type for the iterators returned by <tt>in_edges()</tt>. This
  215. iterator models <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>. <br>
  216. (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
  217. <hr>
  218. <tt>graph_traits&lt;adjacency_matrix&gt;::adjacency_iterator</tt>
  219. <br><br>
  220. The type for the iterators returned by <tt>adjacent_vertices()</tt>. This
  221. iterator models the same concept as the out-edge iterator.<br>
  222. (Required by <a href="AdjacencyGraph.html">AdjacencyGraph</a>.)
  223. <hr>
  224. <tt>graph_traits&lt;adjacency_matrix&gt;::directed_category</tt>
  225. <br><br>
  226. Provides information about whether the graph is directed
  227. (<tt>directed_tag</tt>) or undirected (<tt>undirected_tag</tt>).<br>
  228. (Required by <a href="Graph.html">Graph</a>.)
  229. <hr>
  230. <tt>graph_traits&lt;adjacency_matrix&gt;::edge_parallel_category</tt>
  231. <br><br>
  232. An adjacency matrix does not allow the insertion of
  233. parallel edges, so this type is always
  234. <tt>disallow_parallel_edge_tag</tt>. <br>
  235. (Required by <a href="Graph.html">Graph</a>.)
  236. <hr>
  237. <tt>graph_traits&lt;adjacency_matrix&gt;::vertices_size_type</tt>
  238. <br><br>
  239. The type used for dealing with the number of vertices in
  240. the graph.<br>
  241. (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)
  242. <hr>
  243. <tt>graph_traits&lt;adjacency_matrix&gt;::edges_size_type</tt>
  244. <br><br>
  245. The type used for dealing with the number of edges in the graph.<br>
  246. (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)
  247. <hr>
  248. <tt>graph_traits&lt;adjacency_matrix&gt;::degree_size_type</tt>
  249. <br><br>
  250. The type used for dealing with the number of out-edges of a vertex.<br>
  251. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  252. <hr>
  253. <tt>property_map&lt;adjacency_matrix, PropertyTag&gt;::type</tt><br>
  254. <tt>property_map&lt;adjacency_matrix, PropertyTag&gt;::const_type</tt>
  255. <br><br>
  256. The map type for vertex or edge properties in the graph. The
  257. specific property is specified by the <tt>PropertyTag</tt> template
  258. argument, and must match one of the properties specified in the
  259. <tt>VertexProperty</tt> or <tt>EdgeProperty</tt> for the graph.<br>
  260. (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
  261. <hr>
  262. <h3>Member Functions</h3>
  263. <hr>
  264. <pre>
  265. adjacency_matrix(vertices_size_type n,
  266. const GraphProperty& p = GraphProperty())
  267. </pre>
  268. Creates a graph object with <tt>n</tt> vertices and zero edges.<br>
  269. (Required by <a href="MutableGraph.html">MutableGraph</a>.)
  270. <hr>
  271. <pre>
  272. template &lt;typename EdgeIterator&gt;
  273. adjacency_matrix(EdgeIterator first,
  274. EdgeIterator last,
  275. vertices_size_type n,
  276. const GraphProperty& p = GraphProperty())
  277. </pre>
  278. Creates a graph object with <tt>n</tt> vertices with the edges
  279. specified in the edge list given by the range <tt>[first, last)</tt>.
  280. The value type of the <tt>EdgeIterator</tt> must be a
  281. <tt>std::pair</tt>, where the type in the pair is an integer type. The
  282. integers will correspond to vertices, and they must all fall in the
  283. range of
  284. <tt>[0, n)</tt>. <br>
  285. (Required by <a href="IteratorConstructibleGraph.html">IteratorConstructibleGraph</a>.)
  286. <hr>
  287. <pre>
  288. template &lt;typename EdgeIterator, typename EdgePropertyIterator&gt;
  289. adjacency_matrix(EdgeIterator first, EdgeIterator last,
  290. EdgePropertyIterator ep_iter,
  291. vertices_size_type n,
  292. const GraphProperty& p = GraphProperty())
  293. </pre>
  294. Creates a graph object with <tt>n</tt> vertices, with the edges
  295. specified in the edge list given by the range <tt>[first, last)</tt>.
  296. The value type of the <tt>EdgeIterator</tt> must be a
  297. <tt>std::pair</tt>, where the type in the pair is an integer type. The
  298. integers will correspond to vertices, and they must all fall in the
  299. range of <tt>[0, n)</tt>. The <tt>value_type</tt> of the
  300. <tt>ep_iter</tt> should be <tt>EdgeProperty</tt>.
  301. <hr>
  302. <h3>Non-Member Functions</h3>
  303. <hr>
  304. <pre>
  305. std::pair&lt;vertex_iterator, vertex_iterator&gt;
  306. vertices(const adjacency_matrix&amp; g)
  307. </pre>
  308. Returns an iterator-range providing access to the vertex set of graph <tt>g</tt>.<br>
  309. (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)
  310. <hr>
  311. <pre>
  312. std::pair&lt;edge_iterator, edge_iterator&gt;
  313. edges(const adjacency_matrix&amp; g);
  314. </pre>
  315. Returns an iterator-range providing access to the edge set of graph <tt>g</tt>.<br>
  316. (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)
  317. <hr>
  318. <pre>
  319. std::pair&lt;adjacency_iterator, adjacency_iterator&gt;
  320. adjacent_vertices(vertex_descriptor v, const adjacency_matrix&amp; g)
  321. </pre>
  322. Returns an iterator-range providing access to the vertices adjacent to
  323. vertex <tt>v</tt> in graph <tt>g</tt>.<br>
  324. (Required by <a href="AdjacencyGraph.html">AdjacencyGraph</a>.)
  325. <hr>
  326. <pre>
  327. std::pair&lt;out_edge_iterator, out_edge_iterator&gt;
  328. out_edges(vertex_descriptor v, const adjacency_matrix&amp; g)
  329. </pre>
  330. Returns an iterator-range providing access to the out-edges of
  331. vertex <tt>v</tt> in graph <tt>g</tt>. If the graph is undirected,
  332. this iterator-range provides access to all edges incident on
  333. vertex <tt>v</tt>. <br>
  334. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  335. <hr>
  336. <pre>
  337. vertex_descriptor
  338. source(edge_descriptor e, const adjacency_matrix&amp; g)
  339. </pre>
  340. Returns the source vertex of edge <tt>e</tt>.<br>
  341. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  342. <hr>
  343. <pre>
  344. vertex_descriptor
  345. target(edge_descriptor e, const adjacency_matrix&amp; g)
  346. </pre>
  347. Returns the target vertex of edge <tt>e</tt>.<br>
  348. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  349. <hr>
  350. <pre>
  351. degree_size_type
  352. out_degree(vertex_descriptor u, const adjacency_matrix&amp; g)
  353. </pre>
  354. Returns the number of edges leaving vertex <tt>u</tt>.<br>
  355. (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
  356. <hr>
  357. <hr>
  358. <pre>
  359. std::pair&lt;in_edge_iterator, in_edge_iterator&gt;
  360. in_edges(vertex_descriptor v, const adjacency_matrix&amp; g)
  361. </pre>
  362. Returns an iterator-range providing access to the in-edges of
  363. vertex <tt>v</tt> in graph <tt>g</tt>. If the graph is undirected,
  364. this iterator-range provides access to all edges incident on
  365. vertex <tt>v</tt>. <br>
  366. (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
  367. <hr>
  368. <pre>
  369. degree_size_type
  370. in_degree(vertex_descriptor u, const adjacency_matrix&amp; g)
  371. </pre>
  372. Returns the number of edges entering vertex <tt>u</tt>.<br>
  373. (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
  374. <hr>
  375. <hr>
  376. <pre>
  377. vertices_size_type num_vertices(const adjacency_matrix&amp; g)
  378. </pre>
  379. Returns the number of vertices in the graph <tt>g</tt>.<br>
  380. (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)
  381. <hr>
  382. <pre>
  383. edges_size_type num_edges(const adjacency_matrix&amp; g)
  384. </pre>
  385. Returns the number of edges in the graph <tt>g</tt>.<br>
  386. (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)
  387. <hr>
  388. <pre>
  389. vertex_descriptor vertex(vertices_size_type n, const adjacency_matrix&amp; g)
  390. </pre>
  391. Returns the nth vertex in the graph's vertex list.
  392. <hr>
  393. <pre>
  394. std::pair&lt;edge_descriptor, bool&gt;
  395. edge(vertex_descriptor u, vertex_descriptor v,
  396. const adjacency_matrix&amp; g)
  397. </pre>
  398. Returns the edge connecting vertex <tt>u</tt> to vertex <tt>v</tt> in graph <tt>g</tt>.<br>
  399. (Required by <a href="AdjacencyMatrix.html">AdjacencyMatrix</a>.)
  400. <hr>
  401. <pre>
  402. std::pair&lt;edge_descriptor, bool&gt;
  403. add_edge(vertex_descriptor u, vertex_descriptor v,
  404. adjacency_matrix&amp; g)
  405. </pre>
  406. Adds edge <tt>(u,v)</tt> to the graph and returns the edge descriptor for
  407. the new edge. If the edge is already in the graph then a duplicate
  408. will not be added and the <tt>bool</tt> flag will be <tt>false</tt>.
  409. This operation does not invalidate any of the graph's iterators
  410. or descriptors.<br>
  411. (Required by <a href="MutableGraph.html">MutableGraph</a>.)
  412. <hr>
  413. <pre>
  414. std::pair&lt;edge_descriptor, bool&gt;
  415. add_edge(vertex_descriptor u, vertex_descriptor v,
  416. const EdgeProperty& p,
  417. adjacency_matrix&amp; g)
  418. </pre>
  419. Adds edge <tt>(u,v)</tt> to the graph and attaches <tt>p</tt> as the
  420. value of the edge's internal property storage. Also see the previous
  421. <tt>add_edge()</tt> member function for more details.
  422. <hr>
  423. <pre>
  424. void remove_edge(vertex_descriptor u, vertex_descriptor v,
  425. adjacency_matrix&amp; g)
  426. </pre>
  427. Removes the edge <tt>(u,v)</tt> from the graph. <br>
  428. (Required by <a href="MutableGraph.html">MutableGraph</a>.)
  429. <hr>
  430. <pre>
  431. void remove_edge(edge_descriptor e, adjacency_matrix&amp; g)
  432. </pre>
  433. Removes the edge <tt>e</tt> from the graph. This is equivalent
  434. to calling <tt>remove_edge(source(e, g), target(e, g), g)</tt>.<br>
  435. (Required by <a href="MutableGraph.html">MutableGraph</a>.)
  436. <hr>
  437. <pre>
  438. void clear_vertex(vertex_descriptor u, adjacency_matrix&amp; g)
  439. </pre>
  440. Removes all edges to and from vertex <tt>u</tt>. The vertex still appears
  441. in the vertex set of the graph.<br>
  442. (Required by <a href="MutableGraph.html">MutableGraph</a>.)
  443. <hr>
  444. <pre>
  445. template &lt;typename Property&gt;
  446. property_map&lt;adjacency_matrix, Property&gt;::type
  447. get(Property, adjacency_matrix&amp; g)
  448. template &lt;typename Property&gt;
  449. property_map&lt;adjacency_matrix, Property&gt;::const_type
  450. get(Property, const adjacency_matrix&amp; g)
  451. </pre>
  452. Returns the property map object for the vertex property specified by
  453. <tt>Property</tt>. The <tt>Property</tt> must match one of the
  454. properties specified in the graph's <tt>VertexProperty</tt> template
  455. argument.<br>
  456. (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
  457. <hr>
  458. <pre>
  459. template &lt;typename Property, typename X&gt;
  460. typename property_traits&lt;
  461. typename property_map&lt;adjacency_matrix, Property&gt;::const_type
  462. &gt;::value_type
  463. get(Property, const adjacency_matrix&amp; g, X x)
  464. </pre>
  465. This returns the property value for <tt>x</tt>, which is either
  466. a vertex or edge descriptor.<br>
  467. (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
  468. <hr>
  469. <pre>
  470. template &lt;typename Property, typename X, typename Value&gt;
  471. void
  472. put(Property, const adjacency_matrix&amp; g, X x, const Value& value)
  473. </pre>
  474. This sets the property value for <tt>x</tt> to
  475. <tt>value</tt>. <tt>x</tt> is either a vertex or edge descriptor.
  476. <tt>Value</tt> must be convertible to
  477. <tt>typename property_traits&lt;property_map&lt;adjacency_matrix, Property&gt;::type&gt;::value_type</tt>.<br>
  478. (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
  479. <hr>
  480. <pre>
  481. template &lt;typename GraphProperty, typename GraphProperty&gt;
  482. typename property_value&lt;GraphProperty, GraphProperty&gt;::type&amp;
  483. get_property(adjacency_matrix&amp; g, GraphProperty)
  484. </pre>
  485. Return the property specified by <tt>GraphProperty</tt> that is attached
  486. to the graph object <tt>g</tt>. The <tt>property_value</tt> traits class
  487. is defined in <tt>boost/pending/property.hpp</tt>.
  488. <hr>
  489. <pre>
  490. template &lt;typename GraphProperty, typename GraphProperty&gt;
  491. const typename property_value&lt;GraphProperty, GraphProperty&gt;::type&amp;
  492. get_property(const adjacency_matrix&amp; g, GraphProperty)
  493. </pre>
  494. Return the property specified by <tt>GraphProperty</tt> that is
  495. attached to the graph object <tt>g</tt>. The <tt>property_value</tt>
  496. traits class is defined in <tt>boost/pending/property.hpp</tt>.
  497. <hr>