C
C#12mo ago
doomcentury

Graph Coloring help

Hello, I am new to coding in C# and new to WinForms. I am trying to make graph coloring with an option to select one of two algorithms: greedy and backtrack. I would appreciate it if someone dedicated their time in helping writing this program. 1. I need to be able to edit/delete points I've already drawn. 2. I need to connect the points I've drawn 3. I need to make these algorithms work with my interface 4. I need to be able to save generated graph.
No description
30 Replies
many things
many things12mo ago
i did something like this when i was a kid, although mine had slightly different objectives anyway if you put this stuff on github/gitlab/ecc people can contribute if that's what you are asking
doomcentury
doomcenturyOP12mo ago
I want to finish this program today tho And I'm kinda overwhelmed and don't know how to do the rest Just looking for a person who can dedicate a hour or two in dms to help me finish this program
many things
many things12mo ago
'today' is a pretty short term
doomcentury
doomcenturyOP12mo ago
Lets say I want to finish this in 9 hours
doomcentury
doomcenturyOP12mo ago
@WEIRD FLEX Yo, I have a problem when trying to remove rectangle, any idea why? 1. Error window 2. Paint method 3. Rectangle deletion 4. Rectangle creation (Delete method shown) 5. Dispose methods
No description
No description
No description
No description
No description
doomcentury
doomcenturyOP12mo ago
this line errors :
e.Graphics.DrawEllipse(mypoint.DrawingPen, mypoint.Dot);
e.Graphics.DrawEllipse(mypoint.DrawingPen, mypoint.Dot);
even though I check that these values are not null
Pobiega
Pobiega12mo ago
you only check that ONE of them is not null
doomcentury
doomcenturyOP12mo ago
And they can't be anything else than correct type or null
Pobiega
Pobiega12mo ago
x != null || y != null
doomcentury
doomcenturyOP12mo ago
Same error btw
No description
Pobiega
Pobiega12mo ago
if x is not null, or y is not null, do the following...
doomcentury
doomcenturyOP12mo ago
Even with &&
Pobiega
Pobiega12mo ago
set a breakpoint and inspect the values when it breaks
doomcentury
doomcenturyOP12mo ago
sure I mean the mypoint is null Then I added a check if mypoint is null or not Completely ignored Still errors
Pobiega
Pobiega12mo ago
the fact that your list contains a null seems like an error in itself if you ask me
doomcentury
doomcenturyOP12mo ago
i honestly dont even know what I'm doing atp yet i need to fix this
Pobiega
Pobiega12mo ago
then take a step back and re-focus you are clearly passing something incorrect to the DrawEllipse method, as per the stacktrace. I would enable break on exceptions and run the program in debug
doomcentury
doomcenturyOP12mo ago
Ok I fixed it Took a different approach It could be very well condition racing As it seems mypoint changed AFTER the if statement
Pobiega
Pobiega12mo ago
that seems unlikely, considering you are getting it in an iterator
doomcentury
doomcenturyOP12mo ago
so I just added a bool variable in point, and if it's true, the paint method removes the point Now time to add point editing ok added editing time to somehow implement graph coloring
many things
many things12mo ago
good luck
doomcentury
doomcenturyOP12mo ago
@WEIRD FLEX @Pobiega Any reason why my line gets removed once I make a new one? https://gyazo.com/7635142d7e4b91e51cfcf94ebfcbd427
No description
No description
No description
many things
many things12mo ago
i don't know is it really deleted or are you redrawing the entire content
doomcentury
doomcenturyOP12mo ago
I always redraw everything because I have an option to delete points
doomcentury
doomcenturyOP12mo ago
fixed
No description
doomcentury
doomcenturyOP12mo ago
made the same class for lines as for points @Pobiega You have some free time? My algorithms for some reason recolor everything in the same color
doomcentury
doomcenturyOP12mo ago
No description
No description
No description
doomcentury
doomcenturyOP12mo ago
I'm in shambles rn @WEIRD FLEX
doomcentury
doomcenturyOP12mo ago
The table
No description
many things
many things12mo ago
don't declare a new random in the method it should an object used application-wise you could use the shared random eventually

Did you find this page helpful?