User Tools

Site Tools


graphs

Graphs

  • Nodes, Edges
  • No root node like trees
  • Edges can contain data, like strength of conection, etc.
  • Edges can have a direction, “Directed Edge”
  • “Undirected Graph”, Edges with no direction
  • Graphs can loop back to the start, unlike Trees
  • “DAG” - Directed Acyclic Graph, - Graph that does not loop

Connectivity

Disconnected graph has one or more nodes not connected to the rest of the graph.

Edge List or 2D or 3D List

Adjacency

DFS

Depth First Search

Use a Stack.

BFS

Breadth First Search

Use a Queue

Shortest Path Problem

If the edges are unweighted, the shortest past is found via BFS.

Dijkstra's Algorithm

graphs.txt · Last modified: 2020/01/13 00:22 by jrseti