Skip to main content

All Questions

Tagged with
1 vote
1 answer
93 views

Checking whether a graph is connected in an immutable way

I have this function at the moment ...
bigfocalchord's user avatar
1 vote
1 answer
123 views

Scala graph coloring

i have solved this problem https://leetcode.com/problems/find-eventual-safe-states/submissions/ ...
nz_21's user avatar
  • 1,051
9 votes
1 answer
604 views

Kattis problem Amanda Lounges

I wrote this solution to Kattis problem Amanda Lounges in Scala. The code is written to solve a graph theory problem where it will read in a list of edges from stdin and try to compute the minimum ...
Brian McCutchon's user avatar
1 vote
1 answer
587 views

Print Connected Components Scala

Given a file containing adjacent IDs: i1, i2, i5 i3, i4 i2, i6, i7 i4, i8 i9, i3 I would like to print each of the connected components: ...
evan.oman's user avatar
  • 145
1 vote
1 answer
572 views

Convert a List of graph edges to a Map of neighboring nodes

What would be best way achieving this? Is it possible to use Immutable map? ...
Ski's user avatar
  • 265
12 votes
3 answers
477 views

Kosaraju in Scala

I started coding in Scala some time ago, and also learning some fundamental algorithms in CS. Here's a terribly slow implementation of Kosaraju algorithm to find strongly connected components in a ...
Bacon's user avatar
  • 161
2 votes
1 answer
2k views

Graphs processing in Scala

I've just started to learn Scala and decided to implement small graph library to train. Here is the basic version, that describes graph and nodes structure and also provides implementation of ...
mkrakhin's user avatar
  • 168
6 votes
1 answer
1k views

Dijkstra-like routing algorithm

I've got the following code to find the shortest path between two nodes using almost-Dijkstra's-algorithm which was written for an exercise, and I'm looking for things to improve my general Scala ...
Martijn's user avatar
  • 585
11 votes
1 answer
17k views

BFS and DFS in Scala

I would love it if someone could give me some suggestions for these 2 graph search functions. I am new to scala and would love to get some insight into making these more idiomatic. ...
JPC's user avatar
  • 375
1 vote
1 answer
145 views

Small graph API to track vertices and edges added to graph

I'm working on my Scala chops and implemented a small graph API to track vertices and edges added to graph. I have basic GraphLike Trait, and have an Undirected Graph class ( ...
Kartik Aiyer's user avatar
4 votes
1 answer
403 views

Finding and returning a loopy path in a directed graph

I wrote a function in Scala to find out and return a loopy path in a directed graph. One of the arguments is a graph presented in an adjacent list, and the other is a start node. It returns a pair ...
Qi Qi's user avatar
  • 55