Graphs Flashcards
Which is more general, tree or graph?
A graph which can have any combinations of nodes & edges
What two classes of graphs are there?
Undirected and directed. Directed graphs have arrow lines as opposed to plane lines.
What is the terminology for adjacent nodes for both types of graphs?
Neighbor nodes
Which node does the target and source of a directed edge lie, respectively?
predecessor, successor
What is an example of a cyclic path and acyclic path?
1→2→3→1 : cyclic
1→2→3→4: acyclic
1→1: cyclic
What does DAG stand for?
Directed acyclic graph
What is the name of a undirected/directed graph where all nodes neighbor every other node
A complete graph
What is an edge called if it is assigned a number?
A weighted edge, which could represent length
When is a graph strongly connected?
If every node is reachable with direction
When is a graph weakly connected?
If every node is reachable regardless of direction
If all nodes can be reached from a set of nodes how is this represented in java?
This can be represented as an array or list of root nodes
What condition must bee satisfied in topological numbering?
If the order is u,v then u must always occur before v in any path
What nodes are always in the first positions in topological ordering?
nodes with an in-number of zero
What is the difference between in-degree, out-degree and degree?
in-deg: edges going in
out-deg: edges going out
deg: all in & out edges
What two data structures are best suited for a dfs & bfs respectively?
dfs: stack
bfs: queue, which holds the nodes to be visited at each level