CPSC 327 Data Structures and Algorithms Spring 2024

Comments on Homework 13

  1. Ski-o problem.

    If vertices represent controls and edges represent tracks between the controls, what about the track junctions? There's not just one track or route from one control to the next — there is a whole network of tracks, and the task is to figure out which tracks to take to get from one control to the next.

    Remember that the graph models the input to the problem; an algorithm applied to that graph produces the solution. Design the graph to capture what is necessary to solve the problem. Thinking about how a solution might be represented in the graph can be useful in considering how to represent the problem, but be careful not to build the graph to represent only the solution. For example, identifying that the desired solution is a sequence of things suggests that in the graph, vertices represent things and edges represent when it is possible to go from one thing to the next.

    All of the questions about graph properties (sparse vs dense, simple, etc) are about the whole graph (which represents the input), not just the solution (or a graph built to represent the solution).

    Sparse vs dense is about vertex degree — how many other vertices each vertex connects to. Is that generally a small number relative to n, or closer to n? It isn't about how spread out the vertices are when the graph is drawn on the page.

    Simple is about not having self-loops (a edge connecting a vertex to itself) or multiedges (more than one undirected edge or multiple directed edges in the same direction between the same pair of vertices). "Only 1 edge per vertex" is a statement about degree (each vertex connects to one other), not about simplicity. "Only 1 edge per pair of vertices" is about simplicity, as it is saying that there are no multiedges.

    Embedded vs topological and implicit vs explicit weren't asked about, but the graph would be explicit if vertices having an edge between them is how it is known that those vertices are connected. A graph can be implicit if connectivity can be computed in some way other than explicitly storing an edge.