Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check if the graph the user draws is planar or not
  • Loading branch information
pex13002 committed Dec 3, 2014
1 parent b26925e commit 7c0b972
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drawing/Graph.pde
Expand Up @@ -15,7 +15,9 @@ class Graph{
for(Vertex i:V){
if(i.E.size()<=min)min=i.E.size();
}
return min==3;
boolean x= (min==3);
boolean y= E.size() <= (3*V.size() -6);
return x&&y;
}
boolean check3edges_per_vertex(Vertex v){
if(v.E.size()<3) return true;
Expand Down
3 changes: 3 additions & 0 deletions drawing/drawing.pde
@@ -1,6 +1,7 @@
import papaya.*;



final int DRAW_NORMAL=1;
final int DRAW_DRAG=2;
final int DRAW_ANIMATION=3;
Expand Down Expand Up @@ -129,6 +130,8 @@ class ResetEvent implements ButtonEvent {

class TutteDrawEvent implements ButtonEvent {
void onclick() {
if (G.ValidGraph()==false)
throw new RuntimeException("Not a valid Graph!");
int l=G.V.size();

ArrayList<Vertex> face=FindFace();
Expand Down

0 comments on commit 7c0b972

Please sign in to comment.