Skip to content

Commit

Permalink
🐛 fixed 2-vertex cycle
Browse files Browse the repository at this point in the history
- disallowed closing of cycles with only 2 vertices
  • Loading branch information
rodigu committed Apr 7, 2022
1 parent e19db1b commit bd627d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,9 @@ export class Cycle extends Network {
edge.to === this.tip_vertex &&
edge.from === this.loop_vertex);

return !this.is_closed && edge_has_tip_and_loop_vertex;
return (
!this.is_closed && edge_has_tip_and_loop_vertex && this.vertices.size > 2
);
}

private canAdd(edge: EdgeArgs) {
Expand Down

0 comments on commit bd627d4

Please sign in to comment.