{"record":{"id":"6671bb6ccd50bdce","repo":"krahets/hello-algo","slug":"error-6671bb","errorCode":null,"errorMessage":"Количество вершин графа уже достигло максимума\n","messagePattern":"Количество вершин графа уже достигло максимума\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ru/codes/c/chapter_graph/graph_adjacency_matrix.c","lineNumber":39,"sourceCode":"    GraphAdjMat *graph = (GraphAdjMat *)malloc(sizeof(GraphAdjMat));\n    graph->size = 0;\n    for (int i = 0; i < MAX_SIZE; i++) {\n        for (int j = 0; j < MAX_SIZE; j++) {\n            graph->adjMat[i][j] = 0;\n        }\n    }\n    return graph;\n}\n\n/* Деструктор */\nvoid delGraphAdjMat(GraphAdjMat *graph) {\n    free(graph);\n}\n\n/* Добавление вершины */\nvoid addVertex(GraphAdjMat *graph, int val) {\n    if (graph->size == MAX_SIZE) {\n        fprintf(stderr, \"Количество вершин графа уже достигло максимума\\n\");\n        return;\n    }\n    // Добавить n-ю вершину и обнулить n-ю строку и столбец\n    int n = graph->size;\n    graph->vertices[n] = val;\n    for (int i = 0; i <= n; i++) {\n        graph->adjMat[n][i] = graph->adjMat[i][n] = 0;\n    }\n    graph->size++;\n}\n\n/* Удаление вершины */\nvoid removeVertex(GraphAdjMat *graph, int index) {\n    if (index < 0 || index >= graph->size) {\n        fprintf(stderr, \"индекс вершины выходит за границы\\n\");\n        return;\n    }\n    // Удалить вершину с индексом index из списка вершин","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/krahets/hello-algo/blob/69932aed1891a7b7f6a0de88cd116d3fe13e7032/ru/codes/c/chapter_graph/graph_adjacency_matrix.c#L21-L57","documentation":"Russian localization of the addVertex capacity check (see error 600). The graph is bounded by #define MAX_SIZE 100 in fixed arrays; the 101st addVertex prints this to stderr and returns void without inserting.","triggerScenarios":"addVertex(graph, val) when graph->size == 100.","commonSituations":"Datasets larger than 100 nodes; stress tests past the cap; assuming dynamic resizing.","solutions":["Cap input at 100 vertices.","Raise MAX_SIZE and recompile (O(MAX_SIZE^2) memory).","Switch to the adjacency-list implementation for larger graphs."],"exampleFix":"// before\nfor (int i = 0; i < 1000; i++) addVertex(graph, i);\n\n// after\nfor (int i = 0; i < 1000 && graph->size < MAX_SIZE; i++) addVertex(graph, i);","handlingStrategy":"validation","validationCode":"static inline int graphCanAddVertex(const GraphAdjMat *g) {\n    return g != NULL && g->size < MAX_SIZE;\n}\n\nif (graphCanAddVertex(graph)) addVertex(graph, val);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat MAX_SIZE as a hard contract; assert before each addVertex in debug.","Choose the adjacency-list variant for graphs that may exceed 100 nodes.","Wrap addVertex in a status-returning helper so failures are detectable beyond stderr."],"tags":["graph","capacity","adjacency-matrix","fixed-size","c","i18n-ru"],"backgroundTag":null,"analyzedSha":"69932aed1891a7b7f6a0de88cd116d3fe13e7032","analyzedAt":"2026-08-13T23:02:37.581Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}