graphs

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

vertex

node in the graph

2
New cards

edge

connection between two vertices

3
New cards

bipartite

can be split into 2 groups with no internal edges

use bfs with 2 colors to test, if no adjacenent nodes have same color it is biparttie

4
New cards

acylic

no cycles

5
New cards

cylic

at least one cycle

6
New cards

DAG

direct acylic graph

7
New cards

how do trees connect to DAGs

trees are special DAGs with exactly 1 path between any 2 nodes (ie do not go both dirs)

8
New cards

minimum edges in connected graph with n vertices

n-1

its connected, so every vertex is connect vro

9
New cards

how does depth fs detect cycle

visiting node that already is in recursion stack

10
New cards

how does breadth fs detect cycle

if visits node that isnt parent

11
New cards

is every tree bipartite

yes, trees are acyclic so always bipartite

12
New cards

can complete graph be bipartite

only if it has 2 vertices/nodes

13
New cards

is every DAG a tree?

no, DAGs can have multiple roots and disconnected components

14
New cards

Can a graph be both directed and cyclic?

yes bro… thats what a cycle is (question was copied directly vro… did not copy it wrong)

15
New cards

weighted graph

every edge has a numerical value

16
New cards

unweighted graph

edges have no numerical value

17
New cards

directed graph

edges have direction

18
New cards

undirected graph

edges go both ways (a-b == b-a)

19
New cards

loop

edge that connects a vertex to itself

20
New cards

simple graph

no loops, no duplicate edges

21
New cards

connected graph

each vertex is reachable from every other vertex eventually

does NOT mean an edge exists between each vertex, rather a PATH exists between each

22
New cards

complete vertex

every vertex is DIRECTLY connected to every other vertex

an edge DOES EXIST between EACH vertex

23
New cards

adjacency matrix

2d array stores edge connections

space complexity o(V²)

24
New cards

what does a symmetric AM mean

means undirected graph

25
New cards

BFS uses what data structure

queue

26
New cards

DFS uses what structure

stack (either literal or call stack thru recursion)

27
New cards

BFS define

level by level, outward from the path

28
New cards

DFS define

deep along one path before backtracking and branching out the paths until get back to the root

29
New cards

BFS use case

shortest path in unweighted graph

30
New cards

DFS use case

path finding, cycle detection

31
New cards

can a directed graph be connected

yes, if there is a path between all nodes

32
New cards

what does diagonal 1 mean in AM

loop

33
New cards

max edges in complete undirected graph with n vertices

n(n-1)/2

34
New cards

what if DFS is implemented with a queue

becomes a BFS