Skip to content

Keep Graph::getNumEdge consistent with vertex adjacency lists - #114

Open
gaaraujo wants to merge 1 commit into
peer-open-source:stablefrom
gaaraujo:fix/graph-self-loops
Open

Keep Graph::getNumEdge consistent with vertex adjacency lists#114
gaaraujo wants to merge 1 commit into
peer-open-source:stablefrom
gaaraujo:fix/graph-self-loops

Conversation

@gaaraujo

@gaaraujo gaaraujo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Vertex::addEdge rejects self-loops but still returned 0 (i.e. “added”), so Graph increased numEdge without growing either adjacency list. That created a mismatch between the expected number of nonzeros from nnz = numVertices + 2*numEdges and the count from looping over the adjacency lists. Under the Transformation constraint handler this shows up when an element’s condensed IDs repeat an equation and the DOF graph asks for addEdge(i,i).

Self-loops were rejected by Vertex::addEdge but still counted as newly
added edges, inflating numEdge and breaking nnz = V + 2E under
Transformation when element IDs repeat an equation.
@gaaraujo
gaaraujo force-pushed the fix/graph-self-loops branch from 4e202c4 to 34be23e Compare August 9, 2026 23:46
@claudioperez claudioperez added the Upstream Bug A bug that is inherited from upstream OpenSees label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Upstream Bug A bug that is inherited from upstream OpenSees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants