+}
+
+
+/*
+ * Create and open files used to store accuracy points to genereate graphs.
+ * Allocate and populate array to store file pointers and counters.
+ *
+ * Args:
+ * syncState: container for synchronization data
+ */
+static void openGraphDataFiles(SyncState* const syncState)
+{
+ unsigned int i, j;
+ int retval;
+ char* cwd;
+ char name[36];
+ MatchingGraphsBroadcast* graphs= ((MatchingDataBroadcast*)
+ syncState->matchingData)->graphs;
+
+ cwd= changeToGraphDir(syncState->graphsDir);
+
+ graphs->accuracyPoints= malloc(syncState->traceNb * sizeof(FILE**));
+ graphs->pointsNb= malloc(syncState->traceNb * sizeof(unsigned int*));
+ for (i= 0; i < syncState->traceNb; i++)
+ {
+ graphs->accuracyPoints[i]= malloc(i * sizeof(FILE*));
+ graphs->pointsNb[i]= calloc(i, sizeof(unsigned int));
+ for (j= 0; j < i; j++)
+ {
+ retval= snprintf(name, sizeof(name),
+ "matching_broadcast-%03u_and_%03u.data", j, i);
+ g_assert_cmpint(retval, <=, sizeof(name) - 1);
+ if ((graphs->accuracyPoints[i][j]= fopen(name, "w")) == NULL)
+ {
+ g_error(strerror(errno));
+ }
+ }
+ }
+
+ retval= chdir(cwd);
+ if (retval == -1)
+ {
+ g_error(strerror(errno));
+ }
+ free(cwd);
+}
+
+
+/*
+ * Calculate and write points used to generate graphs
+ *
+ * Args:
+ * graphs: structure containing array of file pointers and counters
+ * broadcast: broadcast for which to write the points
+ */
+static void writeAccuracyPoints(MatchingGraphsBroadcast* graphs, const
+ Broadcast* const broadcast)
+{
+ unsigned int i, j;
+ GArray* events;
+ unsigned int eventNb= broadcast->events->length;
+
+ events= g_array_sized_new(FALSE, FALSE, sizeof(Event*), eventNb);
+ g_queue_foreach(broadcast->events, &gfAddEventToArray, events);
+
+ for (i= 0; i < eventNb; i++)
+ {
+ for (j= 0; j < eventNb; j++)
+ {
+ Event* eventI= g_array_index(events, Event*, i), * eventJ=
+ g_array_index(events, Event*, j);