-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Graph format has been developed, Graph API created, examples and test…
…s have been updated
- Loading branch information
U-DeBug010-PC\DeBug010
authored and
U-DeBug010-PC\DeBug010
committed
Apr 28, 2014
1 parent
1869ed9
commit f923168
Showing
33 changed files
with
410 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
from support import read_sample; | ||
from support import read_graph, draw_graph; | ||
|
||
from samples.definitions import GRAPH_SIMPLE_SAMPLES; | ||
|
||
from gcolor.dsatur import dsatur; | ||
|
||
def template_graph_coloring(filename): | ||
graph_matrix_repr = read_sample(filename); | ||
coloring = dsatur(graph_matrix_repr); | ||
print("\nGraph: ", filename); | ||
print(coloring); | ||
graph = read_graph(filename); | ||
coloring = dsatur(graph.data); | ||
|
||
draw_graph(graph, coloring); | ||
|
||
def graph_one_line(): | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_LINE); | ||
|
||
def graph_full_1(): | ||
def run_all_graph_samples(): | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_BROKEN_CIRCLE1); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_BROKEN_CIRCLE2); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_FIVE_POINTED_FRAME_STAR); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_FIVE_POINTED_STAR); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_FULL1); | ||
|
||
def graph_full_2(): | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_FULL2); | ||
|
||
def graph_one_circle(): | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_CIRCLE1); | ||
|
||
|
||
graph_one_line(); | ||
graph_full_1(); | ||
graph_full_2(); | ||
graph_one_circle(); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_CIRCLE2); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_CIRCLE3); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_CROSSROAD); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_ONE_LINE); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_SIMPLE1); | ||
template_graph_coloring(GRAPH_SIMPLE_SAMPLES.GRAPH_TWO_CROSSROADS); | ||
|
||
run_all_graph_samples(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
c DESCRIPTION: 6 Nodes, 7 Edges | ||
c OPTIMAL NUMBER OF COLORS: 2 | ||
|
||
m 0 1 0 0 0 1 | ||
m 1 0 1 0 0 0 | ||
m 0 1 0 1 0 1 | ||
m 0 0 1 0 1 0 | ||
m 0 0 0 1 0 1 | ||
m 1 0 1 0 1 0 | ||
|
||
r 0 1 | ||
r 1 2 | ||
r 2 2 | ||
r 3 1 | ||
r 2 0 | ||
r 1 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
c DESCRIPTION: 5 Nodes, 6 Edges | ||
c OPTIMAL NUMBER OF COLORS: 3 | ||
|
||
m 0 1 0 0 1 | ||
m 1 0 1 0 0 | ||
m 0 1 0 1 1 | ||
m 0 0 1 0 1 | ||
m 1 0 1 1 0 | ||
|
||
r 0 1 | ||
r 1 2 | ||
r 3 2 | ||
r 4 1 | ||
r 2 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
c DESCRIPTION: 10 Nodes, 10 Edges | ||
c OPTIMAL NUMBER OF COLORS: 3 | ||
|
||
m 0 1 1 0 0 1 0 0 0 0 | ||
m 1 0 0 0 0 0 1 1 0 0 | ||
m 1 0 0 1 0 0 0 0 1 0 | ||
m 0 0 1 0 1 0 0 1 0 0 | ||
m 0 0 0 1 0 1 1 0 0 0 | ||
m 1 0 0 0 1 0 0 0 0 1 | ||
m 0 1 0 0 1 0 0 0 1 0 | ||
m 0 1 0 1 0 0 0 0 0 1 | ||
m 0 0 1 0 0 0 1 0 0 1 | ||
m 0 0 0 0 0 1 0 1 1 0 | ||
|
||
r 2 3 | ||
r 2 2.6 | ||
r 0 2.4 | ||
r 0.5 2 | ||
r 3 2 | ||
r 4 2.4 | ||
r 1 1 | ||
r 2.5 1 | ||
r 0.5 0.5 | ||
r 3.5 0.5 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
c DESCRIPTION: 5 Nodes, 5 Edges | ||
c OPTIMAL NUMBER OF COLORS: 3 | ||
|
||
m 0 0 1 1 0 | ||
m 0 0 0 1 1 | ||
m 1 0 0 0 1 | ||
m 1 1 0 0 0 | ||
m 0 1 1 0 0 | ||
|
||
r 1 2.5 | ||
r 0 2 | ||
r 0.5 0 | ||
r 1.5 0 | ||
r 2 2 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
c DESCRIPTION: 6 Nodes | ||
c OPTIMAL NUMBER OF COLORS: 7 | ||
|
||
m 0 1 1 1 1 1 1 | ||
m 1 0 1 1 1 1 1 | ||
m 1 1 0 1 1 1 1 | ||
m 1 1 1 0 1 1 1 | ||
m 1 1 1 1 0 1 1 | ||
m 1 1 1 1 1 0 1 | ||
m 1 1 1 1 1 1 0 | ||
|
||
r 0 2 | ||
r 0.5 3.5 | ||
r 2 4 | ||
r 3.5 3.5 | ||
r 4 2 | ||
r 3.5 0.5 | ||
r 2 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
c DESCRIPTION: 8 Nodes | ||
c OPTIMAL NUMBER OF COLORS: 8 | ||
|
||
m 0 1 1 1 1 1 1 1 | ||
m 1 0 1 1 1 1 1 1 | ||
m 1 1 0 1 1 1 1 1 | ||
m 1 1 1 0 1 1 1 1 | ||
m 1 1 1 1 0 1 1 1 | ||
m 1 1 1 1 1 0 1 1 | ||
m 1 1 1 1 1 1 0 1 | ||
m 1 1 1 1 1 1 1 0 | ||
|
||
r 0 2 | ||
r 0.5 3.5 | ||
r 2 4 | ||
r 3.5 3.5 | ||
r 4 2 | ||
r 3.5 0.5 | ||
r 2 0 | ||
r 0.5 0.5 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
c DESCRIPTION: 5 Nodes, 5 Edges | ||
c OPTIMAL NUMBER OF COLORS: 3 | ||
|
||
m 0 1 0 0 1 | ||
m 1 0 1 0 0 | ||
m 0 1 0 1 0 | ||
m 0 0 1 0 1 | ||
m 1 0 0 1 0 | ||
|
||
r 0 1 | ||
r 1 2 | ||
r 2 2 | ||
r 3 1 | ||
r 1.5 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
c DESCRIPTION: 6 Nodes, 6 Edges | ||
c OPTIMAL NUMBER OF COLORS: 2 | ||
|
||
m 0 1 0 0 0 1 | ||
m 1 0 1 0 0 0 | ||
m 0 1 0 1 0 0 | ||
m 0 0 1 0 1 0 | ||
m 0 0 0 1 0 1 | ||
m 1 0 0 0 1 0 | ||
|
||
r 0 1 | ||
r 1 2 | ||
r 2 2 | ||
r 3 1 | ||
r 2 0 | ||
r 1 0 |
Oops, something went wrong.