(m, n, create_using=None)
| 267 | @nodes_or_number([0, 1]) |
| 268 | @patch_docstring(nxa.lollipop_graph) |
| 269 | def lollipop_graph(m, n, create_using=None): |
| 270 | m, m_nodes = m |
| 271 | n, n_nodes = n |
| 272 | M = len(m_nodes) |
| 273 | N = len(n_nodes) |
| 274 | if isinstance(m, int): |
| 275 | n_nodes = [len(m_nodes) + i for i in n_nodes] |
| 276 | if M < 2: |
| 277 | raise NetworkXError("Invalid graph description, m should be >=2") |
| 278 | if N < 0: |
| 279 | raise NetworkXError("Invalid graph description, n should be >=0") |
| 280 | |
| 281 | # the ball |
| 282 | G = complete_graph(m_nodes, create_using) |
| 283 | if G.is_directed(): |
| 284 | raise NetworkXError("Directed Graph not supported") |
| 285 | # the stick |
| 286 | G.add_nodes_from(n_nodes) |
| 287 | if N > 1: |
| 288 | G.add_edges_from(pairwise(n_nodes)) |
| 289 | # connect ball to stick |
| 290 | if M > 0 and N > 0: |
| 291 | G.add_edge(m_nodes[-1], n_nodes[0]) |
| 292 | return G |
| 293 | |
| 294 | |
| 295 | @patch_docstring(nxa.null_graph) |
nothing calls this directly
no test coverage detected