routing algorithm
본 자료는 1페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
해당 자료는 1페이지 까지만 미리보기를 제공합니다.
1페이지 이후부터 다운로드 후 확인할 수 있습니다.

목차

<< routing algorithm >>

<< data >>

<< shortest_path >>

본문내용

j] = W[i][j];
// Searching for length & path
for(k = 0; k <= n - 1; k++) // node on path
for(i = 0; i <= n - 1; i++) // source
for(j = 0; j <= n - 1; j++) // destination
if(D[i][k] + D[k][j] < D[i][j]) {
P[i][j] = k + 1;
D[i][j] = D[i][k] + D[k][j];
}
}
// to print the result
void output(FILE *ofp)
{
int i, j;
for(i = 0; i <= n - 1; i++)
{
fprintf(ofp, "From source node %d:\n", i + 1);
fprintf(ofp, " D length path\n");
for(j = 0; j <= n - 1; j++)
if(i != j)
{
fprintf(ofp, " %d %2d %d -> ", j + 1, D[i][j], i + 1);
path(i + 1, j + 1, ofp);
fprintf(ofp, "%d\n", j + 1);
}
}
fprintf(ofp, "\n");
}
// to print nodes on path
void path(int q, int r, FILE *ofp)
{
if(P[q - 1][r - 1] != 0) {
path(q, P[q - 1][r - 1], ofp);
fprintf(ofp, "%d -> ", P[q - 1][r - 1]);
path(P[q - 1][r - 1], r, ofp);
}
}

추천자료

  • 가격800
  • 페이지수5페이지
  • 등록일2004.06.10
  • 저작시기2004.06
  • 파일형식한글(hwp)
  • 자료번호#254941
본 자료는 최근 2주간 다운받은 회원이 없습니다.
  • 편집
  • 내용
  • 가격
청소해
다운로드 장바구니