reset password
Author Message
rabbott
Posts: 1649
Posted 13:11 Mar 14, 2020 |

It's a difficult time for all of us. We must stay aware of ongoing developments. At the same time obsessing about them adds stress to our lives -- while also weakening our immune systems. With that in mind, here's something to think about that's not COVID-19.

What would graphs with 0, 1, or 2 nodes look like? Presumably, a graph with no nodes is simply no nodes. That 's easy. (Will your program work properly when the user asks for a ring, star, or wheel with 0 nodes?) How about 1 node? What is a ring with one node? What about a wheel or a star with one node? What about any of these with two nodes? It's an interesting challenge to think about how to write code so that it deals with these situations correctly.

RandomAccess
Posts: 101
Posted 19:04 Mar 14, 2020 |

Wouldn't a ring graph with one node just be a node linked to itself?

rabbott
Posts: 1649
Posted 19:38 Mar 14, 2020 |

A link must have two distinct nodes at its end. Links aren't allowed to link a node to itself. In NetLog (and because PyLogo copies NetLogo conventions in PyLogo), attempting to link a node to itself produces an error message.

Last edited by rabbott at 21:04 Mar 14, 2020.
RandomAccess
Posts: 101
Posted 21:37 Mar 14, 2020 |

This sounds like it would mean a graph with only one node would be identical to all one node graphs regardless of the orientation set up

rabbott
Posts: 1649
Posted 21:51 Mar 14, 2020 |

More or less. A one-node wheel is identical to a one-node star. They are both a single node positioned in the center of the screen.  A one-node ring is identical to a one-node random graph. They are both a single node positioned at the top of the ring. So in both cases, you have only one node, but they are (initially) positioned in different places.