Spaces:
Sleeping
Sleeping
File size: 1,815 Bytes
e4bf523 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 'use strict'
/**
* Copyright (c) 2017~2019, OBCon Inc.
* All rights reserved.
*/
/**
* @file
* @copyright 2017~2019, OBCon Inc.
* @author gye hyun james kim [pnuskgh@gmail.com]
*/
class VERTEX { //--- 정점 (노드)
constructor(data) {
this.data = data;
this.degree = 0; //--- 챠수 : 정점에 연결된 간선의 수
}
}
class EDGE { //--- 간선
constructor(left, right, weight=0, isDirected=true) {
this.left = left;
this.right = right;
this.weight = weight; //--- 가중치
this.isDirected = isDirected; //--- true. 방향성 있음 (left -> right)
}
}
class Graph { //--- FIFO (First In First Out)
constructor(isDirected=true) {
this.vertexs = [];
this.edges = [];
this.isDirected = isDirected; //--- true. 방향성 있음
}
addVertex(vertex) {
// this.vertexs.push(new VERTEX(data));
}
addEdge(vertex1, vertex2, weight=0) {
}
removeVertex(vertex) {
}
removeEdge(vertex1, vertex2) {
}
//--- BFS (Breadth-First search, 너비 우선 검색)
traverseBFS(vertex, callback) {
}
//--- DFS (Depth-First search, 깊이 우선 검색)
traverseDFS(vertex, callback) {
}
//--- 다익스트라 알고리즘
//--- 가중치를 고려하여 최단 경로 계산
Dijkstra(source) {
}
//--- 위상 정렬
topologicalSortUtil(v, visited, stack) {
}
}
module.exports = Graph;
|