 #include "stdio.h"

 typedef int** CMatrix;

 void InitCMaxtrix(CMatrix m, int c){
  int i, j;
  m = calloc(c, sizeof(int));
  for (i=0; i<c; i++)
    m[i] = calloc(c, sizeof(int));

  for (i=0; i<c; i++)
   for (j=0; j<c; j++)
    m[i][j] = -1;
 }



 int ReadComponents(char *s, struct stations *stat, CMatrix m){
  FILE *f;
  int i, id1, id2;
  char str1[256], str2[256];

  if ((f = fopen(s,"rt")) == NULL) return -1;

   while (!feof(f)) {
    fscanf(f, "%s%s%d",  &str1, &str2, &i);
    id1 = GetStationID(&str1, stat);
    id2 = GetStationID(&str2, stat);    

    if (id1<id2)  m[id2][id1] = i; else m[id1][id2] = i;
   }

   fclose(f);
  return 1;
 }