FAQ: Graphs: Conceptual - Representing Graphs

This community-built FAQ covers the “Representing Graphs” exercise from the lesson “Graphs: Conceptual”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science

Complex Data Structures

FAQs on the exercise Representing Graphs

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I do not understand how to read an adjacency list. So, is it 1 for every vertex the vertex in question is connected to? If so would there be a graph where all the entries in the adjacency list is 1?

What kind of graph would have an adjacency matrix with every cell filled?

Wouldnt that be a a graph with every node connected to each other. Obviously some would be more ‘connected’ than others but that would ensure every node even if the path is long would have an edge to connect to.

These last two questions seem to make me want to answer them with an abundance of caution … because 1) what is the indexing here? if its zero based for question one anyways A being zero B being the next node 1 or if it’s one indexed then 2 …

Looking for an edge in the adjacency list, how many vertices do we need to search through for P ?
P is found in the B edge list so you’d only have to reach node B to find it which luckily in this example even though there is no distinct indexing mentioned appears early in the list??!

so zero index position 1 for 1 indexing position 2

How many for B ?
Well that hits with the first traversal with node A …

so for zero index 0 or 1 indexing position 1.

Can you explain how to find edges in adjacency matrices and lists(someone, @mtf)?

Looking for an edge in the adjacency list, how many vertices do we need to search through for P?

Am I the only one finding this ambiguous? It depends on what vertex you start with: if you start with ‘X’ as your key you need to look through a list with two vertices, and if you start with ‘B’ you need to look through a list with four vertices.

1 Like

Thank you!!
I thought I was the only one thinking this. The question says “…how many vertices do we need to search through for P” and my immediate thought was, “Starting from where?”