- The project was completed in 2 weeks and 2 days.
- Implementation ideas came successively.
- Implemented necessary structures, processing functions, and writing functions.
- Used a 'for' loop and
fscanf
function to obtain data from the input file. - Completed requirement 1:
- Found the connected component with the most nodes.
- Saved this component in a binary tree.
- Ascending order obtained by in-order traversal.
- Encountered numerous Valgrind errors in the 'Productions' function.
- Spent 2-3 days resolving errors caused by the binary tree vector.
- Implemented requirement 2 using the
Degree
function. - Major obstacles encountered (SIGSEGV -> GDB).
- 2-3 days spent on debugging:
- Used Valgrind and GDB.
- Valgrind reported most errors.
- Implemented degree of kinship:
- Represented minimum distance between nodes.
- Used Breadth-First Search (BFS).
- Called additional functions to ensure actors' presence in the tree.
- Memory management: freed memory and returned results at function end.
- Actor representation:
actor->name
: Actor's nameactor->code
: Associated code to prevent duplicates
- Tree structure:
- Actors added to left or right of the tree for correct ordering.
- Used
Compare_Names
function for proper ordering.
- No duplicates in the tree.
Object
: Generic object storing node order number or actor name.Number_of_nodes
: Node countAdjency_List
: Vector of adjacency listsNext
: Pointer to next nodeActor_Compare
: Function to compare actors
Example: (char *)Graph->Adjency_List[1]->head->Object
stores the first actor's name in the graph.
- Completed requirement 3 in 2 days.
- Researched Tarjan's algorithm.
- Complex implementation in
CriticalEdges
function:- Checked conditions (1-14) for actor ordering.
- Conditions verified relationships between letters in actor names.
main
function: Initialized graph and tree.- Writing function:
- Used in-order traversal and '\n' for correct output format.
- Used variables like
char *Name_Movie, **Names_Actors, *Name_Actor1, *Name_Actor2
for tree/graph construction and memory deallocation.
This project presented significant challenges and was not trivial to implement.