# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1269341571 -3600
# Node ID f17430f5f6f16cd7968ddd265b53d545d69408f0
# Parent 9de022253f37a53a8319d6964e4113db7988ac21
#8513: small fixes in the docstrings of generic graph and undirected graph classes
diff -r 9de022253f37 -r f17430f5f6f1 sage/graphs/generic_graph.py
a
|
b
|
|
2916 | 2916 | itself has no cut vertices. Two distinct blocks cannot overlap in |
2917 | 2917 | more than a single cut vertex. |
2918 | 2918 | |
2919 | | OUTPUT: ( B, C ), where B is a list of blocks- each is a list of |
2920 | | vertices and the blocks are the corresponding induced subgraphs- |
2921 | | and C is a list of cut vertices. |
| 2919 | OUTPUT: ``( B, C )``, where ``B`` is a list of blocks- each is |
| 2920 | a list of vertices and the blocks are the corresponding induced |
| 2921 | subgraphs-and ``C`` is a list of cut vertices. |
2922 | 2922 | |
2923 | 2923 | EXAMPLES:: |
2924 | 2924 | |
… |
… |
|
2949 | 2949 | ... |
2950 | 2950 | NotImplementedError: ... |
2951 | 2951 | |
2952 | | ALGORITHM: 8.3.8 in [1]. Notice that the termination condition on |
2953 | | line (23) of the algorithm uses "p[v] == 0" which in the book |
2954 | | means that the parent is undefined; in this case, v must be the |
2955 | | root s. Since our vertex names start with 0, we substitute instead |
2956 | | the condition "v == s". This is the terminating condition used |
| 2952 | ALGORITHM: 8.3.8 in [Jungnickel05]_. Notice that the termination condition on |
| 2953 | line (23) of the algorithm uses ``p[v] == 0`` which in the book |
| 2954 | means that the parent is undefined; in this case, `v` must be the |
| 2955 | root `s`. Since our vertex names start with `0`, we substitute instead |
| 2956 | the condition ``v == s``. This is the terminating condition used |
2957 | 2957 | in the general Depth First Search tree in Algorithm 8.2.1. |
2958 | 2958 | |
2959 | 2959 | REFERENCE: |
2960 | 2960 | |
2961 | | - [1] D. Jungnickel, Graphs, Networks and Algorithms, |
| 2961 | .. [Jungnickel05] D. Jungnickel, Graphs, Networks and Algorithms, |
2962 | 2962 | Springer, 2005. |
2963 | 2963 | """ |
2964 | 2964 | if not self: # empty graph |
… |
… |
|
3826 | 3826 | |
3827 | 3827 | This function returns a list of such paths. |
3828 | 3828 | |
3829 | | NOTE: |
3830 | | |
3831 | | This function is topological : it does not take the eventual |
3832 | | weights of the edges into account. |
| 3829 | .. NOTE:: |
| 3830 | |
| 3831 | This function is topological : it does not take the eventual |
| 3832 | weights of the edges into account. |
3833 | 3833 | |
3834 | 3834 | EXAMPLE: |
3835 | 3835 | |
… |
… |
|
6583 | 6583 | ordered list. |
6584 | 6584 | |
6585 | 6585 | The clustering coefficient of a graph is the fraction of possible |
6586 | | triangles that are triangles, c_i = triangles_i / |
6587 | | (k_i\*(k_i-1)/2) where k_i is the degree of vertex i, [1]. A |
6588 | | coefficient for the whole graph is the average of the c_i. |
| 6586 | triangles that are triangles, `c_i = triangles_i / |
| 6587 | (k_i\*(k_i-1)/2)` where `k_i` is the degree of vertex `i`, [1]. A |
| 6588 | coefficient for the whole graph is the average of the `c_i`. |
6589 | 6589 | Transitivity is the fraction of all possible triangles which are |
6590 | 6590 | triangles, T = 3\*triangles/triads, [HSSNX]_. |
6591 | 6591 | |
… |
… |
|
6622 | 6622 | Returns the average clustering coefficient. |
6623 | 6623 | |
6624 | 6624 | The clustering coefficient of a graph is the fraction of possible |
6625 | | triangles that are triangles, c_i = triangles_i / |
6626 | | (k_i\*(k_i-1)/2) where k_i is the degree of vertex i, [1]. A |
6627 | | coefficient for the whole graph is the average of the c_i. |
| 6625 | triangles that are triangles, `c_i = triangles_i / |
| 6626 | (k_i\*(k_i-1)/2)` where `k_i` is the degree of vertex `i`, [1]. A |
| 6627 | coefficient for the whole graph is the average of the `c_i`. |
6628 | 6628 | Transitivity is the fraction of all possible triangles which are |
6629 | 6629 | triangles, T = 3\*triangles/triads, [1]. |
6630 | 6630 | |
… |
… |
|
6648 | 6648 | ordered list. |
6649 | 6649 | |
6650 | 6650 | The clustering coefficient of a graph is the fraction of possible |
6651 | | triangles that are triangles, c_i = triangles_i / |
6652 | | (k_i\*(k_i-1)/2) where k_i is the degree of vertex i, [1]. A |
6653 | | coefficient for the whole graph is the average of the c_i. |
| 6651 | triangles that are triangles, `c_i = triangles_i / |
| 6652 | (k_i\*(k_i-1)/2)` where `k_i` is the degree of vertex `i`, [1]. A |
| 6653 | coefficient for the whole graph is the average of the `c_i`. |
6654 | 6654 | Transitivity is the fraction of all possible triangles which are |
6655 | 6655 | triangles, T = 3\*triangles/triads, [1]. |
6656 | 6656 | |
… |
… |
|
6697 | 6697 | graph. |
6698 | 6698 | |
6699 | 6699 | The clustering coefficient of a graph is the fraction of possible |
6700 | | triangles that are triangles, c_i = triangles_i / |
6701 | | (k_i\*(k_i-1)/2) where k_i is the degree of vertex i, [1]. A |
6702 | | coefficient for the whole graph is the average of the c_i. |
| 6700 | triangles that are triangles, `c_i = triangles_i / |
| 6701 | (k_i\*(k_i-1)/2)` where `k_i` is the degree of vertex `i`, [1]. A |
| 6702 | coefficient for the whole graph is the average of the `c_i`. |
6703 | 6703 | Transitivity is the fraction of all possible triangles which are |
6704 | 6704 | triangles, T = 3\*triangles/triads, [1]. |
6705 | 6705 | |
6706 | 6706 | REFERENCE: |
6707 | 6707 | |
6708 | | - [1] Aric Hagberg, Dan Schult and Pieter Swart. NetworkX |
| 6708 | .. [1] Aric Hagberg, Dan Schult and Pieter Swart. NetworkX |
6709 | 6709 | documentation. [Online] Available: |
6710 | 6710 | https://networkx.lanl.gov/reference/networkx/ |
6711 | 6711 | |
… |
… |
|
8526 | 8526 | """ |
8527 | 8527 | Returns the Cartesian product of self and other. |
8528 | 8528 | |
8529 | | The Cartesian product of G and H is the graph L with vertex set |
8530 | | V(L) equal to the Cartesian product of the vertices V(G) and V(H), |
8531 | | and ((u,v), (w,x)) is an edge iff either - (u, w) is an edge of |
8532 | | self and v = x, or - (v, x) is an edge of other and u = w. |
| 8529 | The Cartesian product of `G` and `H` is the graph `L` with vertex set |
| 8530 | `V(L)` equal to the Cartesian product of the vertices `V(G)` and `V(H)`, |
| 8531 | and `((u,v), (w,x))` is an edge iff either - `(u, w)` is an edge of |
| 8532 | self and `v = x`, or - `(v, x)` is an edge of other and `u = w`. |
8533 | 8533 | |
8534 | 8534 | EXAMPLES:: |
8535 | 8535 | |
… |
… |
|
8573 | 8573 | Returns the tensor product, also called the categorical product, of |
8574 | 8574 | self and other. |
8575 | 8575 | |
8576 | | The tensor product of G and H is the graph L with vertex set V(L) |
8577 | | equal to the Cartesian product of the vertices V(G) and V(H), and |
8578 | | ((u,v), (w,x)) is an edge iff - (u, w) is an edge of self, and - |
8579 | | (v, x) is an edge of other. |
| 8576 | The tensor product of `G` and `H` is the graph `L` with vertex set `V(L)` |
| 8577 | equal to the Cartesian product of the vertices `V(G)` and `V(H)`, and |
| 8578 | `((u,v), (w,x))` is an edge iff - `(u, w)` is an edge of self, and - |
| 8579 | `(v, x)` is an edge of other. |
8580 | 8580 | |
8581 | 8581 | EXAMPLES:: |
8582 | 8582 | |
diff -r 9de022253f37 -r f17430f5f6f1 sage/graphs/graph.py
a
|
b
|
|
1411 | 1411 | as a Graph object. |
1412 | 1412 | - When no solution exists, returns ``False`` |
1413 | 1413 | |
1414 | | NOTES: |
| 1414 | .. NOTE:: |
1415 | 1415 | |
1416 | | - This algorithm computes the degree-constrained subgraph of minimum weight. |
1417 | | - If the graph's edges are weighted, these are taken into account. |
1418 | | - This problem can be solved in polynomial time. |
| 1416 | - This algorithm computes the degree-constrained subgraph of minimum weight. |
| 1417 | - If the graph's edges are weighted, these are taken into account. |
| 1418 | - This problem can be solved in polynomial time. |
1419 | 1419 | |
1420 | 1420 | EXAMPLES: |
1421 | 1421 | |
… |
… |
|
1491 | 1491 | |
1492 | 1492 | A digraph representing an orientation of the current graph. |
1493 | 1493 | |
1494 | | NOTES: |
| 1494 | .. NOTE:: |
1495 | 1495 | |
1496 | | - This method assumes the graph is connected. |
1497 | | - This algorithm works in O(m). |
| 1496 | - This method assumes the graph is connected. |
| 1497 | - This algorithm works in O(m). |
1498 | 1498 | |
1499 | 1499 | EXAMPLE: |
1500 | 1500 | |
… |
… |
|
2163 | 2163 | by a list of vertices. A clique is an induced complete subgraph, and a |
2164 | 2164 | maximal clique is one not contained in a larger one. |
2165 | 2165 | |
2166 | | NOTES: |
| 2166 | .. NOTE:: |
2167 | 2167 | |
2168 | | - Currently only implemented for undirected graphs. Use to_undirected |
2169 | | to convert a digraph to an undirected graph. |
| 2168 | Currently only implemented for undirected graphs. Use to_undirected |
| 2169 | to convert a digraph to an undirected graph. |
2170 | 2170 | |
2171 | 2171 | ALGORITHM: |
2172 | 2172 | |
… |
… |
|
2223 | 2223 | by a list of vertices. A clique is an induced complete subgraph, and a |
2224 | 2224 | maximum clique is one of maximal order. |
2225 | 2225 | |
2226 | | NOTES: |
| 2226 | .. NOTE:: |
2227 | 2227 | |
2228 | | - Currently only implemented for undirected graphs. Use to_undirected |
2229 | | to convert a digraph to an undirected graph. |
| 2228 | Currently only implemented for undirected graphs. Use to_undirected |
| 2229 | to convert a digraph to an undirected graph. |
2230 | 2230 | |
2231 | 2231 | ALGORITHM: |
2232 | 2232 | |
… |
… |
|
2262 | 2262 | """ |
2263 | 2263 | Returns the vertex set of a maximal order complete subgraph. |
2264 | 2264 | |
2265 | | NOTE: |
| 2265 | .. NOTE:: |
2266 | 2266 | |
2267 | | - Currently only implemented for undirected graphs. Use to_undirected |
2268 | | to convert a digraph to an undirected graph. |
| 2267 | Currently only implemented for undirected graphs. Use to_undirected |
| 2268 | to convert a digraph to an undirected graph. |
2269 | 2269 | |
2270 | 2270 | ALGORITHM: |
2271 | 2271 | |
… |
… |
|
2289 | 2289 | Returns the order of the largest clique of the graph (the clique |
2290 | 2290 | number). |
2291 | 2291 | |
2292 | | NOTE: |
| 2292 | .. NOTE:: |
2293 | 2293 | |
2294 | | - Currently only implemented for undirected graphs. Use ``to_undirected`` |
2295 | | to convert a digraph to an undirected graph. |
| 2294 | Currently only implemented for undirected graphs. Use ``to_undirected`` |
| 2295 | to convert a digraph to an undirected graph. |
2296 | 2296 | |
2297 | 2297 | INPUT: |
2298 | 2298 | |
… |
… |
|
2334 | 2334 | Returns a list of the number of maximal cliques containing each |
2335 | 2335 | vertex. (Returns a single value if only one input vertex). |
2336 | 2336 | |
2337 | | NOTES: |
| 2337 | .. NOTE:: |
2338 | 2338 | |
2339 | | - Currently only implemented for undirected graphs. Use to_undirected |
2340 | | to convert a digraph to an undirected graph. |
| 2339 | Currently only implemented for undirected graphs. Use to_undirected |
| 2340 | to convert a digraph to an undirected graph. |
2341 | 2341 | |
2342 | 2342 | INPUT: |
2343 | 2343 | |
… |
… |
|
2387 | 2387 | edges between maximal cliques with common members in the original |
2388 | 2388 | graph. |
2389 | 2389 | |
2390 | | NOTES: |
| 2390 | .. NOTE:: |
2391 | 2391 | |
2392 | | - Currently only implemented for undirected graphs. Use to_undirected |
2393 | | to convert a digraph to an undirected graph. |
| 2392 | Currently only implemented for undirected graphs. Use to_undirected |
| 2393 | to convert a digraph to an undirected graph. |
2394 | 2394 | |
2395 | 2395 | INPUT: |
2396 | 2396 | |
… |
… |
|
2417 | 2417 | graph. Right and left vertices are connected if the bottom vertex |
2418 | 2418 | belongs to the clique represented by a top vertex. |
2419 | 2419 | |
2420 | | NOTES: |
| 2420 | .. NOTE:: |
2421 | 2421 | |
2422 | | - Currently only implemented for undirected graphs. Use to_undirected |
2423 | | to convert a digraph to an undirected graph. |
| 2422 | Currently only implemented for undirected graphs. Use to_undirected |
| 2423 | to convert a digraph to an undirected graph. |
2424 | 2424 | |
2425 | 2425 | EXAMPLES:: |
2426 | 2426 | |
… |
… |
|
2442 | 2442 | Returns a maximal independent set, which is a set of vertices which |
2443 | 2443 | induces an empty subgraph. Uses Cliquer [NisOst2003]_. |
2444 | 2444 | |
2445 | | NOTES: |
| 2445 | .. NOTE:: |
2446 | 2446 | |
2447 | | - Currently only implemented for undirected graphs. Use to_undirected |
2448 | | to convert a digraph to an undirected graph. |
| 2447 | Currently only implemented for undirected graphs. Use to_undirected |
| 2448 | to convert a digraph to an undirected graph. |
2449 | 2449 | |
2450 | 2450 | EXAMPLES:: |
2451 | 2451 | |
… |
… |
|
2462 | 2462 | Returns a list of sizes of the largest maximal cliques containing |
2463 | 2463 | each vertex. (Returns a single value if only one input vertex). |
2464 | 2464 | |
2465 | | NOTES: |
| 2465 | .. NOTE:: |
2466 | 2466 | |
2467 | | - Currently only implemented for undirected graphs. Use to_undirected |
2468 | | to convert a digraph to an undirected graph. |
| 2467 | Currently only implemented for undirected graphs. Use to_undirected |
| 2468 | to convert a digraph to an undirected graph. |
2469 | 2469 | |
2470 | 2470 | INPUT: |
2471 | 2471 | |
… |
… |
|
2535 | 2535 | Returns the cliques containing each vertex, represented as a list |
2536 | 2536 | of lists. (Returns a single list if only one input vertex). |
2537 | 2537 | |
2538 | | NOTE: |
| 2538 | .. NOTE:: |
2539 | 2539 | |
2540 | | - Currently only implemented for undirected graphs. Use to_undirected |
2541 | | to convert a digraph to an undirected graph. |
| 2540 | Currently only implemented for undirected graphs. Use to_undirected |
| 2541 | to convert a digraph to an undirected graph. |
2542 | 2542 | |
2543 | 2543 | INPUT: |
2544 | 2544 | |