24
loading...
This website collects cookies to deliver better user experience
Directed:
directed graphs are graphs with a direction and its edges.
example of a directed graph could be the internet and web page links the nodes are web pages and the directed edges are links to other pages.
Undirected Graph:
undirected graphs are graphs without any direction on the edges between nodes. example of an undirected graph could be a social network the nodes are people and the edges are friendships.
Node1: Node2, Node3
Node2: Node1
Node3: Node3
var underictedG = {
Node1: ["Node2", "Node3"],
Node2: ["Node1"],
Node3: ["Node3"]
}
A | B | C | |
---|---|---|---|
A | 0 | 1 | 0 |
B | 1 | 0 | 1 |
C | 0 | 1 | 0 |
let adjMatrix = [
[0, 1, 1],
[0, 0, 0],
[1, 0, 0],
]
let adjMatrix = [
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
]
24