We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Racso • 3 years ago

Hi everyone! I just saw a small English flag in the corner and discovered that Playgrounds can now be translated! I'm happily surprised with that, as the feature wasn't a priority at the moment when I spoke with the Tech.io team. I guess things are evolving quite fast! Soon, you'll find my playgrounds in Spanish, too! // Hola a todos. Acabo de ver una banderita inglesa en la esquina, y descubrí que ahora los playgrounds se pueden traducir. Fue una grata sorpresa, ya que las traducciones no eran una prioridad hace un tiempo, cuando hablé con el equipo de Tech.io. ¡Supongo que las cosas están evolucionando bastante rápido! En fin, pronto encontrarán mis playgrounds traducidos al español :)

Jerome Cance • 3 years ago

Yes we released translation the last week. Don't hesitate to contact me if you have any trouble with it.

Racso • 3 years ago

Thanks, Jerome Cance . Indeed, I'm having some trouble with the translation. I opened a topic in the forums about it :)

Discoordination • 3 years ago

aha parce! puedo improbar a mi castellano al mismo tiempo mi codigo ! Que guay

AndreaZanin • 3 years ago

Bravo! Great introduction to graphs. Are you planning on doing a follow up playground on something more hands-on?

Racso • 3 years ago

Thanks :) Well, yes, I want to make more playgrounds about graph theory, some of them with complete programming exercises. The thing is that learning graph theory is easy on paper (algorithms such as Dijkstra, Prim or Kruskal are surprisingly simple to understand!), but it's difficult to apply in programs for beginners. I'm trying to keep the playgrounds as simple as possible, but yes, I'd like to make some cool, advance problems for people to solve.

Did you have any ideas when you mentioned "something more hands-on"?

Oliver Reischl • 1 year ago
#fix me: for the given graph, return: maximum grade of a node

The term "grade of a node" wasn't mentioned in the course so far, i guess "degree" was meant...? This is confusing for beginners.

Steven69420 • 6 months ago

"For example, you like someone and they don't like you back".......ouch, stop stalking me

mrunmoy • 2 years ago

Awesome tutorial. Not a python programmer, tried it but it doesn't pass the test cases.

def get_graph_info(adj_list):
# adj_list is the adjacency list of a graph. It's a list of lists, with each element being the two nodes connected by an edge.
# For example, if adj_list=[[0,1],[2,3],[4,3]], we have three edges, one connecting nodes 0 and 1, another one connecting nodes 2 and 3 and a third one connecting nodes 4 and 3.

loop_count = 0
parallel_edges = False
max_degree = 0
all_nodes = dict()
adj_list_set = set()

for item in adj_list:
adj_list_set.add((item[0], item[1]))
all_nodes[item[0]] = item[0]
all_nodes[item[1]] = item[1]
if parallel_edges is False:
if item[0] != item[1]:
if [item[1], item[0]] in adj_list:
parallel_edges = True

for node in all_nodes:
# count parallel edges
if (node, node) in adj_list_set:
loop_count += 1
lst = [item for item in adj_list_set if node in item]
cur_degree = len(lst) + 1
print("degree of node {} is {}".format(node, cur_degree))
lst = [item for item in adj_list_set if node in item]
cur_degree = len(lst)
print("degree of node {} is {}".format(node, cur_degree))
if max_degree < cur_degree:
max_degree = cur_degree

return max_degree, loop_count, parallel_edges # fix me: for the given graph, return: maximum grade of a node, number of loops, boolean representing if there are parallel edges.

davidshq • 3 years ago

Thanks for the intro to graph theory. Hoping you will follow it up with additional lessons?

Racso • 3 years ago

Thank you for reading! Yes, I'm planning to do a complete series on graph theory :). In fact, this wasn't my first playground, but one on Dijkstra's Algorithm: https://tech.io/playgrounds....