Sample

int-e979b25f6ce0-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines47

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Scalabrino0.5440–1; higher is more readable
Dorn0.3220–1; higher is more readable
Mi0.0340–1; higher is more readable
LLOC12Logical lines; fewer is more readable
DeepSeek V4 Pro60–20; mean of three runs
GPT-6.1 Sol14.330–20; mean of three runs
BTTF0.530–1; higher is more readable

Views

Source code

package com.google.common.graph; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Set; import org.jspecify.annotations.Nullable; /** * An interface for representing and manipulating an origin node's adjacent nodes and incident edges * in a {@link Network}. * * @author James Sexton * @param <N> Node parameter type * @param <E> Edge parameter type */ interface NetworkConnections<N, E> { Set<N> adjacentNodes(); Set<N> predecessors(); Set<N> successors(); Set<E> incidentEdges(); Set<E> inEdges(); Set<E> outEdges(); /** * Returns the set of edges connecting the origin node to {@code node}. For networks without * parallel edges, this set cannot be of size greater than one. */ Set<E> edgesConnecting(N node); /** * Returns the node that is adjacent to the origin node along {@code edge}. * * <p>In the directed case, {@code edge} is assumed to be an outgoing edge. */ N adjacentNode(E edge); /** * Remove {@code edge} from the set of incoming edges. Returns the former predecessor node. * * <p>In the undirected case, returns {@code null} if {@code isSelfLoop} is true. */ @CanIgnoreReturnValue @Nullable N removeInEdge(E edge, boolean isSelfLoop); /** Remove {@code edge} from the set of outgoing edges. Returns the former successor node. */ @CanIgnoreReturnValue N removeOutEdge(E edge); /** * Add {@code edge} to the set of incoming edges. Implicitly adds {@code node} as a predecessor. */ void addInEdge(E edge, N node, boolean isSelfLoop); /** Add {@code edge} to the set of outgoing edges. Implicitly adds {@code node} as a successor. */ void addOutEdge(E edge, N node); }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.840.254−27.728
Source linesThe number of non-empty source lines.47+18.8
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.668−7.001

Intercept 8.87 + feature contributions = -7.06 (log-odds).
Score = sigmoid(-7.06) = 0.001.

Score0.544

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.175−3.747
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.175+2.019
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.047+0.487
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.46.886+0.246
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197

Intercept 0.07 + feature contributions = -0.746 (log-odds).
Score = sigmoid(-0.746) = 0.322.

Score0.034
Score12
Run 1

The code is an interface with relatively simple methods, but formatting choices severely harm readability. Multiple methods appear on the same line (e.g., predecessors() and successors()), making the structure feel tangled and creating unnaturally high information density. Nesting is not a major issue (it is an interface), but the flow is disrupted by method declarations being squashed together and Javadoc comments being placed on the same line as annotations or code. Action granularity is violated: several logical declarations occupy a single line. The intent of individual methods is mostly clear from names, but the overall messy layout obscures the interface's purpose. While the code is not deeply nested or excessively long, the poor formatting and disorganized reading flow make it difficult to scan quickly. Overall, it falls well below average readability, earning a low score despite straightforward content.

Run 2

The code has several readability issues. Methods like predecessors() and successors() are crammed onto one line, making it harder to scan. Javadoc comments are merged with method declarations in a few places, which obscures the separation between documentation and code. 'Reading flow' feels disjointed and unnatural. However, method names are clear and the interface declares logical operations. The lack of whitespace and inconsistent formatting significantly reduce readability.

Run 3

The code is poorly structured with inconsistent indentation, collapsed method definitions, and cramped spacing. Methods like `Set<N> predecessors(); Set<N> successors();` are placed on the same line, violating one-action-per-line. Javadoc and annotations are compressed into single lines with method signatures, making the code hard to scan. Imports lack spacing, and the interface body is inconsistently formatted. While the method names are reasonably clear, the overall layout disrupts reading flow and obscures intent. Deep documentation merging reduces clarity despite the relatively flat nesting. Concise? Yes, but at the expense of readability.

Run 1

Code Structure: The interface logically groups node queries, edge queries, and mutation methods, though cramped formatting weakens separation. Nesting: Flat method declarations with no nested control flow make it easy to scan. Clarity of intent: Descriptive method names, types, and useful Javadoc clearly convey purpose and edge-case behavior. Code length: Concise and appropriate for an interface, without unnecessary implementation detail. Action granularity: Several declarations, annotations, comments, and closing braces share lines, obscuring individual elements. Reading flow: The overall ordering is natural, but inconsistent line breaks and comments attached to imports or preceding declarations interrupt reading.

Run 2

Code Structure: The interface logically groups node queries, edge queries, and mutation operations. Nesting: Flat declarations with no nested control flow make it easy to scan. Clarity of intent: Descriptive method names, generic types, and useful documentation clearly convey purpose and behavior. Code length: Concise and appropriate for an interface, with little unnecessary content. Action granularity: Several method declarations, annotations, and documentation boundaries share lines, reducing visual separation. Reading flow: The conceptual ordering is natural, but inconsistent formatting—such as Javadoc starting beside an import, declarations following comment endings, and the closing brace sharing a method line—interrupts scanning. Consistent line breaks and spacing would substantially improve readability.

Run 3

Code Structure: The interface logically groups adjacency queries, edge queries, and mutation methods, but inconsistent formatting weakens visual organization. Nesting: Flat declarations with no nested control flow make scanning easy. Clarity of intent: Descriptive method names, generic types, and useful documentation clearly convey graph operations and special cases. Code length: Concise and appropriate for an interface, with no unnecessary implementation detail. Action granularity: Several declarations, annotations, comments, and closing braces share lines, notably predecessors/successors and the removal methods, obscuring method boundaries. Reading flow: The ordering is natural, but comments attached to imports or declarations and compressed annotation placement interrupt smooth reading. Conventional line breaks and consistent spacing would substantially improve readability.