File tree 15 files changed +63
-0
lines changed
09-problems/graph-algorithms-in-genome-sequencing
15 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+
4
+ def eulerian_cycle (graph ):
5
+ """Finds an Eulerian cycle in the given graph
6
+
7
+ Args:
8
+ graph: a list of strings containing edges in the graph; one
9
+ string may correspond to multiple edges if it is of the
10
+ form "X -> Y,Z"
11
+
12
+ Returns:
13
+ a string containing an Eulerian cycle through the given graph
14
+ """
15
+ # TODO: your code here
16
+ return ""
17
+
18
+
19
+ if __name__ == "__main__" :
20
+ graph = sys .stdin .read ().strip ().splitlines ()
21
+ print (eulerian_cycle (graph ))
Original file line number Diff line number Diff line change
1
+ 3->2->6->8->7->9->6->5->4->2->1->0->3
Original file line number Diff line number Diff line change
1
+ 0 -> 3
2
+ 1 -> 0
3
+ 2 -> 1,6
4
+ 3 -> 2
5
+ 4 -> 2
6
+ 5 -> 4
7
+ 6 -> 5,8
8
+ 7 -> 9
9
+ 8 -> 7
10
+ 9 -> 6
Original file line number Diff line number Diff line change
1
+ 0->1->2->0
Original file line number Diff line number Diff line change
1
+ 0 -> 1
2
+ 1 -> 2
3
+ 2 -> 0
Original file line number Diff line number Diff line change
1
+ 0->3->0->1->2->0
Original file line number Diff line number Diff line change
1
+ 0 -> 3,1
2
+ 1 -> 2
3
+ 2 -> 0
4
+ 3 -> 0
Original file line number Diff line number Diff line change
1
+ 4->1->2->0->1->3->4
Original file line number Diff line number Diff line change
1
+ 0 -> 1
2
+ 1 -> 2,3
3
+ 2 -> 0
4
+ 3 -> 4
5
+ 4 -> 1
Original file line number Diff line number Diff line change
1
+ 2->2->1->2
Original file line number Diff line number Diff line change
1
+ 1 -> 2
2
+ 2 -> 1,2
Original file line number Diff line number Diff line change
1
+ 1->10->4->5->10->3->10->2->1
Original file line number Diff line number Diff line change
1
+ 1 -> 10
2
+ 10 -> 2,3,4
3
+ 2 -> 1
4
+ 3 -> 10
5
+ 4 -> 5
6
+ 5 -> 10
Original file line number Diff line number Diff line change
1
+ 3->4->3->1->3->0->2->0->4->0->3->2->1->0->1->2->4->1->4->2->
Original file line number Diff line number Diff line change
1
+ 0 -> 1,2,3,4
2
+ 1 -> 0,2,3,4
3
+ 2 -> 0,1,3,4
4
+ 3 -> 0,1,2,4
5
+ 4 -> 0,1,2,3
You can’t perform that action at this time.
0 commit comments