Skip to content

Technolo[geo]

Tech. & a bit of everything else

  • Math/Science
    • Algorithms
    • Infinity
    • Number Theory
  • Museum
    • Computers
    • Consoles
    • Gaming Peripherals
    • Keyboards
    • Mice
    • Miscellaneous
  • Project Euler
  • Projects
  • Tools
    • asm debugger

Graph Representation

Posted on July 9, 2022August 1, 2022 by technologeo
Directed Graph

Language:

Javascript (JS)

Solution:

var edgeList = [ [0, 2], [1, 3], [2, 3], [2, 4], [3, 5], [4, 5] ];

var adjMatrix = [
    [0, 0, 1, 0, 0, 0],
    [0, 0, 0, 1, 0, 0],
    [0, 0, 0, 1, 1, 0],
    [0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 0, 0]
    ];

var adjList = [
    [2],
    [3],
    [3, 4],
    [5],
    [5],
    []
    ];

Related

Posted in Algorithms, Math & Science, Programming

Published by technologeo

View all posts by technologeo

Post navigation

Previous Post Quicksort
Next Post Breadth-First Search (BFS)
  • Algorithms
  • Computers
  • DIY
  • Gaming
  • Math & Science
  • Museum
  • Networking
  • Number Theory
  • Programming
  • Project Euler
  • Projects
  • Recursion
Proudly powered by WordPress | Theme: Libre 2 by Automattic.