7 kyu
Find Center of Star Graph
327 of 373monkey_on_a_keyboard_1
Loading description...
Graph Theory
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I liked this one. Kind of a tutorial on graph theory for beginners. Since all issues seem to be resolved (a month ago!) I approved.
I was about to approve the kata when I noticed the random graph creation uses O(n²) opeartions, removing in a list. Even if not a problem for a kata not involving performances, it's better to use a more qualitative approach, since the tests of this kata could inspire some other kata authors later.
Since I don't do C, I cannot update it an resort to opening another issue.
Solution:
c
value from wthin the loop instead of removing it from the listCheers
hello Blind4Basics!, thank you for taking the time to look over this and noticing that for me, i made the change to the creating graph function that i wrote (in python) :). I think the translation in C looks ok, it doesn't use list removals to create a graph
'never saw your answer, sorry...
This definition of star graph is insufficient: it establishes that there exists a node that has an edge to all other nodes, but does not tell about the existence of other possible edges in the graph (which is actually ruled out by definition). This does have big implications on how the kata is approached: see the top 2 Python solutions.
oops sorry i will go change that now and clarify the description thank you for pointing that out
edit: i tried to give a better description lemme know if theres still parts of it that need to be changed that i may have missed thank you for your help and time :)
.
C Translation
Thank you for your time and effort for writing a translation! :D
edit: I forgot to mention but I added your nice translation :)
you're welcome. if anything may need adjustments, just comment on this thread, and I'll get to it
There should be tests where the center is always first/always second
There should be more tests (at least 50-100)
You can use a loop:
Thank you, I've added 10 tests each for center always first/always second and also 100 more random tests. I also fixed a small error in a few of the test cases which may have made it possible for a correct solution to fail. Should I add more tests? Thanks for your help! :)
the different batches of random tests should be merged into one, running each kind of test (and not only each kind of group/batch) in random order. Otherwise, the answer to some groups can be hardcoded.
Simplest way to do this:
@test.it
block for the random tests[func1] * n_tests_func1 + [func2] * n_tests_func2 + ...]
I see, thank you very much I will go fix that now :)
Edit: Thanks again for your helpful feedback, I've made the changes, and I also added some comments and rewrote the description for clarity.
.