Skip to content

Commit

Permalink
Added new examples for graph coloring [gcolor.syncgcolor]
Browse files Browse the repository at this point in the history
  • Loading branch information
annoviko committed Mar 17, 2014
1 parent c754785 commit 6bee700
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions gcolor/syncgcolor/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ def one_circle3():
template_graph_coloring(1, graph_matrix_repr, "Circle 3");


def broken_circle1():
graph_matrix_repr = [ [0, 1, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0],
[0, 1, 0, 1, 0, 1],
[0, 0, 1, 0, 1, 0],
[0, 0, 0, 1, 0, 1],
[1, 0, 1, 0, 1, 0] ];

template_graph_coloring(1, graph_matrix_repr, "Broken Circle 1");


def broken_circle2():
graph_matrix_repr = [ [0, 1, 0, 0, 1],
[1, 0, 1, 0, 0],
[0, 1, 0, 1, 1],
[0, 0, 1, 0, 1],
[1, 0, 1, 1, 0] ];

template_graph_coloring(1, graph_matrix_repr, "Broken Circle 2");


def one_star():
graph_matrix_repr = [ [0, 0, 0, 0, 1],
[0, 0, 0, 0, 1],
Expand All @@ -57,6 +78,16 @@ def one_star():
template_graph_coloring(1, graph_matrix_repr, "One Star");


def five_pointed_star():
graph_matrix_repr = [ [0, 0, 1, 1, 0],
[0, 0, 0, 1, 1],
[1, 0, 0, 0, 1],
[1, 1, 0, 0, 0],
[0, 1, 1, 1, 0] ];

template_graph_coloring(1, graph_matrix_repr, "Five Pointed Star");


def one_line():
graph_matrix_repr = [ [0, 1, 0, 0, 0],
[1, 0, 1, 0, 0],
Expand All @@ -82,9 +113,28 @@ def two_interconnected_stars():
template_graph_coloring(2, graph_matrix_repr, "Two Interconnected Stars");


def five_pointed_frame_star():
graph_matrix_repr = [ [0, 1, 0, 0, 1, 1, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 1, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 1, 0, 0, 0, 1, 0],
[1, 0, 0, 1, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 1, 1, 0],
[0, 1, 0, 0, 0, 0, 0, 0, 1, 1],
[0, 0, 1, 0, 0, 1, 0, 0, 0, 1],
[0, 0, 0, 1, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 1, 1, 0, 0] ];

template_graph_coloring(2, graph_matrix_repr, "Five Pointed Star With Frame");


one_line();
one_circle1();
one_circle2();
one_circle3();
broken_circle1();
broken_circle2();
one_star();
five_pointed_star();
five_pointed_frame_star();
two_interconnected_stars();

0 comments on commit 6bee700

Please sign in to comment.