<｜begin▁of▁sentence｜>### Instruction:
Imagine stepping into a quiet library, where a local computer science club has donated a special collection of documents outlining the structure of various interconnected systems. In one fascinating document—let's think of it as the "GML file" of our situation—we find a simple illustration representing a linear series of connected points, akin to volumes on a shelf. This sequence is known among network enthusiasts as a path graph, akin to a very orderly range of books numbered 0 through 3.

Now, a curious researcher—much like yourself—may ponder on reorganizing this linear collection to achieve a more efficient layout, one that minimizes the maximum distance between any two connected volumes when referred to on a matrix representation. In the language of the digital world, we seek to reconfigure the nodes of a graph created by `networkx.path_graph(4)` to obtain an adjacency matrix with reduced bandwidth, employing a method known as the Cuthill-McKee algorithm.

Furthermore, let's say the library club wishes to apply a certain savvy intuition to this task. They propose starting this reconfiguration by choosing the volume, or "node," which boasts the fewest connections, a tactic akin to selecting the least-read book to be placed at the core of the system. This heuristic, favoring the node with the smallest degree, might just streamline the entire process. How, then, can one implement this strategy in our scenario to rearrange our linear collection for the better?
### Response:
import networkx as nx
from networkx.utils import cuthill_mckee_ordering

# Create a path graph
G = nx.path_graph(4)

# Get the Cuthill-McKee ordering of nodes
rcm = list(cuthill_mckee_ordering(G))

# Optional: Create an adjacency matrix using the RCM order
A = nx.adjacency_matrix(G, nodelist=rcm)

# Print the RCM node ordering
print('Cuthill-McKee ordering:', rcm)

# Print the adjacency matrix
print('Adjacency matrix:\n', A.todense())

# Define a heuristic function to choose the smallest degree node
def smallest_degree(G):
    return min(G, key=G.degree)

# Apply the Cuthill-McKee ordering with the smallest degree heuristic
rcm_with_heuristic = list(cuthill_mckee_ordering(G, heuristic=smallest_degree))

# Print the RCM node ordering with heuristic
print('Cuthill-McKee ordering with heuristic:', rcm_with_heuristic)
<|EOT|>
