Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.16 KB

File metadata and controls

34 lines (22 loc) · 1.16 KB

Graphs

  • Directed (one way edge traversal) or un-directed (two way edge traversal)
  • If every pair of verticies have an edge, the graph is 'connected'

Adjaceny List

  • Each node stores a list of connections, either nodes or edges.
  • Can be created as an array or hash of lists instead of objects/classes

Adjaceny Matrix

  • NxN boolean matrix where N is number of nodes, and true indicates a connecting edge

Third way is ???

Graph search

DFS

  • Depth first: Pick a node and explore branch completely.
  • Generally DFS preferred for visiting all nodes.
  • Pre-order search with tracking node visits

BFS