Buggy code:
public class GraphData { private List < GraphVertex > vertices = new ArrayList < GraphVertex > ( ) ; private Map < String , GraphVertex > nameToVertex = new HashMap < String , GraphVertex > ( ) ; private List < GraphEdge > edges = new ArrayList < GraphEdge > ( ) ; private Relation tuples = new Relation ( ) ; private Map < String , Map < GraphVertex , Set < GraphEdge > > > adjacentCache = null ; private Map < String , Map < GraphVertex , Set < GraphEdge > > > adjacentCacheUndirected = null ; private float degreeMax = 0 ; private float degreeOutMax = 0 ; private DefaultListModel groups = new DefaultListModel ( ) ; private Group defaultGroup ; private String [ ] indexToGroupName = null ; protected Collection < GraphEventListener > onGraphChangeListeners = new ArrayList < GraphEventListener > ( ) ; @ Override public GraphData clone ( ) { } public void setVertices ( List < GraphVertex > vertices ) { } public List < GraphVertex > getVertices ( ) { } public GraphVertex getVertexByName ( String vertexName ) { } public void insertVertex ( GraphVertex vertex ) { } public void insertEdge ( GraphEdge edge ) { GraphVertex source = edge . getSource ( ) ; GraphVertex target = edge . getTarget ( ) ; source . setDegree ( ( ( source . getDegree ( ) ) + ( edge . getWeight ( ) ) ) ) ; <START_BUG> target . setDegree ( ( ( source . getDegree ( ) ) + ( edge . getWeight ( ) ) ) ) ; <END_BUG> source . setDegreeOut ( ( ( source . getDegreeOut ( ) ) + ( edge . getWeight ( ) ) ) ) ; edge . setId ( edges . size ( ) ) ; degreeMax = Math . max ( degreeMax , source . getDegree ( ) ) ; degreeOutMax = Math . max ( degreeOutMax , source . getDegreeOut ( ) ) ; edges . add ( edge ) ; } public List < GraphEdge > getEdges ( ) { } public Relation getRelation ( ) { } public void setRelation ( Relation relation ) { } public GraphEdge getEdgeById ( int id ) { } public float getMaxOutdegree ( ) { } public float getMaxDegree ( ) { } public GraphVertex getVertexById ( int id ) { } public Collection < GraphEdge > getAdjacent ( GraphVertex graphVertex , String relationName ) { } public Collection < GraphEdge > getAdjacentUndirected ( GraphVertex graphVertex , String relationName ) { } public void initGroups ( ) { } public void addGroup ( Group group ) { } public Group addGroup ( String groupName ) { } public void removeGroup ( int index ) { } public Group getGroup ( int index ) { } public Group getGroup ( String name ) { } public DefaultListModel getGroups ( ) { } public String [ ] getIndexToGroupName ( ) { } public void setIndexToGroupName ( String [ ] indexToGroupName ) { } public int getNumberOfGroups ( ) { } public void moveGroupUp ( int index ) { } public void moveGroupDown ( int index ) { } public void refreshGroups ( ) { } public boolean isEdgesAvailable ( ) { } public Group getDefaultGroup ( ) { } public void clearClustering ( ) { } public int getNumberOfClusters ( ) { } public int calculateCutOfGroup ( Group group ) { } public int calculateCutOfClustering ( ) { } public void addOnGroupChangeListener ( GraphEventListener listener ) { } public void addOnGraphChangeListener ( GraphEventListener listener ) { } public void notifyAboutLayoutChange ( EventObject event ) { } public void notifyAboutGroupsChange ( EventObject event ) { } }

Fix:
target . setDegree ( ( ( target . getDegree ( ) ) + ( edge . getWeight ( ) ) ) ) ;