What data type does JS use to represent directed acyclic graphs?

problem description: now there is a directed acyclic graph with positive weights on each node. Now we want to find an optimal path so that the sum of the weights of the nodes is maximum.
input: n nodes, m paths, start
for example:
3 nodes
A 1
B 2
C 2
3 paths
A-> B
B-> C
A-> C
start: a
output: 5 (the best path is A-> B-> C, weight: 1 / 2 / 2 / 5)

question : what kind of data structure is used to represent the graph to start computing?

Mar.03,2021

shouldn't the weight be on the edge

// 
var points = ['A', 'B', 'C']
//  [1,2]
var edges = [[0, 1, 1], [1, 2, 2], [0, 2, 2]]

use the structure of graph, use adjacency table to store your nodes, and use breadth-first traversal algorithm to solve the data you want, in which Map class can store your adjacency table (fixed-point name as key, adjacency vertex list as value)


this is the question

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b378e3-34452.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b378e3-34452.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?