Connection
Base URL, credentials and a reachable server.
Hopwise keeps graph code and its review conversation together in a Windows AI workspace. Select a compatible model and trace a breadth-first traversal, checking how the proposed implementation distinguishes unreachable vertices from the starting vertex.
from collections import deque
def hop_distances(graph, start):
if type(graph) is not list or not 1 <= len(graph) <= 1000:
raise ValueError("graph.size")
n = len(graph)
if type(start) is not int or not 0 <= start < n:
raise ValueError("graph.start")
if any(type(row) is not list or any(type(v) is not int or
not 0 <= v < n for v in row) for row in graph):
raise ValueError("graph.edges")
distances = [None]*n
distances[start] = 0
queue = deque([start])
while queue:
u = queue.popleft()
for v in graph[u]:
if distances[v] is None:
distances[v] = distances[u]+1
queue.append(v)
return distancesBase URL, credentials and a reachable server.
Check cycles, repeated edges and unreachable vertices, rejecting an empty graph or invalid endpoints before traversal.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
from collections import deque
def hop_distances(graph, start):
if type(graph) is not list or not 1 <= len(graph) <= 1000:
raise ValueError("graph.size")
n = len(graph)
if type(start) is not int or not 0 <= start < n:
raise ValueError("graph.start")
if any(type(row) is not list or any(type(v) is not int or
not 0 <= v < n for v in row) for row in graph):
raise ValueError("graph.edges")
distances = [None]*n
distances[start] = 0
queue = deque([start])
while queue:
u = queue.popleft()
for v in graph[u]:
if distances[v] is None:
distances[v] = distances[u]+1
queue.append(v)
return distancesA graph result is useful only when the caller understands what each value means. Hopwise gives graph-related code a Windows AI coding workspace, linking the source to a conversation about its contract. Start with the input representation and the way the application displays or uses the result, rather than asking for an isolated algorithm replacement.
For a shortest-hop task, show a small directed graph with both reachable and unreachable vertices. Ask the connected model to inspect how the implementation distinguishes the starting vertex from a vertex with no path. Include a cycle so the review considers repeated discovery as well as the simplest forward chain.
Next, inspect the boundary where graph data enters the function. Invalid vertex references should follow a deliberate policy, and direction must match the application’s meaning of an edge. Review proposed edits with the consuming code, then run fixtures that assert exact results for each vertex. Keep unreachable-state handling visible in the interface after the calculation.
Hopwise supports compatible OpenAI-compatible or Anthropic endpoints, including an available uncensored AI model. Actual response behavior, context limits and tools depend on that configuration. The workspace supports the investigation; evidence from your graph fixtures and integration tests determines whether the change is ready to keep.
Choose a small directed example with a cycle, an unreachable vertex and a clearly identified start. Write the expected result for each vertex. This makes direction and missing-path semantics easier to inspect than a large production graph.
Zero describes the starting vertex’s distance to itself, while unreachable means no path was found under the graph contract. If callers conflate them, an interface can show a nonexistent connection. Review the return representation and its consumers together.
Only when every edge represents the same cost for the purpose of the task. If weights matter, explain that requirement before requesting changes. A shortest-hop implementation should not be presented as satisfying a different optimization objective.
Set the policy at the input boundary and examine existing callers. Ask the model to preserve a clear rejection or validation path. Tests should include malformed references so accidental indexing behavior does not become the application contract.
Hopwise · Updated 2026-10-25