-
Notifications
You must be signed in to change notification settings - Fork 0
Задача 2 #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| typedef struct Node | ||
| { | ||
| int index; | ||
| int lenght; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Она length
| newGraph->nodes = calloc(numberOfNode, sizeof(Node*)); | ||
| for (int i = 0; i < numberOfNode; i++) | ||
| { | ||
| newGraph->nodes[i] = calloc(1, sizeof(int*)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(int*) тут очень внезапно, sizeof(Node) имелось в виду, скорее всего
| return newGraph; | ||
| } | ||
|
|
||
| void edgeLength(Graph* graph, int firstVertex, int secondVertex, int lenght) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы её назвал как setEdgeLength или что-то такое, чтобы это была повелительная форма
|
|
||
| void printMatrix(Graph* graph) | ||
| { | ||
| for (int i = 0; i < 6; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodesCount вместо 6, скорее всего
| { | ||
| int numberOfSegments; | ||
| struct List** array; | ||
| } Table; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Объявления типов лучше сверху все
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как я понял, это сильно недописанная попытка сделать dfs. Но если он рекурсивный, то list (очередь рассматриваемых вершин?) не нужен, мы ходим просто по соседям, а если нерекурсивный, то не нужен рекурсивный вызов. И в любом случае, нужно множество уже посещённых вершин. И тогда вся задача своидтся к "пока есть непосещённые вершины, берём первую из них, гоним dfs, все посещённые при этом вершины складываем в новую компоненту связности"
Здравствуйте, здесь ничего не работает, но я попытался написать хоть что-то за оставшееся время