Graphs - 401-advanced-javascript-billybunn/seattle-javascript-401d29 GitHub Wiki

Terminology

Vertex

Vertexes are like "nodes" in a graph. Vertexes don't have a "next", instead they have edges that connect them to their neighbor vertexes.

Edges

These are the lines connecting each vertex to one or more other vertexes.

Types of graphs

Undirected

Graphs with "bi-directional" edges. An undirected graph has bi-directional edges, meaning there are no "arrows" in the lines you draw between nodes/vertexes.

Directed

Directed graphs contain vertexes that can only go one direction. Once we go one direction, we can no longer go back. Trees are a type of directed graph.

Cyclic

Acyclic

A tree is a directed-acyclic graph. As you go down edges, you can never go back

Complete graph

Every single vertex connects to everything else

Connected graph

Where every single vertex has one or more edges

Disconnected Graph

A graph where some vertexes don't have edges to a neighbor. "Islands" are vertexes that aren't connected.

Representing graphs in code

Resouces: Graphs