Review before applying
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
SpanSorbus is a Windows workspace for reviewing connectivity code with a compatible model. Follow an edge through a proposed bridge-finding routine and check its effect on the actual graph fixture.
def bridge_edges(n, edges):
if type(n) is not int or not 0 <= n <= 32:
raise ValueError("vertex count")
if type(edges) is not list or len(edges) > 496:
raise ValueError("edge count")
graph = [set() for _ in range(n)]
for edge in edges:
if type(edge) is not tuple or len(edge) != 2 or any(
type(x) is not int or not 0 <= x < n for x in edge):
raise ValueError("edge endpoints")
a, b = edge
if a == b or b in graph[a]:
raise ValueError("simple undirected edges")
graph[a].add(b); graph[b].add(a)
timer, found = 0, []
entered, low = [-1] * n, [0] * n
def visit(v, parent):
nonlocal timer
entered[v] = low[v] = timer; timer += 1
for u in sorted(graph[v]):
if u == parent:
continue
if entered[u] < 0:
visit(u, v); low[v] = min(low[v], low[u])
if low[u] > entered[v]:
found.append(tuple(sorted((v, u))))
else:
low[v] = min(low[v], entered[u])
for v in range(n):
if entered[v] < 0:
visit(v, -1)
return sorted(found)Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
Base URL, credentials and a reachable server.
Test disconnected components and cycles, rejecting duplicate edges, self-loops and invalid endpoints without changing the input.
def bridge_edges(n, edges):
if type(n) is not int or not 0 <= n <= 32:
raise ValueError("vertex count")
if type(edges) is not list or len(edges) > 496:
raise ValueError("edge count")
graph = [set() for _ in range(n)]
for edge in edges:
if type(edge) is not tuple or len(edge) != 2 or any(
type(x) is not int or not 0 <= x < n for x in edge):
raise ValueError("edge endpoints")
a, b = edge
if a == b or b in graph[a]:
raise ValueError("simple undirected edges")
graph[a].add(b); graph[b].add(a)
timer, found = 0, []
entered, low = [-1] * n, [0] * n
def visit(v, parent):
nonlocal timer
entered[v] = low[v] = timer; timer += 1
for u in sorted(graph[v]):
if u == parent:
continue
if entered[u] < 0:
visit(u, v); low[v] = min(low[v], low[u])
if low[u] > entered[v]:
found.append(tuple(sorted((v, u))))
else:
low[v] = min(low[v], entered[u])
for v in range(n):
if entered[v] < 0:
visit(v, -1)
return sorted(found)SpanSorbus is a Windows coding workspace for examining connectivity logic in the context of real source files. Start by describing the decision your application makes from the graph result. Ask the connected model to inspect the input representation and its consumer before requesting a change to the traversal or output.
A useful task might use bridge_edges.py to investigate an edge whose removal separates a connected part of a fixture. Include a graph with a cycle as a comparison and state the expected edge list. Review the simple, undirected graph assumptions alongside the implementation, so the proposed change does not quietly accept a different kind of input.
The software work continues after the routine returns. Inspect how the caller names nodes, presents edges and handles rejected data, then run your project checks with disconnected and empty fixtures. Keep the review tied to those observable outcomes. A correct graph explanation does not establish that the application maps its actual data into the expected representation.
SpanSorbus connects through supported OpenAI-compatible or Anthropic endpoints with credentials when required. Choose an uncensored AI model where the endpoint provides one, while checking the provider’s restrictions and available tools. Context limits depend on the model and server, so supply a bounded fixture and the relevant consumers for a focused coding conversation.
Check the precise graph definition and the decision your application is making. Use a fixture with the expected result written independently. Review the code’s assumptions about direction, parallel edges and self-loops before transferring an informal graph explanation into a software requirement.
The application may contain several separate components, each with its own relevant edges. A traversal that starts from one node can miss the others. Include a fixture with more than one component and compare the complete output, not only the first expected edge.
Inspect the accepted-input contract first. The example expects a simple graph and rejects duplicates. If imported data contains repeated edges, decide whether the importer should normalize it or report an error before asking for changes to the graph routine.
Define the mapping between internal node identifiers and user-visible labels, plus any ordering needed for stable output. Review those mappings with the proposed edit. A correct internal edge pair can still become a misleading result if the caller associates it with the wrong labels.
SpanSorbus · Updated 2026-10-25